cockpit-project / cockpit-machines

Cockpit UI for virtual machines
GNU Lesser General Public License v2.1
277 stars 72 forks source link

Failed to connect socket to '/run/user/1000/libvirt/virtnodedevd-sock': No such file or directory #1223

Open travier opened 1 year ago

travier commented 1 year ago

Explain what happens

  1. Use Cockpit client to connect to a system without cockpit but with libvirt-daemon and libvirt-dbus installed.
  2. Navigate to the "Virtual Machine" section. Wait 5 seconds while Loading resources.
  3. Section is loaded but I get the following error at the top: Failed to connect socket to '/run/user/1000/libvirt/virtnodedevd-sock': No such file or directory

The Virtual Machine section works as far as I could see. It only seem that cockpit is trying to connect to the user instance of libvirt and fails as it is not running. It looks like Cockpit is waiting for the user instance to be available before showing the system section. It should probably not wait for the user session to load and fail if the system section is ready.

Version of Cockpit

Latest Git in a Flatpak: 2838422bb po: Update from Fedora Weblate

Where is the problem in Cockpit?

Unknown or not applicable

Server operating system

Fedora

Server operating system version

Fedora Kinoite 38

What browsers are you using?

Cockpit Client / Cockpit Desktop

System log

No response

harryhritik12 commented 11 months ago

I think this will help you.

The problem is that Cockpit is trying to connect to the user instance of libvirt, but it is not running. This is because the machine you are connecting to does not have Cockpit installed, but it does have libvirt-daemon and libvirt-dbus installed.

Cockpit uses the user instance of libvirt to manage virtual machines on behalf of the current user. This is useful for users who want to create and manage their own virtual machines without having to use the root user account.

However, if Cockpit is unable to connect to the user instance of libvirt, it will fail to load the Virtual Machine section. This is why you are seeing the error message Failed to connect socket to '/run/user/1000/libvirt/virtnodedevd-sock': No such file or directory.

There are a few ways to fix this problem:

You can install Cockpit on the machine you are connecting to. This will create the user instance of libvirt and allow Cockpit to manage virtual machines on behalf of the current user. You can disable Cockpit's attempt to connect to the user instance of libvirt. You can do this by editing the Cockpit configuration file and setting the user_instance option to false. You can start the user instance of libvirt manually. You can do this by running the following command: libvirtd --daemon --user $USER Once you have fixed the problem, Cockpit should be able to load the Virtual Machine section without any errors.

It is important to note that Cockpit is designed to be used with Cockpit installed on the server. If you do not have Cockpit installed on the server, you may experience other problems. For example, you may not be able to create or manage virtual machines from the Cockpit client.

Whether Cockpit should wait for the user instance of libvirt to be available before showing the system section is a matter of debate. Some people argue that Cockpit should always wait for the user instance of libvirt to be available, even if the system section is ready. This is because the user instance of libvirt is necessary for managing virtual machines.

Others argue that Cockpit should not wait for the user instance of libvirt to be available before showing the system section. This is because the system section may be useful to users even if they are not using virtual machines.

Ultimately, the decision of whether or not to wait for the user instance of libvirt is up to the Cockpit developers.