Create-rootfs

From VNUML-WIKI
Revision as of 22:02, 18 March 2007 by Fgalan (talk | contribs) (step 11-12)
Jump to: navigation, search

How to create a VNUML-compatible root filesystem from scratch using debootstrap

Introduction

Virtual machines created by VNUML need a root filesystem (root_fs) to work. The VNUML root_fs are basicly UML filesystem, slightly tunned to work with the tool (for example, special mount point has to be created). That modifications/requirements are described in one section in the User Manual.

Until know the VNUML Project has provided a root_fs_tutorial filesystem for download (current version at time of writting this is 0.4.1). However, mantaining the root_fs_tutorial is costly because there are a lot of details to check when a new version is released. In addition, the bunch of packages included in root_fs_tutorial hardly satisfy all the user needs (some won't find the particular packages they want and many others will have a lot of unnecessary stuff they don't need).

Therefore, a more practical approach is to provide simple and easy-to-implement procedure that allow user to produce it's own VNUML-compatible filesystems, with the size and software package they want. This goal is addressed by the present document.

The procedure described in this document has been developed by Michael Monreal, with minor additions and fix by Fermín Galán.

Procedure

The procedure will create a Debian-based VNUML-compatible root_fs. We asume you are using Debian (or maybe other Debian-based distribution) to generate the root_fs. Before starting ask yourself:

  • The size of the desired root_fs (we'll consider 800Mb here)
  • Which Debian packages you want to include (we'll use here a list based on the contents of root_fs_tutorial).

Note that the base filesystem created by debootstrap seems to take around 200MB. Take it into account when deciding the root_fs size and the packages that you will install.

Let's go (I'll asume you are logged as root; otherwise execute privileged commands using sudo):

  1. Create an ext3 filesystem (800MB). Change the destination directory (/usr/share/vnuml/filesystems) if it is not suitable for you.
  2.   $ dd if=/dev/zero of=/usr/share/vnuml/filesystems/debian.ext3 bs=1024k seek=800 count=0
      $ mkfs.ext3 /usr/share/vnuml/filesystems/debian.ext3
      $ tune2fs -c 0 -i 0 /usr/share/vnuml/filesystems/debian.ext3
    
  3. Mount and use debootstrap to install the latest "etch" release. The last command can take a while, depending of the speed of your Internet connection (as a figure I have a high speed connection and I has taken around 11 minutes). You could use a mirror of the Debian package repository close to your geographical location (like ftp.es.debian.org) if you want.
  4.   $ mkdir /mnt/debian
      $ mount -o loop /usr/share/vnuml/filesystems/debian.ext3 /mnt/debian
      $ debootstrap etch /mnt/debian/ ftp://ftp.debian.org/debian/
    
  5. Change root to the new system
  6.   $ mount -t proc none /mnt/debian/proc
      $ chroot /mnt/debian
      # env -update
    
  7. Edit /etc/apt/sources.list with some like that:
  8.   deb http://ftp.debian.org/debian etch main contrib non-free
    
  9. Refresh package cache
  10.   # apt-get update
    
  11. Install the desired packages (it's up to you! :). Here were are using an arbitrary list, based on the old root_fs_tutorial, around 151MB after unpacking. It is highly recommendable to install at least openssh-server (for the sshd daemon).
  12.   # apt-get install apache2.2-common apache2-mpm-prefork apache2-utils \
         bzip2 dnsutils ethereal-common fdutils file fileutils finger ftp ftpd \
         iproute ipsec-tools iputils-tracepath ipv6calc ipvsadm less lpr lsof \
         lynx modutils ncurses-term  nfs-common openssh-client openssh-server \
         openssl perl perl-modules pidentd portmap ppp procmail python \
         python-central python-newt quagga racoon radvd setserial sharutils \
         shellutils squid squid-common ssh ssl-cert strace syslinux tcpdump \
         tcsh telnet tethereal textutils time tshark ucf vlan whois \
         wireshark-common sudo vim iptables
    
  13. (Optional) If you want to free space of the downloaded packages (around 42MB): # apt-get clean
  14. Set timezone (use the proper one for you, I'm using Europe/Madrid because it corresponds where I live :)
  15.   # ln -sf /usr/share/zoneinfo/Europe/Madrid /etc/localtime
    
  16. Edit /etc/hosts (no existing at the begining)
  17.   127.0.0.1		localhost
      ::1             	localhost
      
      # The following lines are desirable for IPv6 capable hosts
      ::1     ip6-localhost ip6-loopback
      fe00::0 ip6-localnet
      ff00::0 ip6-mcastprefix
      ff02::1 ip6-allnodes
      ff02::2 ip6-allrouters
      ff02::3 ip6-allhosts
    
  18. (Optional) Edit /etc/hostname and set a name different from the one of the host where you executed debootstrap (actually, VNUML will set the host name properly based on the name of the virtual machine so this step is optional but recommendable anyway).
  19. Edit /etc/network/interfaces (empty at the beginging):
  20.   iface lo inet loopback
      auto lo
    
  21. Edit /etc/fstab (empty at the beginging):
  22.   proc         /proc          proc     defaults   0 0
      devpts       /dev/pts       devpts   mode=0622  0 0
      /dev/ubda    /              ext3     defaults   0 1
      /dev/ubdb    /mnt/vnuml     iso9660  defaults   0 0