I recently installed Kvm on my Debian server to have a play with Qemu Virtual Machines. We have this set up at work so i’m pretty familiar with the system.
However, after installing kvm, qemu, vnc4server and vnc4viewer to access my server, when I tried to run virt-manager one of two things happened.
1. As a normal user I had no privileges to create or manage VM’s
2. As root or sudo user virt-manager wouldn’t even launch from the terminal, just gave me a whole string of Gtk error messages.
virt-manager ERROR:root:Unable to initialize GTK: could not open display
So, methinks, A: I need root/sudo privileges, BUT! you NEVER, EVER run graphical apps as root, it’s a no-no.
That’s where I found the solution. To run graphical apps as root/sudo you use GKSU not SU
sudo apt-get install gksu
sudo vim /usr/bin/virt-manager
Then in between exec and python, just add a gksudo like this:
exec gksudo python “/usr/share/virt-manager/virt-manager.py” “$@”
Now when I run virt-manager as a normal user, everything is fine.