Vnx-rootfsfreebsd
How to create a KVM Freebsd root filesystem for VNX
Follow this procedure to create a KVM FreeBSD based root filesystem for VNX. The procedure has been tested with FreeBSD 10.0, 9.0, 8.2 and 7.4.
Contents
Basic installation
- Create the filesystem disk image:
qemu-img create -f qcow2 vnx_rootfs_kvm_freebsd.qcow2 8G
wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/ISO-IMAGES/9.1/FreeBSD-9.1-RELEASE-i386-disc1.iso cp FreeBSD-9.1-RELEASE-i386-disc1.iso /almacen/iso
vnx --create-rootfs vnx_rootfs_kvm_freebsd.qcow2 --install-media /almacen/iso/FreeBSD-9.1-RELEASE-i386-disc1.iso --mem 512M
ttyu0 "/usr/libexec/getty std.9600" dialup off secure
to:
ttyu0 "/usr/libexec/getty std.9600" vt100 on secure
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
IMPORTANT: in Ubuntu 13.04 the rootfs created adding this lines does not start! It hangs on bootloader consuming 100% of CPU. Seems to be a problem with the kvm/seabios versions in Ubuntu 13.04. Just skip this step to avoid the problem (you lose startup traces on serial console).
halt -p
Configuration
- Restart the system with the following command:
vnx --modify-rootfs vnx_rootfs_kvm_freebsd.qcow2 --update-aced --mem 512M
Note: ignore the errors "timeout waiting for response on VM socket".
virsh console vnx_rootfs_kvm_freebsd.qcow2
pkg install bash # for FreeBSD 10.0 pkg_add -r bash # for previous FreeBSD versions pw usermod root -s /usr/local/bin/bash pw usermod vnx -s /usr/local/bin/bash # only for FreeBSD 9.X echo "export PACKAGESITE=ftp://ftp.es.freebsd.org/pub/FreeBSD/ports/i386/packages-9-stable/Latest/" > ~/.bash_profile
pkg install perl5 p5-XML-LibXML p5-NetAddr-IP # FreeBSD 10.0 pkg_add -r perl p5-XML-LibXML p5-NetAddr-IP # previous versions
ifconfig_re0="DHCP"
mount -t msdosfs /dev/ad1 /mnt/ perl /mnt/vnxaced-lf/install_vnxaced
- Allow root login thorugh ssh by editing /etc/ssh/sshd_config file:
PermitRootLogin yes
export LANG=es_ES.UTF-8 export LC_ALL=es_ES.UTF-8
- Install packages needed:
pkg_add -r xorg-minimal gnome2-lite gdm gnome-keyring detach xeyes xhost wmctrl # Previous FreeBSD versions
gnome_enable="YES"
proc /proc procfs rw 0 0
autoboot_delay="3"
pw usermod vnx -G wheel
http://www.freebsd.org/gnome/docs/faq2.html#q23
VER=v0.25 OS=FreeBSD 9.1 DESC=Basic FreeBSD 9.1 root filesystem without GUI
vnx_halt
</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_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
dhclient re0
Note: use "ip link show" to know which network interface to use.
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
If VNXACE daemon is not updated automatically, you can do it manually by accessing the virtual machine console and type:
mount -t msdosfs /dev/ada1 /mnt/ # if virtio=no in /etc/vnx.conf mount -t msdosfs /dev/vtbd1 /mnt/ # if virtio=yes in /etc/vnx.conf perl /mnt/vnxaced-lf/install_vnxaced
Known problems
- Textual consoles hang when copy-pasting. With FreeBSD 8.2 and 9.0, the textual console works well when manually typing commands. But, for an unkonwn reason, if you paste something, they get blocked and you have to restart the viertual machine to get the console working again. This problem did not happen with FreeBSD 7.4
FreeBSD tips
- To update/upgrade FreeBSD use "freebsd-update" command. For example to upgrade from FreeBSD 9.0 to 9.1:
freebsd-update -r 9.1-RELEASE upgrade
- If you start a FreeBSD image created to use virtio drivers in a non-virtio environment (virtio=no in vnx.conf), the vm will not start and a "mountroot>" propmt will appear. In that case just type:
mountroot> ufs:/dev/ada0p2
mountroot> ufs:/dev/vtbd0p2
/dev/vtbd0p2 / ufs rw 1 1 /dev/vtbd0p3 none swap sw 0 0
/dev/ada0p2 / ufs rw 1 1 /dev/ada0p3 none swap sw 0 0