Penguin
Diff: UserModeLinux
EditPageHistoryDiffInfoLikePages

Differences between version 18 and predecessor to the previous major change of UserModeLinux.

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 18 Last edited on Wednesday, May 2, 2007 3:53:26 pm by PerryLorier Revert
Older page: version 15 Last edited on Sunday, July 4, 2004 3:46:37 am by ThomasYandell Revert
@@ -1,47 +1,68 @@
-InNeedOfRefactor  
-  
 With all the recent activity happening with Linux being ported to things, people started running out of hardware to port linux to. So one smart cookie decided to port Linux to uh, Linux! And thus the User Mode Linux project was born. 
  
 User mode linux is basically a program that lets you run linux as a normal process under linux. 
  
 To get it running under debian sid I did: 
+<pre>  
  apt-get install user-mode-linux 
+</pre>  
 you then want to add yourself to the uml-net group. I didn't find this documented anywhere, but if you don't do this, you'll get weird random messages when you try and use networking under user-mode-linux. People in this group can do nasty things to your network so only give it to people you trust yadda yadda yadda. Remember to logout/login again after making this change 
  
 Then, I created a 512 mb "hard disk" 
+<pre>  
  dd if=/dev/zero of=root_fs bs=1M count=512 
+</pre>  
 and formatted it with ext2 
+<pre>  
  mke2fs ./root_fs 
+</pre>  
 then mounted it as a loop back device 
+<pre>  
  mkdir uml && mount -o loop ./root_fs uml 
+</pre>  
 then built my disto on it 
+<pre>  
  debootstrap woody uml /mirrors/debian 
+</pre>  
 you can then boot uml 
+<pre>  
  linux single rw devfs=mount eth0=tuntap,,,''the-ip-of-your-host-machine'' 
+</pre>  
 it'll boot up into single user mode so you can configure and finalise the installation 
+<pre>  
  ifconfig eth0 ''the-ip-of-your-uml-machine'' netmask ''the-netmask'' 
  route add -net 0 gw ''the-ip-of-your-gateway'' 
  apt-get update 
  apt-get upgrade 
+</pre>  
  
 This failed on my system, but it passed after creating a /etc/apt/apt.conf file with the following content 
+<pre>  
  APT::Default-Release "woody"; 
  APT::Cache-Limit 10000000; 
  Apt::Get::Purge; 
+</pre>  
  
 You don't need lilo, and it gets in the way, so lets get rid of it. 
+<pre>  
  apt-get remove lilo 
+</pre>  
 Now lets configure all the packages 
+<pre>  
  dpkg-reconfigure -a 
  tzconfig 
+</pre>  
 now before we reboot we need to create some files that the installer usually creates 
+<pre>  
  echo /dev/ubd/0 / ext2 defaults,errors=remount-ro 0 1 >/etc/fstab 
  echo none /proc proc defaults 0 0 >>/etc/fstab 
  
  echo ''hostname-of-your-uml-machine'' >/etc/hostname 
+</pre>  
  
 and lets set up networking on boot 
+<pre>  
  echo 'auto lo' >/etc/network/interfaces 
  echo 'iface lo inet loopback' >>/etc/network/interfaces 
  echo 'auto eth0' >>/etc/network/interfaces 
  echo 'iface eth0 inet static' >>/etc/network/interfaces 
@@ -49,33 +70,54 @@
  echo ' netmask ''netmask''' >>/etc/network/interfaces 
  echo ' network ''network''' >>/etc/network/interfaces 
  echo ' broadcast ''broadcast''' >>/etc/network/interfaces 
  echo ' gateway ''gateway''' >>/etc/network/interfaces 
+</pre>  
  
 and setting the hardware clock will always fail in uml 
+<pre>  
  rm /etc/rcS.d/*hwclock* 
+</pre>  
  
 now, lets configure /etc/inittab correctly, replace tty1 with vc/0, tt1 with vc/1 in the file. 
  
 and now lets copy the modules over 
+<pre>  
  mkdir -p /mnt/host 
  mount none /mnt/host -o / -t hostfs 
  mkdir -p /lib/modules/`uname -r`/kernel 
  cp -r /mnt/host/usr/lib/uml/modules/`uname -r`/kernel/* /lib/modules/`uname -r`/kernel 
  depmod -a 
+</pre>  
 for me it complains about the scsi devices, since this is a virtual kernel, I figure i don't need them so I deleted them then rerun depmod 
  
 and now your box should be ready to boot again, so shutdown -h now the box then 
+<pre>  
  linux devfs=mount eth0=tuntap,,,10.100.1.8 ro 
+</pre>  
  
 voila, it should boot up, pop up some windows and ask you to login! 
 ------------- 
 or you can do it the easy way. copy /etc/rootstrap/rootstrap.conf into the current working directory, edit the networking config (don't meddle with too many of the options, many of them don't work if you change them, for instance installing sid doesn't work...) and run (in the same directory) 
+<pre>  
  ./rootstrap root_fs 
+</pre>  
 wait a significant time. you now have a uml image installed. you can start it with 
+<pre>  
  ./linux th0=tuntap,,,''ip-of-your-host-machine'' ro 
+</pre>  
  
 you're done. 
+  
+--------------  
+  
+If you want to reduce the size that your root_fs take up, try the following:  
+  
+* defrag the volume (apt-get install defrag on debian)  
+* zero the free space (get zerofree from http://intgat.tigress.co.uk/rmy/uml/sparsify.html)  
+* make the file sparse  
+ * either use sparsify from the above link or  
+ * cp --sparse=always <orig fs> <sparse fs>  
  
 -------------- 
  
 !Traps for young players 
@@ -91,8 +133,9 @@
 !Mounting one of the pre-built Root FSes (ON THE HOST!) 
  
 It took a while for me to work out how to mount a root FS for RH9 so I could change it before booting UML. The FS had two partitions and a partition table, so mount the_fs /mnt -o loop didn't work. It turns out you need to specify an offset to mount to skip past the partition table. You can find out how many bytes to skip by doing this: 
  
+<pre>  
  # fdisk redhat9.image.server-minimal.disk 
  Command (m for help): u 
  Changing display/entry units to sectors 
  
@@ -115,6 +158,7 @@
  For details type `warranty'. 
  32*512 
  16384 
  # mount redhat9.image.server-minimal.disk /mnt -o loop,offset=16384 -t ext3 
+</pre>  
  
 Sorted.