You are not logged in.

#1 2021-07-01 21:15:04

paulbarbee
Member
Registered: 2010-08-20
Posts: 49

[RESOLVED] /var/run/libvirt is empty

I installed libvirtd and qemu. I did not have a /var/run/libvirt directory. I uninstalled libvirtd, qemu, qemu-arch-extra, and qemu-block-iscsi, rebooted, and reinstalled those packages. I still do not have anything in /var/run/libvirt. Originally, I did not have a libvirt directory in /var/run, so I ran mkdir libvirt.

The output of systemctl status libvirtd.service is below.

systemctl status libvirtd.service
○ libvirtd.service - Virtualization daemon
     Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: disa>
     Active: inactive (dead) since Thu 2021-07-01 16:04:33 CDT; 11min ago
TriggeredBy: ● libvirtd.socket
             ● libvirtd-admin.socket
             ● libvirtd-ro.socket
       Docs: man:libvirtd(8)
             https://libvirt.org
    Process: 2267 ExecStart=/usr/bin/libvirtd $LIBVIRTD_ARGS (code=exited, status=0/SUCCESS)
   Main PID: 2267 (code=exited, status=0/SUCCESS)
        CPU: 102ms

Jul 01 16:02:33 paul-linux2 systemd[1]: Started Virtualization daemon.
Jul 01 16:04:33 paul-linux2 systemd[1]: libvirtd.service: Deactivated successfully.

Any help would be appreciated. Thank you in advance!

Last edited by paulbarbee (2021-07-06 00:46:39)

Offline

#2 2021-07-02 08:13:24

loqs
Member
Registered: 2014-03-06
Posts: 19,015

Re: [RESOLVED] /var/run/libvirt is empty

You have not explained why the directory not existing / being empty is an issue.

Offline

#3 2021-07-02 21:38:52

paulbarbee
Member
Registered: 2010-08-20
Posts: 49

Re: [RESOLVED] /var/run/libvirt is empty

I apologize. I suppose that was obvious to me. The directory being empty is an issue because libvirt-sock is supposed to be in that directory. According to https://wiki.archlinux.org/title/libvirt, I should test if libvirt is running on a system level, so I ran

virsh -c qemu:///system

That gave me the following output

setlocale: No such file or directory
error: failed to connect to the hypervisor
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory

Basically, libvirtd is not running correctly, so I cannot crate any virtual machines.

Offline

#4 2021-07-03 03:01:04

paulbarbee
Member
Registered: 2010-08-20
Posts: 49

Re: [RESOLVED] /var/run/libvirt is empty

I ran

touch /var/run/libvirt/libvirt-sock

and rebooted. Now I'm getting the following output when I run

sudo virsh -c qemu:///system
sudo virsh -c qemu:///system
[sudo] password for paul: 
error: failed to connect to the hypervisor
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused

When I run the command as a normal user I get a permission denied error as the last line. the regular user is a member of the following groups: libvirt kvm wheel paul mykvm.

Offline

#5 2021-07-06 00:44:42

paulbarbee
Member
Registered: 2010-08-20
Posts: 49

Re: [RESOLVED] /var/run/libvirt is empty

I have managed to solve the issue. Earlier, I had moved /var to another drive. As part of resolving that issue, some program had complained about /var/run and /var/lock, so I had created those directories. Looking at the files for an earlier installation, /var/run and /var/lock are supposed to be simlinks to /run and /run/lock, respectively. Ultimately,  I rebooted into an Arch live installation and issued the following commands:

mount /dev/nvme0n1p5 /mnt
mount /dev/nvme0n1p2 /mnt/boot
mount /dev/sda3 /mnt/mnt/sda3
mount --bind /mnt/mnt/sda3/var /mnt/var

I also had /home and /tmp on the same drive, so I mounted them with bind.

mount --bind /mnt/mnt/sda3/home /mnt/home
mount --bind /mnt/mnt/sda3/tmp /mnt/tmp

The I did a chroot and  created the proper links.

arch-chroot /mnt
cd /var
ln -s /run run
ln -s /run/lock lock
ls -lah

the ls showed that everything pointed to the correct place, I cd'ed to /var/run and /var/run/lock and made sure that there were files in those directories. After that, I exited the chroot, rebooted and made sure the boot went smoothly.

virsh -c qemu:///system

now brings up the virsh prompt and everything appears to be running correctly.

Thank you to everyone who looked at this issue!

Last edited by paulbarbee (2021-07-06 00:46:06)

Offline

Board footer

Powered by FluxBB