= Notes from Upgrading to Ubuntu 12.04 from 10.04 = == The new VMs == Upgraded the VM instance by swapping in an Ubuntu 10.04 image (the pre-upgrade version) and installing a new 12.04 i386 install. Special things I did: * Used a hardware type that supports virtualization - {{{pc2133}}} * Used tb-allow-external to allow the Ubuntu install to proceed. It expects external connectivity. * I added the Ubunutu 10.04 image to the list of images allowed to access external hosts temporarily to do this * The image file itself was created using {{{ $ qemu-img create -f qcow2 /tmp/pangolin.img 10G }}} To do the install on an X window I needed to log into the DETER node hosting qemu using {{{ $ ssh -Y pc055 }}} Once I had a bootable image, I booted it, logged in, and changed {{{/etc/apt/sources.list}}} to point to scratch instead of the various ubuntu and cannonical sources. After the substitutions there were 2 duplicates that I commented out. It's important to make the configuration user something that won't need to be overwritten by experiments. I used {{{toor}}}, well after I remembereed this. The default {{{/etc/resolve.conf}}} doesn't resolve scratch, so I copied one from the host on which QEMU was running. This file was originally a symlink to a version updated by the DHCP subsystem. The symlink must be severed for the needed changes to stick. Added an {{{admin}}} group and modified {{{/etc/sudoers}}} to allow that group to sudo without a password. The container system populates that group. After this {{{sudo apt-get update}}} succeeds. Ubuntu doesn't enable sshd by default. Be sure to: {{{ $ apt-get install openssh-server }}} Shut down the VM and store the image on scratch {{{ $ scp pangolin.img scratch:/var/www/benito }}} == QEMU software == The default Ubuntu QEMU install does not support VDE, which is clearly a problem. This is easy enough to fix using the instructions for [http://www.debian-administration.org/articles/20 rebuilding a debian package] * apt-get the source for {{{qemu-kvm}}} and the supporting tools * modify {{{debian/rules}}} to include {{{--enable-vde}}} in the configure call * use debuild as above to make a new .deb Move the debs - more than one gets created - into {{{/share/benito/packages/hv:qemu_packages}}} and adjust {{{/share/benito/etc/hv:qemu_packages}}} accordingly There were custom debs for vde as well, but they are commented as fixing an overflow in i386. This install is for amd64 so we'll try the stock vde packages. The sources are in {{{~mikeryan/dev/benito/vde}}} but the changes were not completely clear. = Compressing The Image = After getting everything installed on the image, it gets to be sizeable. The qcow2 image was 3.8 GB. To reduce this, convert the image to a raw disk image {{{ $ qemu-img convert -p -O raw pangolin.img pangolin.raw.img }}} Now we need to run {{{zerofree}}} to clear out the dirty sectors. (zerofree is in the repo) I fooled around quite a bit with trying to boot a qemu instance from the qcow2 image and mount the raw image for zerofreeing. This failed in many ways. Attaching both disks always mounts the raw image and corrupts the qcow2. You can make teh qcow2 image a disk and boot from it, with the raw image on a USB disk, but the zerofree is too slow. Ultimately the easy way to do this was to mount the raw image through the loopback, using the mechanism [http://askubuntu.com/questions/69363/mount-disk-device-image here]. Basically: {{{ $ fdisk -lu pangolin.raw.img Disk pangolin.raw.img: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders, total 20971520 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0000b82d Device Boot Start End Blocks Id System pangolin.raw.img1 * 2048 18874367 9436160 83 Linux pangolin.raw.img2 18876414 20969471 1046529 5 Extended pangolin.raw.img5 18876416 20969471 1046528 82 Linux swap / Solaris $ dc 512 2048 * p 1048576 # (sector size * start of partition) $ sudo losetup -o 1048576 /dev/loop0 pangolin.raw.img $ sudo mount /dev/loop0 /mnt $ sudo zerofree -v /dev/loop0 247417/1655938/2359040 $ sudo losetup -d /dev/loop0 # Don't forget -c for compression $ qemu-img convert -p -c -O qcow2 pangolin.raw.img pangolin-dev.img }}} The resulting image is roughly 1.1 GB. A considerable savings, but a false one. Running qemu from a compressed image is CPU intensive. I uncompressed the compressed image (and the trip through the comporessor did help) to get a 2.8 GB image that runs without undue CPU load. = Plan 9 FS = The plan 9 server (npfs) comes from [http://sourceforge.net/projects/npfs/ here.] = Making DEBs for ViewOS = The 0.6 view-os debs behvae badly on 12.04. Processes get stopped and other badness, so we build from source, starting from http://wiki.virtualsquare.org/wiki/index.php/Getting_started#Installing_Virtual_Square_Tools and making debs. The build works directly and the SIGSTOPs go away, but we'd like DEBs to install. Working from http://www.debian.org/doc/manuals/maint-guide/ and banging my head I did the following: == Making the VDE2 deb == Check the source out of SVN and tar up the {{{vde-2}} directory {{{ $ svn co https://vde.svn.sourceforge.net/svnroot/vde/trunk vde $ cd vde $ tar czf ~/vde-2.tar.gz vde-2 $ cp ~/vde-2.tar.gz /tmp $ cd /tmp }}} Untar the vde directory and run {{{dh-make}}} {{{ $ tar xzf vde-2.tar.gz $ cd vde-2 $ dh_make -f ../vde-2.tar.gz -p vde2_20120806 }}} The {{{-p}}} sets the name of the deb. The debian directory needs some tweaks. The [attachment:control control], [attachment:copyright copyright] and [attachment:rules rules] are attached. Rules is most interesting in that it is functional. The key part is: {{{ build: autoreconf --install ./configure --prefix=/usr make %: dh $@ }}} The {{{build}}} rule includes the build instructions from the !VirtualSquare installation pages, with the prefix given. That's what debian uses, and {{{libtool}}} will snarl the install process without it. Once it his in in place {{{ $ debuild -uc -us }}} from {{{/tmp/vde-2}}} will build the deb (in {{{/tmp}}}). {{debuild}}} runs {{{lintian}}} which complains about .la files with embedded paths. This is resolved by the install process. == !ViewOs debs == The process above - including the verbatim {{{rules}}} file will work fog veiw-os, as long as each sub dir of interest is deb-ified seperately. Source is at https://view-os.svn.sourceforge.net/svnroot/view-os/trunk I did {{{lwipv6}}}, {{{purelibc}}}, and {{{xmviewos}}}. The {{{xmviewos}}} has patchs attached (following the rules at http://www.debian.org/doc/manuals/maint-guide/modify.en.html ) to defines {{{NOUMBINWRAP}}} in {{{xmview/um_exec.c}}}, to move a memory allocation so that it does not interfere with thread creation, and to tuen on IP forwarding in the lwip stacks. These patches are: * [attachment:fix-capture_nested.patch calloc patch] * [attachment:fix-forwarding.patch IP forwarding patch] * [attachment:fix-um_exec.patch interpreter patch] When building the {{{xmviewos}}} deb, make sure that the others have been installed. Without them key modules will not be built and included.