Create-rootfs

From VNUML-WIKI
Revision as of 21:42, 18 March 2007 by Fgalan (talk | contribs) (steps 3-6)
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)

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 alternative, you could use a mirror of the Debian package repository close to your geographical location, like ftp.es.debian.org).
  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 (empty at the begining) 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:
  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 \