frugal2qemu (experimental only!): no grub required

FirstRib/KL topics related to Virtualization


Moderator: Forum moderators

Post Reply
User avatar
wiak
Posts: 4082
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 65 times
Been thanked: 1208 times
Contact:

frugal2qemu (experimental only!): no grub required

Post by wiak »

USE AT YOUR OWN RISK!!! Worked fine for me in the end... but no guarantee this won't corrupt your disk!

This utility was designed to boot a traditional FirstRib/KL frugal installed distro directly as a (read-only) qemu virtual machine.
It does so by using the qemu arguments -kernel, -initrd, and -snapshot (to prevent writing back to save persistence).

Prior to this publication announcement I expanded the utility to allow it to work immediately with frugal installed distros of type:

FirstRib/KL
Puppy Linux
DebianDog
FatDog
EasyOS

In practice any frugal installed distro should be able to be used with suitable configuration information. The main script can of course be easily modified to use additional qemu-related arguments. Alternatively a config file variable q_extras is provided to allow ease of addition in the form of an addon string to the main internal qemu command.

Note that I only know FirstRib boot arguments very well nowadays so there may well be better boot arguments that can be used with the other distros. Feel free to let me know.

An important point to understand with the mechanism employed by this utility is that the resultant qemu VM is using the same filesystem as the host. Per qemu documentation, it would be 'VERY DANGEROUS!!!' to allow the qemu machine to write back to a host mounted filesystem since it holds filesystem tables in its own RAM and thus has a different view of the same media to that of the host, which in experimental practice I found often resulted in host filesystem corruption. Obviously we don't want that so I use the -snapshot argument to qemu, which it seems prevents all writes back by qemu. Later I will experiment further with 9p as an alternative approach to accommodate write-backs.

DISCLAIMER:
In view of the above potential (but hopefully mitigated) dangers, this utility remains experimental and you should ONLY USE IT AT YOUR OWN RISK since my understanding of -snapshot argument 'could' turn out to be wrong(!) However, I have had no issues since incorporating that argument into the script. Of course any modifications to the script are also entirely at your own risk...
Nevertheless, in practice, I am personally finding the utility very useful so maybe you will too.

DOWNLOAD and USAGE instructions:

1. Install qemu on you host distro if you do not already have it and make sure your machine BIOS has Virtualisation enabled.

2. Simply now put an executable copy of the utility (frugal2qemu.sh) into the frugal install directory of the frugal installed distro you want to run in qemu virtual machine, along with a copy of the appropriate distro configuration file (such as, for example, frugal2qemu.cfg_firstrib or frugal2qemu.cfg_puppy).

You can fetch copies of these from the FirstRib gitlab site as follows:

Code: Select all

wget -c https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/frugal2qemu/frugal2qemu.sh && chmod +x frugal2qemu.sh

AND whichever appropriate config file you need for your purposes using either:

Code: Select all

wget -c https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/frugal2qemu/frugal2qemu.cfg_firstrib
wget -c https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/frugal2qemu/frugal2qemu.cfg_puppy
wget -c https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/frugal2qemu/frugal2qemu.cfg_debiandog
wget -c https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/frugal2qemu/frugal2qemu.cfg_fatdog
wget -c https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/frugal2qemu/frugal2qemu.cfg_easyOS

3. You can now run your frugal installed distro in qemu by opening a terminal at the frugal install directory and entering command:

Code: Select all

./frugal2qemu.sh frugal2qemu.cfg_distroname

Note 1: The utility will automatically find and use the appropriate UUID (using code extracted from wd_grubconfig and firstribit) and also the frugal install directory location. So user has nothing they need to do in that way and no bootloader use/configuration such as grub is required at all... ;-)
Note 2: If the cfg file is simply named as 'frugal2qemu.cfg' it will be used automatically, and if it doesn't exist the default values used are for booting a FirstRib/KL distro.
Note 3: You are given the opportunity to edit the config file for whatever qemu parameters (such as guest VM mem size or vga type) you prefer, or simply edit the cfg file directly prior to executing the frugal2qemu.sh utility.
Note 4: The utility also works with many, but not all, firstribit constructed frugal installations. Some of these end up with an initrd that is too large by default for qemu use (but that could be fixed) and others - well who knows. The following firstribit distros work well via this utility: Fedora LXQt, 4MLinux, FR_bookwormpup64
Note 5: Some other FR/KL distros known to 'work' with this: KLV_Sway, an old KLV_JWM/ROX distro by rockedge; some others didn't work - haven't had time to find out why...

Some screenshots of frugal2qemu in use were previously provided in a related dev thread (viewtopic.php?p=126064#p126064)
I have attached some of them below as exemplars instead.

Attachments
frugal2qemu_KLV_XFCE.jpg
frugal2qemu_KLV_XFCE.jpg (95.9 KiB) Viewed 322 times
frugal2qemu_DebianDog.jpg
frugal2qemu_DebianDog.jpg (64.75 KiB) Viewed 327 times
frugal2qemu_FatDog.jpg
frugal2qemu_FatDog.jpg (65.95 KiB) Viewed 336 times
frugal2qemu_bookwormpup.jpg
frugal2qemu_bookwormpup.jpg (85.93 KiB) Viewed 336 times
frugal2qemu_easyOS.jpg
frugal2qemu_easyOS.jpg (89.82 KiB) Viewed 336 times

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

Post Reply

Return to “Virtualization”