Virt-Manager is a graphical user interface for libvirt, a popular toolset for managing virtual machines provided by KVM. Unfortunately, it does not work well on MacOS.
The MacOS port did not work for me, as I was not able to connect to the socket on the remote host even after changing adding the
socket=/var/run/libvirt/libvirt-sock parameter. The same holds for its command-line pendant
So the idea to let it natively run on Linux inside a Vagrant VM came up.
Running Virt-Manager in Vagrant
On that path, I had to overcome the following two challenges:
- to run a window manager inside the VirtualBox GUI
- copying over my SSH private key into the VM
# After digging into Vagrant’s configuration options, I found solutions for both of these issues.
- SSH agent forwarding allows to use the private key located on my Mac
- X11 forwarding allows to run graphical applications inside the VM and display them using XQuartz as a normal program window on my Mac.
I’ve put the complete
Vagrantfile on Github: StephenKing/vagrant-virt-manager.
After cloning the repository, the VM can be created using
virt-manager can be started using
SSH Host Key Verification
The only issue that remains for me is the acknowledgement of the KVM host’s SSH fingerprint. The solution instead was to once connect to the server from the command line: