You are not logged in.

#1 2012-01-15 21:49:49

Svinto
Member
Registered: 2012-01-15
Posts: 18

GUIDE: Arch install on qemu kvm x86_64 virtio virt-manager

After many trial and errors I finally managed to install Arch Linux x86_64 on QEMU using the installation script in /arch/setup.
The guest is using one VirtIO disk and was set up through virt-manager.

Since I didn't find anyone in the forum who manages to do this I thought it would be good to post a guide on how I solved it.

This is my first post so I'm sorry If I posted this in the wrong forum or made any other mistake.
Feedback is greatly appreciated.

Note
This guide only mentions details specific to install Arch Linux on QEMU.
If you're unsure of the installation procedure in general, please consult the Arch wiki (https://wiki.archlinux.org/index.php/Beginners%27_Guide).


The problems that arised
  1. VirtIO detection failure - The Arch install script doesn't detect the VirtIO Disk (/dev/vda).

  2. GRUB install failure - The Arch install script fails to install GRUB.

  3. Crashes a boot - Arch crashes at boot with the error "unable to determine major/minor number of root device" and drops to the recovery shell.

My thought about the cause to the problems

1. VirtIO detection failure
The Arch installation script detects storage media through sysfs with the integer variable /sys/block/*/device/type.
The problem is that the VirtIO disks doesn't have the "type" variable so they are not detected.
My guess is that virt-manager fails to add the "type" value for the VPS (I'm not an expert on qemu, hence I use virt-manager), but maybe this is how VirtIO works.
I solved this by manually adding /dev/sda to the finddisks function (ugly hack, I know).

  • Function "finddisks" in /usr/lib/aif/core/libs/lib-blockdevises-filesystems.sh

2. GRUB install failure
When the Arch install script tries to autodetect the configuration for GRUB it uses data that it generates and stores in the file /tmp/aif/aif-dev.map
The problem is this file is empty. I have no idea why it fails to generate data for it.
Adding data manually to the file (for example: "(hd0) /dev/vda") fails because the install script seems to regenerate the file everytime it tries to install grub. Changing file permissions to hinder it from rewriting the file didn't work either.
Because of this I choose to manually install GRUB2 instead.

  • Function "generate_grub_menulst" in /usr/lib/aif/core/libs/lib-ui-interactive.sh

  • Function "mapdev" in /usr/lib/aif/core/libs/lib-blockdevises-filesystems.sh

  • /tmp/aif/aif-dev.map

3. Crashes at boot
Arch fails to autodetect the VirtIO disks at startup.
The proper modules needs to be manually added to mkinitcio.conf.


Installation Guide

Boot up the Arch-ISO and apply my guidelines to your install configuration.

Modify Install Script
Fixes problem 1
To make sure it finds the virtio disk drive
Add one row of code (echo -ne /dev/vda "") to the beginning of function "finddisks" in file /usr/lib/aif/core/libs/lib-blockdevises-filesystems.sh.

finddisks() {
    echo -ne /dev/vda ""
    shopt -s nullglob

Install OS
Run the install script

/arch/setup

When in the "Configuration" menu, add the virtio modules to mkinitcio.conf:
Fixes problem 3

MODULES="virtio virtio_blk virtio_pci virtio_net"

NOTE: Remember to skip the installation of the bootloader. GRUB2 will be manually installed below.


Install GRUB2 (bootloader)
Fixes problem 2

Chroot

mount -o bind /dev /mnt/dev
mount -t proc /proc /mnt/proc/
mount -t sysfs /sys /mnt/sys/
modprobe dm-mod
chroot /mnt bash

If DNS doesn't work, restart the network daemon

rc.d restart network

Install GRUB2

pacman-db-upgrade
pacman -Syy
pacman -S grub2-bios

grub_bios-install --no-floppy /dev/vda
grub-mkconfig -o /boot/grub/grub.cfg
Errors

Chroot settings
If you missed something and you need to chroot from the Arch-ISO again.
Change commands according to your installation.

mount /dev/vda3 /mnt
mount /dev/vda1 /mnt/boot
mount /dev/vda4 /mnt/home
mount -o bind /dev /mnt/dev
mount -t proc /proc /mnt/proc/
mount -t sysfs /sys /mnt/sys/
modprobe dm-mod
chroot /mnt bash

GRUB2 fails to detect disk
If grub show errors when booting with uuid.
Uncomment line in /etc/default/grub:

GRUB_DISABLE_LINUX_UUID=true

Then recreate grup config

grub-mkconfig -o /boot/grub/grub.cfg

GRUB2 recovery console
GRUB2 starts but fails to boot Arch
Use grub console to boot manually, then fix grub after you've booted into the system.
Change commands according to your installation.

grub> linux (hd0,msdos1)/vmlinuz-linux root=/dev/vda3
grub> initrd (hd0,msdos1)/initramfs-linux.img
grub> boot
Sources

These sources helped me solving the problems to install Arch:
http://www.unixversal.com/linux/archlin … 01005.html
https://wiki.archlinux.org/index.php/GRUB2

Offline

#2 2012-01-15 22:03:51

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: GUIDE: Arch install on qemu kvm x86_64 virtio virt-manager

Will you put this guide in the wiki?

Offline

#3 2012-01-15 22:07:16

Svinto
Member
Registered: 2012-01-15
Posts: 18

Re: GUIDE: Arch install on qemu kvm x86_64 virtio virt-manager

I'm not sure I should do that.
If I am, I'm not sure which parts should be included.

This solution needs the user to make an ugly hack to the arch install script, something that I'm sure will be fixed in the future.
So this may only be relevant for a short time.

Feedbacks are welcome.

Last edited by Svinto (2012-01-15 22:08:15)

Offline

#4 2012-01-17 13:34:32

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,001
Website

Re: GUIDE: Arch install on qemu kvm x86_64 virtio virt-manager

there are tickets for these issues on the bugtracker, and the fixes are in git.


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#5 2012-01-20 12:41:30

Svinto
Member
Registered: 2012-01-15
Posts: 18

Re: GUIDE: Arch install on qemu kvm x86_64 virtio virt-manager

Dieter@be wrote:

there are tickets for these issues on the bugtracker, and the fixes are in git.

Thank you for the information. I will look into this.

Offline

Board footer

Powered by FluxBB