0

I used

''' sudo apt-get install qemu-kvm libvirt0 virt-manager libguestfs-tools '''

While trying to install metasploitable 2 and the surrounding functions from https://www.kalilinux.in/2020/09/metasploitable-2-installing-on-kali.html but when i typed

''' virt-manager '''

to open the virtual machine manager this is what i get

''' Unable to init server: Could not connect: Connection refused ''' ''' Unable to init server: Could not connect: Connection refused ''' ''' Unable to init server: Could not connect: Connection refused '''

''' (virt-manager:21766): Gtk-WARNING **: 23:39:47.100: cannot open display: '''

what do I need to do ?

2 Answers 2

0

virt-manager is a GUI program. It absolutely needs a compartible display device to draw its interface. The error message "cannot open display" means it can't find any display into which to draw.

You need to run virt-manager from the shell that has DISPLAY variable correctly set. Correctly, I mean, it should specify the actual working X server. When you run this from the local Linux GUI session, this variable is already set by that session manager and there will be no such problem.

If you are trying to run it from ssh session, you need to use X11 forwarding in that ssh session, so it forwards a picture to your local X server and sends control actions back to the remote application. In OpenSSH, this is achieved with -Y command line parameter (it both instantiates a data pipe within a connection and sets a environment variable in the remote session for applications to use that pipe).

Also, for this to work, you have to run actual X server locally; this means, when you connect to ssh server from e.g. Windows (using PuTTY or Windows's bundled SSH client) you aren't able to display remote GUI programs easily. You need an X server for Windows do do this. Or, you can twist and setup some VNC- or NX-based solution, like x2go to run remote Linux GUI applications from Windows.

0

Simple solution is to access the server/compute, where KVM and virt-manager are installed, using a desktop GUI.

Then, if you are using Ubuntu, either use "Application Finder" to find the "Virtual Machine Manager" or you may locate the same directly under "Applications/System Tools" in the menubar on top. You may drag and drop it on your Desktop, so you will always find it there. Double-click the icon and you will see the GUI of 'virt-manager'. If you are using other Linux flavors go may find the application using the local Finder tools.

You must log in to answer this question.