Arch Linux 2010 05 Installation in kvm guest |
To perform a net install of ArchLinux in a virtual machine called "archibald" - with 8 GB disk, bridge, sound support and virtio - to a remote host called "bareil", use the following syntax:
# vm-create -c bareil -s 8 -S -b br0 -V -u archlinux archibald
Pool install refreshed Starting install... Allocating 'archibald.img' | 8.0 GB 00:00 Creating domain... | 0 B 00:00 |
You can use the option -t to print the whole command to be passed to virt-install to standard output before executing it:
# vm-create -t -c bareil -s 8 -S -b br0 -V -u archlinux archibald
virt-install --connect=qemu+ssh://bareil/system --ram=512 --arch=i386 --vcpus=1 --video=vga --soundhw=default --description="archibald (archlinux) - vm guest on host bareil" --os-variant=virtio26 --disk vol=install/archlinux-2010.05-netinstall-i686.iso,device=cdrom --boot=cdrom,hd,network --disk pool=default,size=8 --network bridge=br0 --vnc --vnclisten=0.0.0.0 --name=archibald iso URL: ftp://ftp.osuosl.org/pub/archlinux/iso/latest/archlinux-2010.05- |
A detailled description of the vm-create script has been posted in the openSUSE forum: vm-create : create kvm virtual machines.
* Notice that the option --boot=cdrom,hd,network is not available on virt-install version prior to 5003.
There are two ways of installing Arch Linux:
We show the interactive method first
To use the virtio driver - as you might have seen in the slideshow - we had to add the following modules to /etc/mkinitcio.conf:
MODULES="virtio_blk virtio_pci virtio_net"
( for i686 systems)MODULES="virtio virtio_blk virtio_pci virtio_net"
(for x86_64 systems)To allow Grub to detect the virtio device (vda), you should switch to another console with <ALT + arrow right> BEFORE saving your changes in GRUB configuration file, log in as root and type the following commands:
# echo "(hd0) /dev/vda" > /tmp/aif/aif-dev.map |
Then switch back to the console where the setup is running with <ALT + arrow right> and save the GRUB configuration file. You'll be asked where you want to install the bootloader. Select the first /dev/vda entry (don't know why it appears twice) to intall GRUB in MBR.
When installing ArchLinux over the network in a virtual machine using the virtio driver, grub can not detect the virtual disk (vda) and fails to install. Writing the device.map before running aif -p automatic doesn't seem to help. Neither does commenting out get_grub_map in /usr/lib/aif/core/procedures. One solution I found was to overwrite worker_install_bootloader in the config file passed to aif -p automatic. IMO it's a dirty hack and should be used only on virtual machines involving the virtio driver.
The steps needed to successfully install Grub in the automatic installation procedure include:
aif -p partial-configure-network
wget http://www.unixversal.com/linux/archlinux/generic-install-on-vda
aif -p automatic -c /tmp/generic-install-on-vda
mkinitcpio -p kernel26
sed -i 's|ro$|& vga=773|;s|^root *$|root (hd0,0)|' /mnt/boot/grub/menu.lst
These steps are described in the slideshow below.