Running on QEMU and KVM
This page describes the process of installing Minix 3 on QEMU and KVM.
2. 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.
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
# 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.
Then you can follow the normal installation instructions.
When the installation is over, type
to exit Minix.
When you get the cd>, type off in order to shutdown the Virtual Machine.
4. 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
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
5. 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?  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
6. Post-install Configuration
You should read Post Installation for some configuration tips.
6.1. 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
7.1. 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.
7.2. 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.