Finnix for User Mode Linux (UML) and Xen
Welcome to Finnix for User Mode Linux!
................................................................................
[*] Running Linux kernel 2.6.14-um on i686
[*] Host: Linux coma 2.6.14-skas3-v8.2 #1 Sun Nov 6 12:24:50 PST 2005 i686
[*] Scanning for partitions and creating /etc/fstab... done
[*] Using swap partition /dev/ubdb
[*] Starting background DHCP request... eth0
[*] Finnix version 86.1-dev ready; 345 packages available
INIT: Entering runlevel: 2
root@tty0:~# uname -a
Linux finnix 2.6.14-um #3 Mon Nov 7 08:53:43 PST 2005 i686 GNU/Linux
root@tty0:~# shutdown -h now
INIT: Switching to runlevel: 0
INIT: Sending processes the TERM signal
Session terminated, killing shell... ...killed.
[*] Sent all processes the TERM signal...
[*] Sent all processes the KILL signal...
[*] Shutting down network device... eth0
[*] Turning off swap.... done
[*] Unmounting remaining file systems... done
[*] Shutting down...
|
Starting with version 86.1, Finnix can be run as guest inside User
Mode Linux (UML) and Xen virtualization
systems. UML/Xen mode functions almost identically to a normal Finnix
environment, except most autodetection is suppressed (PCMCIA, USB,
PCI scan, etc). This can be set up several different ways:
Finnix on Finnix
The easiest way to see how Finnix can be run using UML is by booting
Finnix itself! Using UML, a guest copy of Finnix can be run from within
the running Finnix CD itself! After you are booted, simply type "finnix
create", and a new Finnix installation will be created and started
in a screen session. This installation uses the exact same CD image that
was used to boot the main Finnix CD. Networking is available within this
guest though a NAT translation (the IP address seen by the guest is in
the 10.182.250.0 range). Multiple Finnix UML guests can be created by
simply detaching from the current Finnix UML session (Ctrl-A, d), then
typing "finnix create" again. Each Finnix UML guest requires
64MB of additional memory.
UML: Modified Guest Kernel
Finnix can be run unmodified using the Finnix ISO itself, a modified
guest kernel, and a small initrd. This is the preferred method, however
your guest UM kernel must be patched with unionfs and squashfs, and the
options must be turned on, compiled into the kernel itself (besides,
using a modular kernel with UML is insecure). Both patches are available
in the files directory. If you just want to get
up and running, there is a pre-compiled guest kernel available as well:
- Download the latest Finnix ISO and symlink it to "finnix.iso".
- Boot Finnix, and copy /usr/share/finnix-uml/linux-*-um-finnix and
/usr/share/finnix-uml/initrd.img to the hard drive. Symlink the linux
kernel copied above to "linux".
- Reboot into your normal installation.
- Run: ./linux mode=tt mem=64M initrd=initrd.img root=/dev/ubda
ubdar=finnix.iso uml
Notes:
- The "uml" parameter is used to tell Finnix that it is running
in UML mode.
- The "mode=tt" parameter is needed for hosts that do not
have the UML SKAS patch applied. If you plan to do any serious UML
work, you will want SKAS mode in the long run, as TT mode has several
disadvantages; namely, it's ridiculously slow.
- Additionally, if you are running in TT mode, the guest will exit
suddenly after typing "halt", as it seems that the "killall5" command
used in the shutdown script kills everything, including the kernel
threads. Therefore, any filesystems you mount will NOT be cleanly unmounted.
This problem does not exist in SKAS mode.
- Note the "ubdar=..." parameter. The "r" flag
prevents the guest from writing to the image. Without this flag, the
guest could do "dd if=/dev/zero of=/dev/ubda" and overwrite
the ISO.
- You can also pass the FINNIX/FINNIX squashfs file directly, by specifying
the "squashroot" kernel command line option. For example:
./linux mode=tt mem=64M initrd=initrd.img root=/dev/ubda ubdar=FINNIX
squashroot uml
- No networking is available in this example. Networking in UML requires
a decent amount of work to get up, and is left as an exercise to the
reader.
UML: COW Mode
Finnix can be run without any special modifications to the guest kernel
and without an initrd, but you must do some prep work first, and more
space on the host will be needed. Additionally, any data changed during
the guest session is written to disk temporarily, as opposed to RAM.
COW stands for Copy On Write, and performs a similar function to unionfs.
To begin:
- Download and boot the latest Finnix ISO.
- Mount a hard drive: mount /mnt/hda1
- Create a 500MB loopback file (350MB is the minimum, but you'll want
some extra room too): dd if=/dev/zero of=/mnt/hda1/finnix.img bs=1024k
count=500
- Create a filesystem on the loopback file: mke2fs -j /mnt/hda1/finnix.img
- Mount the loopback file: mkdir /mnt/loop; mount -o loop /mnt/hda1/finnix.img
/mnt/loop
- Copy the contents of /FINNIX into the loopback file: rsync -a
/FINNIX/ /mnt/loop/
- Unmount: umount /mnt/loop; umount /mnt/hda1
- Reboot.
At this point, you have a working Finnix root filesystem. However, if
you were to have UML use it by itself, any changes made during the UML
Finnix session would NOT be lost. Although this will not damage the Finnix
installation itself, it really doesn't go along with the "LiveCD" mentality.
Enter COW:
TMPCOW=`mktemp -p .`
rm -f "${TMPCOW}"
./linux mode=tt mem=64M root=/dev/ubda ubda=${TMPCOW},finnix.img uml
rm -f "${TMPCOW}"
Again, if you are using SKAS, "mode=tt" is not required. By
prefixing a non-existent filename to the actual Finnix image, the differences
during the session are written to that file sparsely, and the actual
image file is not modified. After the session is over, simply remove
the sparse COW file.
Xen
Finnix can also be run as a Xen guest ("domU"). You must
use the "xen" parameter instead of "uml". "Xen" mode
and "UML" mode are nearly identical, except UML mode opens
the bash shell on tty0, while Xen mode opens the bash shell on tty1.
Finnix on the Xen 3.0.0 Demo CD
The following is an easy method to get up and running with Finnix on
the Xen 3.0.0 Demo CD under VMware (or any computer with 2 CD-ROM drives).
- Download Finnix
86.1.
- Download the Xen 3.0.0
Demo CD.
- Set up VMware so the Xen CD is on hdc (IDE 1:0) and the Finnix CD
is on hdd (IDE 1:1).
- Boot the Xen CD.
- Download and untar finnix-86.1-xen-3.0.0.tar.gz into
/root (2MB). This tarball contains a sample xm config file, a
modified domU kernel (2.6.12.6-domU with squashfs and unionfs patches
applied),
and
a Finnix UML/Xen initrd.
- Run: xm create -c /root/finnix-conf name=finnix
Notes:
- A screenshot of the Xen Demo CD running Finnix is available here.
- Finnix can be run on any Xen 3.0.0 installation, but this guide was
written to get a demo running as quickly as possible on the Xen
Demo CD. Instead of specifying "phy:/dev/hdd" in the config file, you
can
specify "file:/path/to/finnix-86.1.iso" if you have the ISO itself
available on the host filesystem.
- You can safely ignore the warning about /lib/tls. The initrd runs
a pivot_root/chroot to start init, which is what Xen is mentioning.
However,
one of the first commands run after init begins is "rm -rf /lib/tls".
UML/Xen and PowerPC
UML and Xen are not available for PowerPC, and hence you cannot use
Finnix-PPC as a UML/Xen guest. However, if either of these systems become
available for PowerPC (I would guess UML would be first, if ever), Finnix-PPC
should be able to run on it.
|