Emulating Haiku in KVM
For Google Code-In 2019, Vrondir created a video on how to install Haiku in KVM [79 MiB].
Virtual instances of operating systems are perfect for all kinds of testing purposes that need to be done in a safe and isolated environment. Therefore, installing Haiku in a virtual machine is an ideal solution for people who do not want to install it on their physical computers but want to become familiar with it.
This guide was tested extensively in a Manjaro Linux installation, but it should work on any distribution of Linux that can run KVM.
Go to section
If you are using Ubuntu or generally more traditional Debian-based Linux distributions, you will need to run the following commands:
sudo apt-get update && sudo apt-get upgrade sudo apt-get install qemu-kvm libvirt-daemon-system libvirt-clients virt-manager
In older versions (Ubuntu 18.04, Debian Stretch or older), you will need to run these commands instead:
sudo apt-get update && sudo apt-get upgrade sudo apt-get install qemu-kvm libvirt-bin virt-manager
libvirtd at boot, enter the following command in the terminal:
sudo systemctl enable --now libvirtd
If you are using Arch Linux, you should enter the following commands in the terminal:
sudo pacman -Syu qemu virt-manager
Make sure to enable
libvirtd, which is not enabled by default:
sudo systemctl enable --now libvirtd
Once the archive with the anyboot image is downloaded and unpacked, you can start the installation.
First, create a new virtual machine.
Secondly, choose the method of OS installation, which should be
Local install media in our case. Then, click
anyboot image you have decompressed and select the operating system you are installing.
virt-manager can detect the operating system you’re attempting to install. Although virt-manager can detect the operating system you’re attempting to install under normal circumstances, it may be unable to do so. In that case, just uncheck the
Automatically detect checkbox and just type in the OS name. Then, click
You can now choose the memory and CPU settings. What you should select here, depends on the system you have. It is better to assign more than 256MiB of RAM for smooth running; too much, on the other hand, may cause a lag for the host. Once again, after choosing your desired memory size and CPU, click
You can also adjust the size of the disk image. When done, click
Name the virtual machine, verify the settings of your virtual machine, click
A popup saying
Virtual Network is not active may appear. Don’t worry, it’s just asking you to enable the
'default' network. Just click
Yes and everything should be fine. If this goes wrong, consult the Troubleshooting section.
The VM will now boot the Haiku image file. You can choose to install Haiku or boot to the desktop. Installation is simple and does not differ significantly from a physical one (follow the guides on this page if you are not familiar with the installation process).
After finishing the installation of your VM, if you run into an error that says
Unable to complete install: network default is not active or something along those lines, make sure that
libvirtd is running by entering
sudo systemctl start libvirtd in terminal.
If the error still occurs do the following steps:
sudo virsh net-list --all
- If you don’t have a defined network, the output will look like this:
Name State Autostart Persistent ----------------------------------------------------------
- If you do have a defined network, the output will look like this:
Name State Autostart Persistent ---------------------------------------------- default inactive no yes
Skip to Step 3 if your output does look like this.
Step 2. Define the
'default' network by copy-pasting the following lines into a file called
<network> <name>default</name> <uuid>9a05da11-e96b-47f3-8253-a3a482e445f5</uuid> <forward mode='nat'/> <bridge name='virbr0' stp='on' delay='0'/> <mac address='52:54:00:0a:cd:21'/> <ip address='192.168.122.1' netmask='255.255.255.0'> <dhcp> <range start='192.168.122.2' end='192.168.122.254'/> </dhcp> </ip> </network>
Run the following to add that network permanently to the KVM host:
sudo virsh net-define --file default.xml
sudo virsh net-start default
There’s a chance that you may receive the following error when you run the aforementioned command:
$ sudo virsh net-start default error: Failed to start network default error: internal error: Failed to initialize a valid firewall backend
To fix that, you will need to install
After installing the package, run the following commands to enable the service and make networking work again:
sudo systemctl enable --now firewalld sudo systemctl restart libvirtd
If you want your virtual network to start automatically in the future, run the following command:
sudo virsh net-autostart --network default
sudo virsh net-list -all should now return the following:
Name State Autostart Persistent ---------------------------------------------- default inactive yes yes