Run Browser (or whatever) in RAM

Instructional HowTo section


Locked
User avatar
wiak
Posts: 3627
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 56 times
Been thanked: 994 times
Contact:

Run Browser (or whatever) in RAM

Post by wiak »

I saw a post re: "Run Browser in RAM" in Puppy distro area

viewtopic.php?p=23004#p23004

There, s243a has written a script to do this.

However, I think no script in required in WeeDogLinux to do this since its flexible initrd/init makes it easy to arrange for any chosen programs to run in RAM (from either a numbered sfs file, or a numbered raw directory).

For the purposes of this HowTo, I'll assume firefox:

1. Download the tar.bz2 (or whatever) from Mozilla.

2. Uncompress it and make it into an sfs of name, say 03firefox.sfs (the 03 will cause it to be placed in overlayfs layer 03, but you can change that number to any position you want in the range 00 to 99; i.e. you can have up to 100 sfs module layers in any order you wish in WDL - good for rollback session effects).

3. Place 03firefox.sfs in the directory you will boot from, let's say /WDL_whatever (i.e. alongside WDL vmlinuz and initrd.gz).

4. Place any numbered sfs file you DO NOT want in RAM into an alternative location, say /WDL_whatever/not2RAM (for example: put 01firstrib_rootfs.sfs in there).

5. On grub(whatever) kernel line include the following WeeDogLinux boot option arguments:

Code: Select all

w_copy2ram w_changes=EXIT w_altNN=UUID=xxxxxxyyyyyy=/WDL_whatever w_bootfrom=UUID=xxxxxxyyyyyy=/WDL_whatever/not2RAM

Use the appropriate UUID of course - as found from blkid; yes, you can even use different devices/partition (UUIDs) for different sfs modules if you wish...

Note that you could optionally use device/partition LABEL(s) instead of UUID, or even direct device paths such as /mnt/sdb1/xxx (but direct device paths not so reliable if booting from usb since system can randomly change device name order).

That should be pretty much all there is to it (except I haven't completed user script to save the changes out of RAM at the end of a session yet - but can do that manually with cp -a command anyway...). Brief explanation:

w_changes=EXIT copies any existing stored upper_changes folder into RAM and uses that copy (at end of use you need utility to replace the old stored upper_changes if you so wish, maybe using rsync or just a straight overwrite copy works). Note: I chose the EXIT terminology in case any DebianDog user wanted to try WDL since (maybe) similar end result to their changes=EXIT kernel line argument, but I don't know how Porteus code their arrangement (did things my own way) and I have yet to code any save2flash type functionality so nothing automatically actually happens on 'EXIT' as yet since I haven't wanted/needed that myself thus far... In practice, I do however use w_changes=EXIT on my own system to use a previous upper_changes directory but generally without saving new work back at the end - though sometimes I do just overwrite the old upper_changes directory, from the running with persistence in RAM system, with cp -a command (but rsync arrangement would be better - I'll think up my own approach to that later)

w_altNN contains path to a secondary directory that contains 2-digit numbered sfs files (or numbered raw uncompressed directories) - but these do not ever get copied to RAM (but are mounted from their original location). In above example, I'm putting 01firstrib_rootfs.sfs in there.

w_bootfrom is path location of vmlinuz and initrd.gz but also any numbered sfs (or numbered raw uncompressed directory) that will get copied into RAM when the argument w_copy2ram has also been given on grubXXX kernel line (which it is in this example). This is where I'm putting the browser, 03firefox.sfs. Note that if I had also wanted 01firstrib_rootfs.sfs copied into RAM prior to use, I could have put it in this path instead (or as well as 03firefox.sfs).

So no script required. WeeDogLinux is clever enough to allow that usage simply by appropriate boot options. If you're lucky, some Puppy dev may try and now hack similar functionality into Puppy initrd/init; please ask them to kindly acknowledge the above methodology/implementation-method to WeeDogLinux - assuming they succeed in their hack it would be nice of them to remember that little detail...

Of course, you may want special handling for profiles and so on, in which case some extra scripting might well be useful.

Note that the above is only one of a couple of methods of arranging this in WDL. A more direct method is simply to edit the file w_init, that latest (dev-only) WDL allows placed in the w_bootfrom location. That simple directly editable text file contains the mount overlay stanza, so you can directly mount and add layers to it - simply edit it in geany - (without needing numbered filenames if you wish), but the method outlined in this HowTo is probably much better.

Final note: Above should work since WDL system designed with such flexibility in mind, but haven't tested that exact configuration as yet. I'm sure it will work (optimist).

wiak

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
wiak
Posts: 3627
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 56 times
Been thanked: 994 times
Contact:

Re: Run Browser (or whatever) in RAM

Post by wiak »

I forgot to add above that the functionality decribed is all provided in WDL boot-time init/w_init, which is an extremely frugal total of only 395 lines long (compare to Puppy normal initrd/init, which, as far as I remember, is in excess of 1200 lines of shell code). Correction: over 1300: https://github.com/puppylinux-woof-CE/w ... nitrd/init

The key to the above flexibility is the unique WeeDogLinux function/algorithm (_addlayers) that is called repeatedly for all of w_bootfrom, and w_altNN functionality, with another small section of code integrating that with the w_changes behaviour. I have provided a detailed explanation of _addlayers function/algorithm operation earlier (refer to below link):

viewtopic.php?p=21859#p21859

w_changes=RAM option has been in WDL since early days; w_changes=EXIT (2 line code addition to cp previously stored upper_changes into RAM also) has been in it for a few months now, but in version already supplied to WDL now officially appointed developers only. Intention was to release that latest version more generally later once other extras relating to WDLGO versions are completed - have some unresolved issues at the moment however that have slowed down my development work, so taken an overall break.

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

Locked

Return to “HowTo”