Cockpit: Machines: Does not show system libvirt VM

Created on 20 Sep 2018  ·  12Comments  ·  Source: cockpit-project/cockpit

With the update to 178 on Fedora 28, libvirt-dbus is now a dependency and being used. Now cockpit machines shows "No VM is running or defined on this host".

I do have a system machine:

❱❱❱ sudo virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     sid                            shut off

In the JS log, I see

ListStoragePools failed: {"problem":null,"name":"org.freedesktop.DBus.Error.UnknownMethod","message":"Introspection data for method org.libvirt.Connect ListStoragePools not available"} machines.js:47226:28
GET_STORAGE_POOLS/</<
http://localhost:9090/cockpit/$30a4cc6cad94caf555d925f35af303248e150960275337285facbf57fb25993b/machines/machines.js:47226:28
T
http://localhost:9090/cockpit/$30a4cc6cad94caf555d925f35af303248e150960275337285facbf57fb25993b/base1/cockpit.js:879:31
D/<
http://localhost:9090/cockpit/$30a4cc6cad94caf555d925f35af303248e150960275337285facbf57fb25993b/base1/cockpit.js:891:17
j
http://localhost:9090/cockpit/$30a4cc6cad94caf555d925f35af303248e150960275337285facbf57fb25993b/base1/cockpit.js:808:17
GetDomainCapabilities failed: Introspection data for method org.libvirt.Connect GetDomainCapabilities not available machines.js:47203:28
GET_HYPERVISOR_MAX_VCPU/</<
http://localhost:9090/cockpit/$30a4cc6cad94caf555d925f35af303248e150960275337285facbf57fb25993b/machines/machines.js:47203:28
T
http://localhost:9090/cockpit/$30a4cc6cad94caf555d925f35af303248e150960275337285facbf57fb25993b/base1/cockpit.js:879:31
D/<
http://localhost:9090/cockpit/$30a4cc6cad94caf555d925f35af303248e150960275337285facbf57fb25993b/base1/cockpit.js:891:17

libvirt-dbus-1.2.0-1.fc28.x86_64

Most helpful comment

Hopefully this is the right place to report, but having this issue on Ubuntu 19.04, cockpit 189.
Same issue, when connected as superuser and I first set up a VM, it will say it is 'In Transition", and then disappear if I refresh the browser. However, as soon as I uninstall libvirt-dbus, the problem is gone.
Happy to resubmit somewhere else if this is the wrong place, and to provide any logs.

All 12 comments

The processes do get activated:

❱❱❱ pgrep -af libvirt-dbus
8210 /usr/bin/libvirt-dbus --system
8212 /usr/bin/libvirt-dbus --session

@KKoukiou 's theory is that this is due to my user not being in the libvirt group, so that I can't use system virsh without further authentication:

❱❱❱ virsh -c qemu:///system list --all
==== AUTHENTICATING FOR org.libvirt.unix.manage ====
System policy prevents management of local virtualized systems
Authenticating as: Martin Pitt (martin)
Password: 

❱❱❱ id
uid=1000(martin) gid=1000(martin) groups=1000(martin),10(wheel),18(dialout),135(mock),989(ecryptfs)

With the virsh backend I didn't need to be in the libvirt group, as that uses superuser: try. I'd suggest to do the same for the D-Bus interface for the system one?

Sorry, the virsh backend doesn't actually use superuser: try. virsh uses polkit (as seen in my screen dump above), and Cockpit provides a polkit agent (for admin users). So apparently libvirt-dbus doesn't use polkit? Or the polkit authentication is broken somewhere between libvirt-dbus and cockpit?

I verified that this helps:

--- a/pkg/machines/libvirt-dbus.es6
+++ b/pkg/machines/libvirt-dbus.es6
@@ -852,7 +852,7 @@ function startEventMonitor(dispatch, connectionName, libvirtServiceName) {
  */
 function dbus_client(connectionName) {
     if (!(connectionName in clientLibvirt) || clientLibvirt[connectionName] === null)
-        clientLibvirt[connectionName] = cockpit.dbus("org.libvirt", { bus: connectionName });
+        clientLibvirt[connectionName] = cockpit.dbus("org.libvirt", { bus: connectionName, superuser: (connectionName === 'system') ? 'try' : 'no' });

     return clientLibvirt[connectionName];
 }

In retrospect, this test hack should have alerted me about this problem on PR review, but I didn't catch that. :crying_cat_face: This should be dropped again, the above patch should take care of it.

@martinpitt ah now I see what you meant. I am assigning this issue to me, thanks for catching it!

Is there any workaround for this atm or do I have to wait for the next release to become available?

@monreal: 179 was released today with this fix. If you can help testing it in Fedora (https://bodhi.fedoraproject.org/updates/?packages=cockpit) or from Debian unstable, that would be best.

If that's not possible for some reason, you can temporarily uninstall libvirt-dbus.

@monreal: 179 was released today with this fix. If you can help testing it in Fedora

Running F28 Server, the testing packages work fine, thanks!

Hopefully this is the right place to report, but having this issue on Ubuntu 19.04, cockpit 189.
Same issue, when connected as superuser and I first set up a VM, it will say it is 'In Transition", and then disappear if I refresh the browser. However, as soon as I uninstall libvirt-dbus, the problem is gone.
Happy to resubmit somewhere else if this is the wrong place, and to provide any logs.

@martinpitt I'm running Ubuntu 20.04 and removing libvirt-dbus has resolved this exact issue. Package removed (it had no dependencies or dependents) and Cockpit UI now shows the VMs as expected.

I note you said you can remove the package temporarily, though. What are the implications of leaving it removed permanently?

Edit: The Storage Pools and Networks tabs aren't visible without libvirt-dbus installed.

For those searching for a solution to the issue reported by @ejbolt and @digitalformula, see https://github.com/cockpit-project/cockpit/issues/13343#issuecomment-570611574

For those searching for a solution to the issue reported by @ejbolt and @digitalformula, see #13343 (comment)

Confirmed, this does fix that particular issue. Thanks @mxbi !

Now just need to figure out permissions so I can actually use KVM on Ubuntu (it's easy on CentOS).

Was this page helpful?
0 / 5 - 0 ratings