FirstRib a full installed distro

Turning your fully installed Linux distro into a frugal install via FirstRib

A full installed distro tends to lack the flexibility of a frugal install (despite usually being easier to upgrade), particularly when you want to try out new ideas, apps and configurations and so on, but decide you prefer not to include a working session on next boot. With a FirstRib initrd frugal installed distro you can simply use its w_changes=RAM2 mode and only save your session if you so choose.

Fortunately it is very easy indeed to FirstRib frugal-convert most fully installed distros and, if you wish, just as easily change it back to full installed afterwards. Whilst the steps below may seem a lot, in fact they are really simple to do in practice.

Since you are going to be quickly re-arranging the fully installed filesystem you need to boot into a different distribution to do this, and something like KLV-Airedale is a good choice for doing such work (either booted from a usb stick or whatever). The following works for most fully installed Linux distributions, but here I'll use the example of converting my own fully installed Zorin Lite 16 distro that sits on my nvme SSD drive partition /dev/nvme0n1p6. Of course all such work is at YOUR OWN RISK.

Full install to FirstRib frugal

Steps (using KLV-Airedale to do the conversion but any Linux would do with appropriate tools):

  1. Boot into KLV-Airedale Linux

  2. Mount the partition on which you have your fully installed Zorin Lite (or whatever distro you are converting from full to frugal).

I just use the filemanager (Thunar in this case) to do that.

  1. At the root of that partition, next to the whole Zorin Lite hierarchy, make an empty directory for containing the FirstRib frugal version (name unimportant, but say, “FR_Zorin”), and within that make another empty directory whose name starts with a 2-digit number. That second directory is going to contain the whole Zorin filesystem so I'm calling it 08zorinlite. If that was done from a terminal you could use:

mkdir -p FR_Zorin/08zorinlite

(To keep some full install behaviours, but with the usual frugal install advantages, you could instead make a ‘pseudo full-install’ of the usually fully installed distro. To do that instead of directory name 08zorinlite use directory name upper_changes to store the Zorin lite filesystem hierarchy, and also mkdir FR_Zorin/07dummy. Pseudo full-install, which is a special case of frugal install mode, is described here: FirstRib frugal-pseudo-full install howto)

  1. Back at the root of partition /dev/nvme0n1p6 where full Zorin is installed, I then select everything EXCEPT that new FR_Zorin directory and move all of the Thunar highlighted files and directories into FR_Zorin/08zorinlite (i.e. copy all except FRZorin directory itself from / and then paste-move into FR_Zorin/08zorinlite). That moves all the Zorin lite filesystem out of / and into directory FR_Zorin/08zorinlite. Note that such a ‘move’ takes almost no time at all since on same partition, so it is just a quick drag and drop operation in Thunar.

BUT A MAJOR WARNING!!! For this post I am using a usb stick that has grub boot loader on it for booting. However, it is more likely you are currently using the version of grub provided by your full installed distro on your hard drive. That being the case you must leave a copy of the grub-related components behind on the root of the partition where they were. For Zorin Lite, I think that just needs me to leave a copy of its /boot directory where it was, since that contains its grub.cfg file.

Like all FirstRib booted distros, aside from that now created 08zorinlite filesystem (which you can leave as an uncompressed directory or later turn it into a sfs squashed filesystem using mksquashfs utility), all you need now is a copy of the distro vmlinuz put beside that and also a copy of FirstRib skeleton initrd.gz, but with that initrd.gz modified to also contain a copy of the Zorin lite kernel's driver modules. Hence:

  1. Take a copy the distros vmlinuz (e.g. for the case of Zorin, from /boot directory) and put it in FR_Zorin/08zorinlite

  2. Now obtain a copy of FirstRib skeleton initrd.gz and put it into FR_Zorin/08zorinlite along with a copy of the FirstRib utility script modify_initrd_gz.sh. From terminal opened at directory /FR_Zorin/08zorinlite/ now run the command:

./modify_initrd_gz.sh initrd.gz

to uncompress the skeleton initrd.gz file to directory initrd_decompressed ready for putting the kernel driver modules into it.

Then, using say Thunar, copy and paste modules from 08zorinlite/usr/lib/modules/* (in some distros it will simply be in lib/modules) into initrd_decompressed/usr/lib/modules/

  1. You should now be able to make a new date-stamped initrd.gz simply by typing ‘exit’ (without quotes) in the terminal you used modify_initrd_gz.sh to uncompress the original skeleton initrd.gz from. Then you can delete the original skeleton initrd.gz and rename the new date-stamped version simply as initrd.gz ready for booting via the likes of grub2 (for example with RAM2 frugal install mode):

    menuentry “FR_Zorin” { insmod ext2 search –no-floppy –fs-uuid –set 424d8f42-e835-4111-9053-dd086b3d38e8 linux /FR_Zorin/vmlinuz w_bootfrom=UUID=424d8f42-e835-4111-9053-dd086b3d38e8=FR_Zorin w_changes=RAM2 initrd /FR_Zorin/initrd.gz }

The UUID shown (obtained for example from blkid command) should be changed to that of the partition which contains the FR_Zorin directory. Thus configured you should now be able to boot Zorin lite as a FirstRib frugal install with all the usual FR initrd magic!

Converting back to a full install

It is simplicity itself to restore the set up back to the original full install.

  1. Once again, boot into other distro such as KLV-Airedale.

  2. Mount the partition where the now frugal installed Zorin lite is.

  3. Using your filemanager (Thunar here), highlight all the files and directories in 08zorinlite directory and copy and then paste-move them into the root directory of the holding partition (which on my system is /dev/nvme0n1p6). Note that you don't need to keep a copy of these inside 08zorinlite since now going to be booting the full installed copies and not using 08zorinlite/ at all. You can keep them if you wish, but having two copies of Zorin lite filesystem would take up a lot of disk space.

That's all there is to the reversal. The returned-to-full-installed Zorin lite should now be bootable exactly as it was originally.

NOTE: You may still want to keep the rest of the remaining contents of the still existing /FR_Zorin/ since that contains that specially made initrd.gz should you want to revert back to frugal version again (which will be particularly easy then to repeat). Otherwise, you can simply delete it and all is back the way it was before you did any of this!


Tiny Linux Blog: https://www.tinylinux.info/

Avatar
wiak
sometimes Linux system/apps developer

My earlier research interests included TCP/IP performance/optimisation over noise-prone, long-delay, VSAT links; and cloud-based, autobuild, virtual machines network construction methodologies for distance learning data-comms students’ research and laboratory work.