Setting up KVM on Debian Stretch

Since a few months I have Debian 9 (“Stretch”) running on my notebook. Yesterday I wanted to install a virtual machine with Windows 7 running on it for testing some applications. So I tried to install VirtualBox through the Debian repository but I had to find out, that VirtualBox no longer is contained in the repository. So I tried to make it run by installing the .deb package provided on oracles website, but I did not make it. Because of this I decided to check out KVM. This is a virtualisation software being contained in the linux kernel and some forum entries on google claim it is as fast as VirtualBox, but on my system it took some configuration before I was able to successfully start a VM on with it.

First of all, you need to check if your System has the Intel-VT or AMD-V instruction set, because KVM will not be able to run without it. According to, this can be done the following way:

# sudo apt-get install msr-tools
# sudo modprobe msr
# sudo rdmsr 0x3a

If the result of this call is 3 or 5, the instruction set is supported. Now install the client software:

# sudo apt-get install qemu-kvm

You also should add a GUI for more comfortable configuration:

# sudo apt-get install virt-manager

When you now try to start the VM, you maybe will get following message:

failed to initialize: permission denied

As stated out on issue #1095, You solve this by restarting the KVM kernel modules:

# sudo rmmod kvm_intel
# sudo rmmod kvm
# sudo modprobe kvm
# sudo modprobe kvm_intel

Now you can create a new virtual machine and starting it using virt-manager.