Trying to make a VM

Following this guide here Clear Linux* OS using virt-manager — Documentation for Clear Linux* project
After installing the bundles, enabling the systemd service, rebooting the pc, I tried the usermod command. got this error

[sss_cache] [confdb_init] (0x0010): Unable to open config database [/var/lib/sss/db/config.ldb]
Could not open available domains
[sss_cache] [confdb_init] (0x0010): Unable to open config database [/var/lib/sss/db/config.ldb]
Could not open available domains

No matter, lets see what virt-manager is up to

Unable to connect to libvirt qemu:///system.

Failed to connect socket to '/var/run/libvirt/virtqemud-sock': No such file or directory

Libvirt URI is: qemu:///system

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/connection.py", line 923, in _do_open
    self._backend.open(cb, data)
  File "/usr/share/virt-manager/virtinst/connection.py", line 171, in open
    conn = libvirt.openAuth(self._open_uri,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/libvirt.py", line 147, in openAuth
    raise libvirtError('virConnectOpenAuth() failed')
libvirt.libvirtError: Failed to connect socket to '/var/run/libvirt/virtqemud-sock': No such file or directory

I honestly don’t know where to begin with this.

EDIT: looks like sssd.service is missing in clear’s sssd package sssd/sssd.spec at 10e0e929a6a95baab78bededd7b3dad3fd82c73e · clearlinux-pkgs/sssd · GitHub . it’s available in fedora’s but I’m not sure how applicable this is https://src.fedoraproject.org/rpms/sssd/blob/rawhide/f/sssd.spec

Run

sudo systemctl start libvirtd

or reboot the system.

I dont get the error on the usermod command anymore but the virt-manager issue is still there

Unable to connect to libvirt qemu:///system.

Failed to connect socket to '/var/run/libvirt/virtqemud-sock': No such file or directory

Libvirt URI is: qemu:///system

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/connection.py", line 923, in _do_open
    self._backend.open(cb, data)
  File "/usr/share/virt-manager/virtinst/connection.py", line 171, in open
    conn = libvirt.openAuth(self._open_uri,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/libvirt.py", line 147, in openAuth
    raise libvirtError('virConnectOpenAuth() failed')
libvirt.libvirtError: Failed to connect socket to '/var/run/libvirt/virtqemud-sock': No such file or directory

But, have you rebooted the system? or have you run the systemctl command?

This happens when you don’t have the daemon running because the daemon opens a socket to virt-manager and connects to it.

seems like libvirtd doesnt start after reboots even though its enabled, so here’s my process

sudo systemctls status libvirtd
○ libvirtd.service - libvirt legacy monolithic daemon
     Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; preset: disabled)
     Active: inactive (dead)
TriggeredBy: ○ libvirtd-admin.socket
             ○ libvirtd-ro.socket
             ○ libvirtd.socket
       Docs: man:libvirtd(8)
             https://libvirt.org/

i@clr~ $ sudo systemctl start libvirtd
i@clr~ $ sudo systemctl status libvirtd
● libvirtd.service - libvirt legacy monolithic daemon
     Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; preset: disabled)
     Active: active (running) since Tue 2024-06-25 17:19:01 +08; 2s ago
TriggeredBy: ● libvirtd-admin.socket
             ● libvirtd-ro.socket
             ● libvirtd.socket
       Docs: man:libvirtd(8)
             https://libvirt.org/
   Main PID: 3689 (libvirtd)
      Tasks: 20 (limit: 32768)
     Memory: 9.8M (peak: 10.4M)
        CPU: 89ms
     CGroup: /system.slice/libvirtd.service
             └─3689 /usr/sbin/libvirtd --timeout 120

Jun 25 17:19:01 clr systemd[1]: Starting libvirtd.service...
Jun 25 17:19:01 clr systemd[1]: Started libvirtd.service.

then I do a reboot to only find that the service is enabled but service isnt started

sudo systemctl start libvirtd
virt-manager

then it works,
TLDR: the service doesnt start automatically after a reboot
NOTE: sssd.service is not required for this

Could you mark my solution as solved?

Could you check the errors:
sudo journalctl -u libvirtd.service?

i@clr~ $ sudo journalctl -u libvirtd.service
Jun 24 23:43:12 clr systemd[1]: Starting libvirtd.service...
Jun 24 23:43:12 clr systemd[1]: Started libvirtd.service.
Jun 24 23:43:29 clr systemd[1]: Stopping libvirtd.service...
Jun 24 23:43:29 clr systemd[1]: libvirtd.service: Deactivated successfully.
Jun 24 23:43:29 clr systemd[1]: Stopped libvirtd.service.
-- Boot 17643901efd541108b99d50cb8e43833 --
Jun 25 17:15:28 clr systemd[1]: Starting libvirtd.service...
Jun 25 17:15:29 clr systemd[1]: Started libvirtd.service.
Jun 25 17:16:14 clr systemd[1]: Stopping libvirtd.service...
Jun 25 17:16:14 clr systemd[1]: libvirtd.service: Deactivated successfully.
Jun 25 17:16:14 clr systemd[1]: Stopped libvirtd.service.
-- Boot ee4390018d084d8e9b1d5064ddcc7c1a --
Jun 25 17:19:01 clr systemd[1]: Starting libvirtd.service...
Jun 25 17:19:01 clr systemd[1]: Started libvirtd.service.
Jun 25 17:21:01 clr systemd[1]: libvirtd.service: Deactivated successfully.

seems like it deactivates itself


I have to always start libvirtd before doing anything it deactivates way too fast lol

Could you print the output?

virsh net-dumpxml default

I’ve got my VM up and running, but here you go

i@clr~ $ virsh net-dumpxml default
error: failed to get network 'default'
error: Network not found: no network with matching name 'default'
virsh net-autostart default
i@clr~ $ virsh net-autostart default
error: failed to get network 'default'
error: Network not found: no network with matching name 'default'

Open or create :

/usr/share/libvirt/networks/default.xml

Edit :

<network>
  <name>default</name>
  <bridge name="virbr0"/>
  <forward mode="nat"/>
  <ip address="192.168.122.1" netmask="255.255.255.0">
    <dhcp>
      <range start="192.168.122.2" end="192.168.122.254"/>
    </dhcp>
  </ip>
</network>

Then :

virsh net-define /usr/share/libvirt/networks/default.xml
virsh net-start default
virsh net-autostart default