Virt-Manager can't connect to graphical console

21,637

Solution 1

In working to try to Merge the latest virt-manager 1.4.0 to Ubuntu I came across this same issue. It does not appear to be a bug in virt-manager just a change how it sends display data to VMs.

I've opened a bug to add the necessary permissions to libvirt which is where the apparmor profiles are defined - https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1668681

To fix this issue without disabling security append:

# allow connect with openGraphicsFD to work
unix (send, receive) type=stream addr=none peer=(label=/usr/sbin/libvirtd),

to the file /etc/apparmor.d/abstractions/libvirt-qemu but not in the qemu-bridge-helper section. (So right after "owner @{PROC}/0-9*/fd/ r,")

Then reload the profiles with sudo systemctl reload apparmor.

Having said all that, I always do recommend using the packages from our archive for best support.

Solution 2

In my case, it was apparmour preventing access. The apparmour magic profile generator doesn't seem to be working as it should. My workaround is as follows.

After starting the KVM instance and receiving the error, I did:

$sudo apparmour_status

which listed the profile causing the issue,

libvirt-<some long key> 

Then I set the apparmour profile to complain instead of enforce with:

$sudo aa-complain /etc/apparmor.d/libvirt/libvirt-<some long key>

Now I no longer receive the error. Hope this conflict gets fixed.

Solution 3

I could not reproduce the problem, but there were updates for libvirt on October, 5th :

libvirt-bin-1.3.1-1ubuntu10.2 was upgraded to libvirt-bin-1.3.1-1ubuntu10.3
libvirt0-1.3.1-1ubuntu10.2 was upgraded to libvirt01.3.1-1ubuntu10.3

If you did not change any settings or anything else, most probably something went wrong during the upgrade process. Completely remove all virt-manager related packages and reinstall them.

sudo apt purge libvirt-bin libvirt-glib libvirt0 virt-manager virt-viewer virtinst  
sudo apt install libvirt-bin libvirt-glib libvirt0 virt-manager virt-viewer virtinst  

Reboot the host operating system - now everything should work properly as it did before.

Share:
21,637

Related videos on Youtube

Byte Commander
Author by

Byte Commander

Ask Ubuntu moderator♦, IT student and DevOps engineer. I love Ubuntu, Python, good music and coffee, although not necessarily in that order. You can easily contact me in the Ask Ubuntu General Room most of the time, or on Discord as @ByteCommander#2800. I'd also love to invite you to my Ubuntu Hideout Discord Server btw. PS: My profile picture is derived from "Wolf Tribals" by user HaskDitex (DeviantArt.com), which is under creative Commons 3.0 License. Currently I'm using the character "Dregg Morriss" from the game "Medieval Cop" by Vasant Jahav ("Gemini Gamer"). It can be found here.

Updated on September 18, 2022

Comments

  • Byte Commander
    Byte Commander over 1 year

    Since yesterday, I can't view any running VMs (QEMU/KVM) with my virt-manager GUI any more. When I try to view the screen of a VM in its built-in viewer, I get this error message instead:

    Error connecting to graphical console:
    internal error: unable to execute QEMU command 'getfd':
    No file descriptor supplied via SCM_RIGHTS

    This applies to all of my VMs.

    I can still correctly view and interact with my VMs in virt-viewer though, only the virt-manager built-in viewer is dead.

    What is wrong here and how can I fix it?

    Edit: I just found out I am using virt-manager version 1:1.4.0-1~getdeb1 from the archive.getdeb.net repo.

    • Admin
      Admin over 7 years
      Use spice it is faster and file a bug report
    • Admin
      Admin over 7 years
      @bodhi.zazen It's already configured to use a spice display server by default, but neither that nor VNC works.
  • Byte Commander
    Byte Commander over 7 years
    There is no package libvirt-glib...
  • Byte Commander
    Byte Commander over 7 years
    And nope, purging and reinstalling the other packages didn't help. :-(
  • Byte Commander
    Byte Commander over 7 years
    Solved it, seems like a bug in the version from GetDeb I had installed. Downgrading to the official repo version fixed it (see my answer).
  • cl-netbox
    cl-netbox over 7 years
    @ByteCommander : It would have been a good idea to provide the information that you were using a 3rd party solution in your question to give me the chance making my answer more precise ! Anyway, basically you solved the problem by doing exactly what I suggested, you removed the currently installed packages and reinstalled the packages from the official repositories.
  • Byte Commander
    Byte Commander over 7 years
    You're right, but actually I didn't know it or think of that possibility. I added the GetDeb repo long time ago for another package and didn't remember getting a virt-manager update from there. v(°_°)v
  • firepol
    firepol about 7 years
    where exactly do you need to add that rule in the libvirt-qemu file ? I appended it in the end, before the final }, did reload apparmor but I get the same error. I just installed the ubuntu updates yesterday, April 20th. virt-manager 1.4.1, now for every VM I create I get this error instead of accessing Splice as for the previous VMs I created...
  • gQuigs
    gQuigs about 7 years
    edited to better explain what to do on 16.04. 16.04 has an additional qemu-bridge-helper child profile at the end of the file- you don't want to add it to that.
  • firepol
    firepol about 7 years
    Please note, no need to downgrade anymore: the answer by gQuigs explains how to configure apparmor, so that the last version of virt-manager (1.4.1 in my case) will work. I just tested gQuigs solution on my ubuntu 16.04 and it works fine.
  • paddotk
    paddotk almost 7 years
    I had to remove the current virtual machine instance and reboot my pc, but after that this worked! Thanks :)