PDA

View Full Version : ANNOUNCE: UML inside Knoppix using compr. /KNOPPIX fs



jsteffan
06-20-2003, 10:32 PM
Hi,

I've just managed to get user mode linux runnig inside
Knoppix.

I made an ext2 image containing the filestructure that
is normaly created inside the ramdisk. A few lines where
added to the init script (/etc/init.d/rcS) to mount the
/KNOPPIX directory from the base knoppix instance on
/KNOPPIX inside the uml instance.
To make this work the static ash shell from the bootdisk
(miniroot.gz) was included and /etc/init.d/rcS changed to
use /static/ash instead of /bin/sh (which isn't there when
the script is called).
Beside of this I only changed the default runlevel in
/etc/inittab to 2 (no X) and reduced the number of
consoles to one (I don't want my screen cluttered)
Next thing to be done is to remove all the autoconfiguraton
stuff which makes no sense inside UML.

The image is a sparse file which takes only 4.8MB on
disk. The filesystem inside however can grow upto 128MB,
which should be enough for most cases as the whole
knoppix filesystem is available.
A nice thing about UML is that changes to the filesystem
can be written to an overlay 'copy on write' (cow) file, so
the actual image can stay on the read-only medium.
UML, its utilities and this image add less than 10MB to
Knoppix.

OK, want to try it out?

boot knoppix
download the image from
http://www.ito.tu-darmstadt.de/staff/Jan/knoppix-uml-image.bz2
Uncompress it:

cp -p --sparse=always <( cat knoppix-uml-image.bz2 | \
bunzip2 -c - ) knoppix-uml-image

Then you a UML kernel and at least a small utiliy programm
which UML needs to open console windows.
Get it from the UML deb packages or download it here:
http://www.ito.tu-darmstadt.de/staff/Jan/linux.bz2
http://www.ito.tu-darmstadt.de/staff/Jan/port-helper.bz2
uncopress both and put it into your path

Now an UML Knoppix instance can be startet with:


linux ubd0=/tmp/cowfile,knoppix-uml-image hostfs=/KNOPPIX


see
linux --help for more options. Most Knoppix
boot parameters like 'lang' work too.

BTW: there's another really nice Linux Boot-CD based on
Redhat which contains UML:
http://dc.qut.edu.au/adios/adios-project.html

Jan

garyng
06-21-2003, 12:44 AM
I am confused. Do you mean your run a modified KNOPPIX under UML ? I am under the impression that UML needs kernel patch or do you mean it is already there in the current KNOPPIX distribution and I can run any UML under it ? I want to try out UML but until still don't quite understand how it works.

jsteffan
06-21-2003, 03:39 PM
You can run this with an ordinary Knoppix. The three files (user
mode kernel, filesystem image, port-helper) are all you need.

UML doesn't depend on the kernel of the base system. UML uses
its own kernel which is patched to run in user space just like any
other binary.
This linux.bz2 is a UML kernel which can be unpacked and started
on top of any Linux system - in this case Knoppix. You can just
start this binary withou parameters and it will boot until its trying
to mount the root filesystem. So what you have to do is specify
a filesystem on the command line.

The special thing about this particular filesystem image is that it
mounts the /KNOPPIX read-only filesystem (as the normal Knoppix
does). So what you get is Knoppix running inside Knoppix!

In order to enable e.g. networking between the base Knoppix and
the UML Knoppix one would need the UML-tools. This should be
installed on a customized Knoppix. It also would be a good idea, to
add the SKAS patch to the Knoppix kernel which leads to a
significant performance increase for UML.

garyng
06-22-2003, 03:29 AM
thanks for the explanation. Now if UML's COW fs feature can be used on knoppix image, that would open a whole new world.

Eager to try it out, need more reading.

jsteffan
06-22-2003, 12:13 PM
using the cow file to store changes of the /KNOPPIX filesystem
would be really cool. This would mean, that Knoppix could be
used like a hd installation with every file being writeable!
I've had this idea, too, but this can't be done without hacking
the kernel. At least it seems to me, that it could be done.

At the moment the /KNOPPIX fs is mounted read-only inside the
UML image just like in the ramdisk. And as in the ramdisk only
a few files can be modified, the rest are symbolic links to
/KNOPPIX. One benefit is that the cow-file can be stored somewhere,
so you have a "persistent ramdisk".

garyng
06-22-2003, 02:06 PM
I am experimenting with the transluency module for the moment which is similar in concept to the COW on UML though it is implemented at the system call level and there is some situation that it doesn't work yet. I did tried a few apt-get install and it works. But if COW of UML works on clooped file, it should be better as that is at the block level and should have less 'patches' as in translucency.

BTW, how can I create a sparse file which contains the ext2 image ? Currently I only do "dd" to create an empty file and mke2fs on it.

jsteffan
06-22-2003, 02:57 PM
My goal is to get UML running on Knoppix to use it for teaching.
I won't go deeper into this cow for Knoppix issue.
Regarding UNL root filesystems, have a look at
http://www.stearns.org/mkrootfs/rootfs.html