|
|
(19 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
− | {{Title|How to create a Ubuntu root-file-system for VNX}}
| |
| | | |
− | == Basic installation ==
| |
− |
| |
− | Follow this procedure to create a Ubuntu based root-file-system for VNX. The procedure has been tested with Ubuntu 9.10, 10.04, 10.10, 11.04 and 12.04.
| |
− | <ul>
| |
− | <li>Create the filesystem disk image:</li>
| |
− | qemu-img create -f qcow2 vnx_rootfs_kvm_ubuntu.qcow2 8GB
| |
− | <li>Get Ubuntu installation CD. For example:</li>
| |
− | wget ftp://ftp.rediris.es/mirror/ubuntu-releases/12.04/ubuntu-12.04-server-i386.iso
| |
− | cp ubuntu-12.04-server-i386.iso /almacen/iso
| |
− | Note: use 'server' or 'desktop' CD versions depending on the system you want to create.
| |
− | <li>Create the virtual machine with:</li>
| |
− | vnx --create-rootfs vnx_rootfs_kvm_ubuntu.qcow2 --install-media /almacen/iso/ubuntu-12.04-server-i386.iso --mem 512M
| |
− | <li>Follow Ubuntu installation menus to install a basic system with ssh server. Once the installation is finished, stop the machine and edit rootfs_ubuntu.xml file and comment the following line in cdrom disk specification:</li>
| |
− | <pre>
| |
− | <!--source file='/almacen/iso/ubuntu-10.04-server-i386.iso'/-->
| |
− | </pre>
| |
− | </ul>
| |
− |
| |
− | == Configuration ==
| |
− |
| |
− | <ul>
| |
− | <li>Start the virtual machine again and finish the installation:</li>
| |
− | <ul>
| |
− | <li>Access the console and sudo root: </li>
| |
− | sudo su
| |
− | <li>Update the system</li>
| |
− | apt-get update
| |
− | apt-get dist-upgrade
| |
− | <li>Install XML::DOM perl package and ACPI daemon:</li>
| |
− | apt-get install libxml-dom-perl acpid
| |
− | <li>Only for Ubuntu 10.04:</li>
| |
− | <ul>
| |
− | <li>create /media/cdrom* directories:</li>
| |
− | mkdir /media/cdrom0
| |
− | mkdir /media/cdrom1
| |
− | ln -s /media/cdrom0 /media/cdrom
| |
− | ln -s /cdrom /media/cdrom
| |
− | <li>add the following lines to /etc/fstab:</li>
| |
− | /dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
| |
− | /dev/scd1 /media/cdrom1 udf,iso9660 user,noauto,exec,utf8 0 0
| |
− | </ul>
| |
− | <li>Configure a serial console on ttyS0:</li>
| |
− | cd /etc/init
| |
− | cp tty1.conf ttyS0.conf
| |
− | sed -i -e 's/tty1/ttyS0/' ttyS0.conf
| |
− | <li>Activate startup traces on serial console by editting /etc/default/grub file and setting the GRUB_CMDLINE_LINUX_DEFAULT variable to "console=ttyS0". Also change the boot menu timeout to 0 (sometimes virtual machines get stopped on the boot menu when starting on high loaded systems):</li>
| |
− | GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0"
| |
− | GRUB_TIMEOUT=0
| |
− | <li>Make grub process the previous changes:</li>
| |
− | update-grub
| |
− | <li>Install VNX autoconfiguration daemon:</li>
| |
− | <ul>
| |
− | <li>From the host execute:</li>
| |
− | /usr/share/vnx/bin/vnx_update_aced Ubuntu /usr/share/vnx/aced/vnx-aced-lf-0.1b.tgz
| |
− | <li>From the virtual machine console:</li>
| |
− | mount /media/cdrom
| |
− | /media/cdrom/install_vnxdaemon
| |
− | </ul>
| |
− | <li>Optional: install graphical user interface.</li>
| |
− | <ul>
| |
− | <li>Minimal:</li>
| |
− | sudo apt-get install xorg gnome-core gksu gdm gnome-system-tools gnome-nettool firefox-gnome-support
| |
− | <li>Complete:</li>
| |
− | sudo apt-get install ubuntu-desktop
| |
− | </ul>
| |
− | <li>Optional: install other services:</li>
| |
− | <ul>
| |
− | <li>Apache server:</li>
| |
− | sudo apt-get install apache2
| |
− | update-rc.d -f apache2 remove # to avoid automatic start
| |
− | <li>Other network tools</li>
| |
− | sudo apt-get install traceroute
| |
− | </ul>
| |
− |
| |
− | <!--li>Edit the "message of the day" file (/etc/motd) and add the following message:</li>
| |
− | <pre>
| |
− | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
− | ~~~~~ WARNING! ~~~~~
| |
− | ~~~~~ VNX Autoconfiguration in progress... ~~~~~
| |
− | ~~~~~ Wait until the virtual machine reboots ~~~~~
| |
− | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
− | </pre-->
| |
− |
| |
− | <li>Create a file /etc/vnx_rootfs_version to store version number and informacion about modification:</li>
| |
− | <pre>
| |
− | VER=v0.21
| |
− | OS=Ubuntu 10.10
| |
− | DESC=basic Ubuntu 10.10 root-file-system without GUI
| |
− | </pre>
| |
− |
| |
− | <li>Create a script named /usr/local/bin/vnx_halt:</li>
| |
− | <pre>
| |
− | #!/bin/bash
| |
− | # Clean apt cache
| |
− | apt-get clean
| |
− | apt-get -y autoremove
| |
− | # Delete /etc/resolv.conf
| |
− | rm -f /etc/resolv.conf
| |
− | # Clean command history
| |
− | rm -f /root/.bash_history
| |
− | # Delete udev net rules files:
| |
− | rm -f /etc/udev/rules.d/70-persistent-net.rules
| |
− | # 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
| |
− | </pre>
| |
− |
| |
− | <li>Give the script execution permissions:</li>
| |
− | chmod +x /usr/local/bin/vnx_halt
| |
− |
| |
− | <li>Stop the machine with that script:</li>
| |
− | vnx_halt
| |
− | </ul>
| |
− | </ul>
| |
− |
| |
− | If everything went well, your root filesystem will be ready to be used with VNX. You can make a simple test using the simple_ubuntu.xml scenario distributed with VNX.
| |
− |
| |
− | === Installing additional software ===
| |
− |
| |
− | To install additional software or modify your root file system, you just have to start it as described above and make the operations required on the filesystem.
| |
− | <ul>
| |
− | <li>Start a VM with the root filesystem using virsh:</li>
| |
− | virsh create rootfs_ubuntu.xml
| |
− | virt-viewer Ubuntu
| |
− | <li>Or alternatively using vnx_modify_rootfs:</li>
| |
− | vnx_modify_rootfs /usr/share/vnx/filesystems/vnx_rootfs_kvm_ubuntu-base.qcow2
| |
− | <li>From inside the VM install the software desired:</li>
| |
− | apt-get install ...
| |
− | <li>Stop the machine with:</li>
| |
− | vnx_halt
| |
− | </ul>
| |
− |
| |
− | ==== Examples ====
| |
− |
| |
− | <ul>
| |
− | <li>dhcp server and relay:</li>
| |
− | <ul>
| |
− | <li>Install dhcp3 packages:</li>
| |
− | apt-get install dhcp3-server dhcp3-relay
| |
− | <li>Disable autostart (optional):</li>
| |
− | update-rc.d -f isc-dhcp-server remove
| |
− | update-rc.d -f isc-dhcp-relay remove
| |
− | </ul>
| |
− |
| |
− |
| |
− | </ul>
| |
− |
| |
− | === 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:
| |
− |
| |
− | <ul>
| |
− | <li>Edit the xml described above and comment the line defining the Ubuntu iso file for the cdrom:</li>
| |
− | <!--source file='/almacen/iso/ubuntu-10.04-server-i386.iso'/-->
| |
− | <li>Start the virtual machine (directly using virsh or the vnx_modify_rootfs utility):</li>
| |
− | /usr/share/vnx/bin/vnx_modify_rootfs rootfs_ubuntu.xml
| |
− | <li>Execute the update utility:</li>
| |
− | /usr/share/vnx/bin/vnx_update_aced Ubuntu /usr/share/vnx/aced/vnx-aced-lf-0.1b.tgz
| |
− | <li>Once the ace daemon is updated the virtual machine will be rebooted automatically.</li>
| |
− | </ul>
| |
− |
| |
− | === Known problems ===
| |
− |
| |
− | <ul>
| |
− | <li>Each time a cdrom is mounted (for example, whenever a command is executed on the virtual machine) the following error appears in the console:</li>
| |
− | <pre>
| |
− | Jul 27 22:33:31 vnx kernel: [ 4384.875886] ata1.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6
| |
− | Jul 27 22:33:31 vnx kernel: [ 4385.291374] ata1.01: BMDMA stat 0x5
| |
− | Jul 27 22:33:31 vnx kernel: [ 4385.493411] sr 0:0:1:0: [sr0] CDB: Read(10): 28 00 00 00 00 18 00 00 01 00
| |
− | Jul 27 22:33:31 vnx kernel: [ 4385.493460] ata1.01: cmd a0/01:00:00:00:08/00:00:00:00:00/b0 tag 0 dma 2048 in
| |
− | Jul 27 22:33:31 vnx kernel: [ 4385.493461] res 01/60:00:00:00:08/00:00:00:00:00/b0 Emask 0x3 (HSM violation)
| |
− | Jul 27 22:33:31 vnx kernel: [ 4386.263553] ata1.01: status: { ERR }
| |
− | </pre>
| |
− | Despite of the error trace, the commands are executed correctly. This error does not appear on Ubuntu 9.10 filesystems.
| |
− |
| |
− | </ul>
| |