Table of Contents

Running on QEMU and KVM

This page describes the process of installing Minix 3 on QEMU and KVM. If you run into problems, see the workarounds section at the bottom of the page for possible solutions.

Preliminaries

Please install QEMU or KVM. QEMU and KVM sources can be downloaded from their websites. If you're running a Linux distribution, you can install QEMU and KVM via the package manager.

Virtual Machine Setup

Before you install Minix, you will need to create a new virtual machine configuration. The VM configuration specifies the parameters of your Virtual machine, e.g., how much memory you want the VM to use, how big you want the virtual hard disk to be, etc.

Open a terminal, change directory to where you want to create the Hard Disk Image, and write:

# qemu-img create minix.img 8G

This will create an 8 GB hard disk image named minix.img, which we will use to install the operating system.

Installation

Assuming you have downloaded and decompressed a Minix ISO image from the download page, you can mount the ISO file:

# qemu -localtime -net user -net nic -m 256 -cdrom minix.iso -hda minix.img -boot d

or

# kvm -localtime -net user -net nic -m 256 -cdrom minix.iso -hda minix.img -boot d

where minix.iso is the .iso we downloaded earlier (which is mounted as CD-ROM), minix.img is the disk image we created, and 256 is the amount of memory dedicated to the Virtual Machine. The option -boot d makes sure that we boot from the CD-ROM.

With QEMU 2.0.0 the command line shall look like this:

# qemu-system-x86_64 -localtime -net user -net nic -m 256 -cdrom minix.iso -hda minix.img -boot d

Then you can follow the normal installation instructions. If you only get a blank screen or QEMU seems stuck with the “SeaBIOS” message, try adding the -sdl parameter.

When the installation is over, type

shutdown -h now

to exit Minix.

When you get the cd>, type off in order to shutdown the Virtual Machine.

Booting MINIX 3

Now you have installed Minix 3 in the virtual machine. To boot Minix from the virtual disk image, type:

If your computer stores the system time (real time clock) in local time, e.g. Windows XP default, then:

# qemu -localtime -net user -net nic -m 256 -hda minix.img

OR

If your computer stores the system time (real time clock) in UTC, e.g. Debian GNU/Linux default, then:

# qemu -rtc base=utc -net user -net nic -m 256 -hda minix.img

Using the virtualized disk and network driver

Minix mainline contains virtualized disk and network drivers. So you have to have the latest minix built.

To use the virtualized disk driver, add a boot option to /etc/boot.cfg.local with virtio_blk=yes added to the boot parameters. Example:

menu=Start MINIX 3 latest serial virtio:load_mods /boot/minix_latest/mod*;multiboot /boot/minix_latest/kernel rootdevname=$rootdevname $args cttyline=0 virtio_blk=yes

then update /boot.cfg (by rebuilding everything, just make hdboot or just /bin/update_bootcfg), shutdown, and restart kvm with -drive file=imgfile,if=virtio for its disk image. Example:

# kvm -net nic -net user -drive file=/dev/sda,if=virtio -serial stdio -m 1300

Then boot with your new virtio boot option.

To use the virtualized network driver, minix first has to try to use it. Run netconf:

# netconf
[..]
11.   Virtio network device
[..]
Ethernet card? [..] 11

Configure network using DHCP or manually?

1. Automatically using DHCP
2. Manually

Configure method? [1] 
Backed up /etc/inet.conf to /etc/inet.conf~
Backed up /usr/etc/rc.local to /usr/etc/rc.local~

You might have to reboot for the changes to take effect.

Then shutdown, and restart kvm with the -net nic,model=virtio parameter. Example:

# kvm -net nic,model=virtio -net user -drive file=imgfile,if=virtio -serial stdio -m 1300

Post-install Configuration

You should read Post Installation for some configuration tips.

Login with SSH

Make sure you have openssh installed and running on MINIX. You can install openssh with pkgin (as detailed in the Post Installation document).

Unfortunately the -net user option doesn't allow the host system to connect to MINIX. One could use -net tap, but this is messy (especially when the host has a wireless connection) and it is generally not worth the effort for something this simple.

A simple solution is to forward the listening ssh port on MINIX to a port on the host system. This can be done by replacing the -net user option with -net user,hostfwd=tcp::10022-:22, which forwards port 22 (SSH) on MINIX to port 10022 on the host. The command to boot MINIX will then become something like this (also works with virtio):

# qemu -localtime -net user,hostfwd=tcp::10022-:22 -net nic -m 256 -hda minix.img

You can now connect to MINIX with:

$ ssh root@localhost -p10022

Workarounds

core system service died (tty) / kernel panic

A couple of users have reported a panic during the boot on Gentoo/amd64 hosts (qemu 1.5.3). This is an example of the error message:

tty           5 0x8048359 0x804868b 0x8048732 0x80490ea 0x804920b 0x804d4c8 0x804d6ce 0x804df26 0x8048196 0x80480a7 
TTY: not initializing rs232 line 0 (in use by kernel)
do_irqctl: IRQ check failed for proc 5, IRQ 3
RS232: Couldn't obtain hook for irq 3
do_irqctl: IRQ check failed for proc 5, IRQ 4
RS232: Couldn't obtain hook for irq 4
do_irqctl: IRQ check failed for proc 5, IRQ 3
RS232: Couldn't obtain hook for irq 3
do_irqctl: IRQ check failed for proc 5, IRQ 1
tty(5): panic: Couldn't set keyboard IRQ policy: -1
syslib:panic.c: stacktrace: 0x8050721 0x804b39a 0x804c9e3 0x804ff6b 0x8050039 0x805024e 0x804d9b3 0x8048196 0x80480a7 
core system service died: service 'tty'*+(slot 6, ep 5, pid 10)
rs            2 0xf1001364 0x8050f77 0x8050d34 0x8050aeb 0x8050b2f 0x804d304 0x80488c9 0x804ffef 0x8050a58 0x80493c3 0x8048196 0x80480a7 
kernel panic: cause_sig: sig manager 2 gets lethal signal 6 for itself
kernel on CPU 0: 0xf0429c6f 0xf0429723 0xf042a4c4 0xf0428ee2 0xf0429889 0xf0419d05 

The workaround is to add -cpu kvm32 to the command used to invoke qemu:

qemu-kvm -localtime -cpu kvm32 -net user,hostfwd=tcp::10022-:22 -net nic -m 256 -hda minix.img

QEMU 0.14.1

QEMU 0.14.1 is known to have issues with rebooting; it appears as if the boot menu is frozen. This problem is fixed in at least version 1.0.50, but maybe also in earlier versions.

You can compile the newest version from git on Ubuntu as follows:

$ sudo apt-get update
$ sudo apt-get install git build-essential libsdl-dev libglib2.0-0 libglib2.0-dev zlib1g-dev
$ git clone git://git.qemu.org/qemu.git qemu
$ cd qemu
$ ./configure --target-list=x86_64-softmmu --enable-sdl --enable-kvm
$ make
$ sudo make install

QEMU will be installed in /usr/local/bin/qemu-system-x86_64.

Copy and Paste between host and guest

I do not know how to directly copy and paste between the host operating system and the guest operating system, but there is a workaround: ssh. Run the following on Minix to install ssh:

# pkgin install openssh
# reboot

then start qemu with the option -net hostfwd=tcp::2022-:22 as in

qemu -rtc base=utc -net user,hostfwd=tcp::2022-:22 -net nic -m 512 -hda minix.img -no-reboot &

Now you can run, from your host,

ssh -p 2022 root@localhost

from an xterm or console and use the scrollback buffer and copy and paste.