Difference between revisions of "Vnx-rootfsfreebsd"

From VNX
Jump to: navigation, search
(Basic installation)
Line 13: Line 13:
 
<li>Configure the serial console by editting /etc/ttys file and changing the line:</li>
 
<li>Configure the serial console by editting /etc/ttys file and changing the line:</li>
 
  ttyu0 "/usr/libexec/getty std.9600"  dialup  off secure
 
  ttyu0 "/usr/libexec/getty std.9600"  dialup  off secure
by:
+
to:
 
  ttyu0 "/usr/libexec/getty std.9600"  vt100  on secure
 
  ttyu0 "/usr/libexec/getty std.9600"  vt100  on secure
 
<li>Set dual console configuration (see http://www.cct.lsu.edu/~ccui/diary/August19_2010.php):</li>
 
<li>Set dual console configuration (see http://www.cct.lsu.edu/~ccui/diary/August19_2010.php):</li>

Revision as of 08:31, 22 May 2012

How to create a Freebsd root-file-system for VNX

Basic installation

  • Create the filesystem disk image:
  • qemu-img create -f qcow2 vnx_rootfs_kvm_freebsd.qcow2 8GB
    
  • Get FreeBSD installation CD. For example:
  • wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/ISO-IMAGES/9.0/FreeBSD-9.0-RELEASE-i386-disc1.iso
    cp FreeBSD-9.0-RELEASE-i386-disc1.iso /almacen/iso
    
  • Create the virtual machine with:
  • vnx --create-rootfs vnx_rootfs_kvm_freebsd.qcow2 --install-media /almacen/iso/FreeBSD-9.0-RELEASE-i386-disc1.iso --mem 512M
    
  • Follow FreeBSD installation menus to install a basic system with DHCP configured in the network interface and a user named "vnx".
  • Configure the serial console by editting /etc/ttys file and changing the line:
  • ttyu0 "/usr/libexec/getty std.9600"   dialup  off secure
    

    to:

    ttyu0 "/usr/libexec/getty std.9600"   vt100  on secure
    
  • Set dual console configuration (see http://www.cct.lsu.edu/~ccui/diary/August19_2010.php):
  • echo "-Dh" > /boot.config
    echo 'boot_multicons="YES"' >> /boot/loader.conf
    echo 'boot_serial="YES"' >> /boot/loader.conf
    echo 'console="comconsole,vidconsole"' >> /boot/loader.conf
    
  • Finally, halt the system:
  • halt -p
    

    </pre> -->

    Configuration

  • Start the virtual machine again and:
    • Install bash and change package repository:
    • pkg_add -r bash
      pw usermod root -s /usr/local/bin/bash
      pw usermod vnx -s /usr/local/bin/bash 
      echo "export PACKAGEROOT=ftp://ftp.es.freebsd.org" > ~/.bash_profile
      
    • Install perl and XML::DOM library:
    • pkg_add -r perl p5-libxml-enno
      
    • Disable DHCP on network interface by editing the /etc/rc.conf file and commenting the following line:
    • ifconfig_re0="DHCP"
      
    • Install VNX autoconfiguration daemon:
      • From the host execute:
      • /usr/share/vnx/bin/vnx_update_aced Freebsd /usr/share/vnx/aced/vnx-aced-lf-0.1b.tgz 
        
      • From the virtual machine console:
      • mount /cdrom
        /cdrom/install_vnxdaemon
        
    • Optional: allow root login thorugh ssh by editing /etc/ssh/sshd_config file:
    • PermitRootLogin yes
      
    • Optional: set locales according to your preferences in /etc/profile:
    • export LANG=es_ES.UTF-8
      export LC_ALL=es_ES.UTF-8
      
    • Optional: add gnome window manager with:
      • Install packages needed:
      • pkg_add -r xorg-minimal gnome2-lite gdm detach xeyes xhost wmctrl
        
      • Add the following line to /etc/rc.conf:
      • gnome_enable="YES"
        
      • Add the following line to /etc/fstab:
      • proc    /proc   procfs  rw      0       0
        
      • Disable the screensaver and change keyboard configuration in "System->Keyboard" menu.
    • Optional: reduce the boot timeout from 10 seconds to, for example, 3 seconds. Edit /boot/loader.conf and add:
    • autoboot_delay="3"
      
    • Optional: give vnx user (or whatever one you have created during installation) permissions tu su root:
    • pw usermod vnx -G wheel
      
    • Optional: if you have installed gnome, you can add automatic login following the instructions in:
    • http://www.freebsd.org/gnome/docs/faq2.html#q23
      
    • Create a file /etc/vnx_rootfs_version to store version number and informacion about modification:
    • VER=v0.21
      OS=FreeBSD 8.2
      DESC=Basic FreeBSD 8.2 root filesystem without GUI
      
    • Create a script named /usr/local/bin/vnx_halt:
    • #!/usr/local/bin/bash
      # Delete /etc/resolv.conf
      rm -f /etc/resolv.conf
      # Clean command history
      rm -f /root/.bash_history
      # Delete VNXACE log
      rm -f /var/log/vnxaced.log
      while true; do
          # Ask for a message to save in /etc/vnx_rootfs_version file
          echo    "** Save a log message in /etc/vnx_rootfs_version file "
          echo -n "** describing the modifications done? "
          read -n 1 -p "[y/n] " answer
          echo ""
          case $answer in
              [Yy]* )
                      echo "** Log message (1 line maximum):"
                      read logmsg
                      DATE=`date`
                      echo "MODDATE=$DATE" >> /etc/vnx_rootfs_version
                      echo "MODDESC=$logmsg" >> /etc/vnx_rootfs_version
                      break;;
              [Nn]* ) break;;
              * )     echo "** Error: please answer 'y' or 'n'.";;
          esac
      done
      # Halt the system
      halt -p
      
    • Give the script execution permissions:
    • chmod +x /usr/local/bin/vnx_halt
      
    • Stop the machine with that script:
    • vnx_halt
      

If everything went well, your root filesystem will be ready to be used with VNX. You can make a simple test using the simple_freebsd.xml scenario distributed with VNX.

Note: after installing gnome, you probaly will get the following error message on the console:

acd0: FAILURE - unknown CMD (0x03) ILLEGAL REQUEST asc=0x20 ascq=0x00

To eliminate them you can execute:

hal-disable-polling --device /dev/acd0

Installing additional software

To install additional software or to modify your root file system, you just have to:

  • Start a virtual machine from it:
  • vnx --modify-rootfs vnx_rootfs_kvm_fedora.qcow2
    
  • Check network connectivity. Maybe you have to activate the network interface by hand:
  • dhclient eth1
    

    Note: use "ip link show" to know which network interface to use.

  • Do the modifications you want.
  • Finally, halt the system using:
  • vnx_halt
    

Updating VNXACED

You can automatically update the VNXACE daemon with the following command:

vnx --modify-rootfs vnx_rootfs_kvm_fedora.qcow2 --update-aced -y

Installing additional software

To install additional software or modify your root file system, you just have to start it as described above and:

  • Configure network interface with:
  • dhclient re0
    
  • Install new packages using "pkg_add -r ..." commands or using "sysinstall" utility. For example, to install apache web server:
  • pkg_add -r apache22
    
  • Stop de virtual machine with:
  • halt -p
    

Updating ACE daemon

If you have a root filesystem with the autoconfiguration and command execution daemon (ACE) already installed, you can use the autoupdate functionallity to update the daemon to a newer version. Just follow this procedure:

  • Edit the xml described above and comment the line defining the Freebsd iso file for the cdrom:
  • Start the virtual machine (directly using virsh or the vnx_modify_rootfs utility):
 /usr/share/vnx/bin/vnx_modify_rootfs rootfs_freebsd.xml 
  • Execute the update utility:
/usr/share/vnx/bin/vnx_update_aced Freebsd /usr/share/vnx/aced/vnx-aced-lf-0.1b.tgz 
  • Once the ace daemon is updated the virtual machine will be rebooted automatically.