Failed to acquire pid file : /var/local/run/libvirt/qemu/driver.pid

as to the journal messages
Code:
Aug 27 19:28:39 chromarietto sudo[1670]: marietto : TTY=pts/0 ; PWD=/home/marietto ; USER=root ; COMMAND=/usr/bin/systemctl start libvirtd
is where you started it. then for some reason it stops less than 30 seconds later:
Code:
Aug 27 19:29:08 chromarietto systemd[1]: Stopping libvirtd.service - Virtualization daemon...
 


I don't know what virtqemud is used for,but from error to error I've reached some posts that talked about it. I found an error that could have been fixed only enabling qemuvirtd.

Code:
marietto@chromarietto:~$ sudo systemctl cat libvirtd.service

# /usr/local/lib/systemd/system/libvirtd.service


[Unit]

Description=Virtualization daemon

Requires=virtlogd.socket

# Use Wants instead of Requires so that users

# can disable these three .socket units to revert

# to a traditional non-activation deployment setup

Wants=libvirtd.socket

Wants=libvirtd-ro.socket

Wants=libvirtd-admin.socket

Wants=virtlockd.socket

Wants=systemd-machined.service

After=network.target

After=dbus.service

After=iscsid.service

After=apparmor.service

After=remote-fs.target

After=systemd-machined.service

After=xencommons.service

Conflicts=xendomains.service

Documentation=man:libvirtd(8)

Documentation=https://libvirt.org


[Service]

Type=notify

Environment=LIBVIRTD_ARGS="--timeout 120"

EnvironmentFile=-/usr/local/etc/default/libvirtd

ExecStart=/usr/local/sbin/libvirtd $LIBVIRTD_ARGS

ExecReload=/bin/kill -HUP $MAINPID

KillMode=process

Restart=on-failure

# Raise hard limits to match behaviour of systemd >= 240.

# During startup, daemon will set soft limit to match hard limit

# per systemd recommendations

LimitNOFILE=1024:524288

# The cgroups pids controller can limit the number of tasks started by

# the daemon, which can limit the number of domains for some hypervisors.

# A conservative default of 8 tasks per guest results in a TasksMax of

# 32k to support 4096 guests.

TasksMax=32768

# With cgroups v2 there is no devices controller anymore, we have to use

# eBPF to control access to devices.  In order to do that we create a eBPF

# hash MAP which locks memory.  The default map size for 64 devices together

# with program takes 12k per guest.  After rounding up we will get 64M to

# support 4096 guests.

LimitMEMLOCK=64M


[Install]

WantedBy=multi-user.target

Also=virtlockd.socket

Also=virtlogd.socket

Also=libvirtd.socket

Also=libvirtd-ro.socket
 
as to the journal messages
Code:
Aug 27 19:28:39 chromarietto sudo[1670]: marietto : TTY=pts/0 ; PWD=/home/marietto ; USER=root ; COMMAND=/usr/bin/systemctl start libvirtd
is where you started it. then for some reason it stops less than 30 seconds later:
Code:
Aug 27 19:29:08 chromarietto systemd[1]: Stopping libvirtd.service - Virtualization daemon...

libvirtd stops if I run qemuvirtd ; qemuvirtd stops if I launch libvirtd ; libvirtd could not run without qemuvirtd,but probably it is not like this.
 
Last edited:
libvirtd stops if I run qemuvirtd.
the messages you posted didn't show you starting virtqemud after libvirtd. this group seems to suggest it was already running. possibly since you booted:
Code:
Aug 27 19:17:21 chromarietto systemd[1]: Listening on virtqemud.socket - Libvirt qemu local socket.
Aug 27 19:17:21 chromarietto systemd[1]: Listening on virtqemud-admin.socket - Libvirt qemu admin socket.
Aug 27 19:17:21 chromarietto systemd[1]: Listening on virtqemud-ro.socket - Libvirt qemu local read-only socket.
do you know what time you booted the system?

this does seem to show that the error you are getting is from virtqemud instead of libvirtd:
Code:
Aug 27 19:29:12 chromarietto virtqemud[1756]: error from service: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Action org.libvirt.unix.manage is not registered
do you have virtqemud set to autostart? if so have you tried disabling it to see if that helps?
 
marietto@chromarietto:~$ systemctl disable virtqemud

==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-unit-files ====
Authentication is required to manage system service or unit files.
Multiple identities can be used for authentication:

1. linux
2. mario,,, (marietto)
Choose identity to authenticate as (1-2): 2
Password:
==== AUTHENTICATION COMPLETE ====
Removed "/etc/systemd/system/sockets.target.wants/virtqemud-admin.socket".
Removed "/etc/systemd/system/sockets.target.wants/virtqemud-ro.socket".
Removed "/etc/systemd/system/sockets.target.wants/virtqemud.socket".
Removed "/etc/systemd/system/multi-user.target.wants/virtqemud.service".
==== AUTHENTICATING FOR org.freedesktop.systemd1.reload-daemon ====
Authentication is required to reload the systemd state.
Multiple identities can be used for authentication:

1. linux
2. mario,,, (marietto)
Choose identity to authenticate as (1-2): 2
Password:
==== AUTHENTICATION COMPLETE ====

marietto@chromarietto:~$ systemctl status virtqemud

○ virtqemud.service - Virtualization qemu daemon
Loaded: loaded (/usr/local/lib/systemd/system/virtqemud.service; disabled; preset: enabled)
Active: inactive (dead) since Sun 2023-08-27 19:31:12 UTC; 1h 34min ago
Duration: 2min 3.966s
TriggeredBy: virtqemud.socket
virtqemud-admin.socket
virtqemud-ro.socket
Docs: man:virtqemud(8)
https://libvirt.org
Main PID: 1756 (code=exited, status=0/SUCCESS)
CPU: 125ms
marietto@chromarietto:~$ systemctl stop virtqemud

==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ====
Authentication is required to stop 'virtqemud.service'.
Multiple identities can be used for authentication:

1. linux
2. mario,,, (marietto)
Choose identity to authenticate as (1-2): 2
Password:
==== AUTHENTICATION COMPLETE ====
Warning: Stopping virtqemud.service, but it can still be activated by:
virtqemud.socket
virtqemud-admin.socket
virtqemud-ro.socket
 
these lines from your libvirtd.service file are different than the others i have looked at:
Environment=LIBVIRTD_ARGS="--timeout 120"
EnvironmentFile=-/usr/local/etc/default/libvirtd
can you check to see if you have that file? on my systems it is just /etc/default/libvirtd. the contents of my file seem to reference your first Environment line. they read:
# The default upstream behavior is for libvirtd.service to
# start on boot, perform VM autostart and shutdown again if
# nothing was started; later on, systemd socket activation
# is used to start it again when some client app connects.
#
# The following can be used to enable this behavior
#LIBVIRTD_ARGS="--timeout 120"
but from your journal messages, it doesn't look like libvirtd starts at all unless you do so manually.
 
now that virtqemud is stopped and disabled, are you able to successfully start and run libvirtd?
 
Code:
nano /usr/local/etc/libvirt/libvirtd.conf

unix_sock_group = "libvirt"
unix_sock_rw_perms = "0770"
#unix_sock_dir = "/var/local/run/libvirt"
#auth_unix_ro = "polkit"
#auth_unix_rw = "polkit"
 
marietto@chromarietto:~$ systemctl status virtqemud

○ virtqemud.service - Virtualization qemu daemon
Loaded: loaded (/usr/local/lib/systemd/system/virtqemud.service; disabled; preset: enabled)
Active: inactive (dead)
TriggeredBy: ○ virtqemud.socket
○ virtqemud-admin.socket
○ virtqemud-ro.socket
Docs: man:virtqemud(8)
https://libvirt.org

marietto@chromarietto:~$ systemctl status libvirtd

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

marietto@chromarietto:~$ systemctl start libvirtd

==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ====
Authentication is required to start 'libvirtd.service'.
Multiple identities can be used for authentication:
1. linux
2. mario,,, (marietto)
Choose identity to authenticate as (1-2): 2
Password:
==== AUTHENTICATION COMPLETE ====

marietto@chromarietto:~$ systemctl status libvirtd

libvirtd.service - Virtualization daemon
Loaded: loaded (/usr/local/lib/systemd/system/libvirtd.service; disabled; preset: enabled)
Active: active (running) since Sun 2023-08-27 21:41:09 UTC; 8s ago
TriggeredBy: libvirtd-ro.socket
libvirtd-admin.socket
libvirtd.socket
Docs: man:libvirtd(8)
https://libvirt.org
Main PID: 2457 (libvirtd)
Tasks: 19 (limit: 32768)
Memory: 27.4M
CPU: 697ms
CGroup: /system.slice/libvirtd.service
└─2457 /usr/local/sbin/libvirtd --timeout 120

marietto@chromarietto:~$ virt-manager

same error.
 
marietto@chromarietto:~$ systemctl stop libvirtd

==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ====
Authentication is required to stop 'libvirtd.service'.
Multiple identities can be used for authentication:

1. linux
2. mario,,, (marietto)
Choose identity to authenticate as (1-2): 2
Password:
==== AUTHENTICATION COMPLETE ====
Warning: Stopping libvirtd.service, but it can still be activated by:
libvirtd-ro.socket
libvirtd-admin.socket
libvirtd.socket

marietto@chromarietto:/usr/local/sbin$ libvirtd &
[1] 3096

marietto@chromarietto:/usr/local/sbin$ ps ax | grep libvirt


3096 pts/0 Sl 0:00 libvirtd
3123 pts/0 S+ 0:00 grep libvirt

marietto@chromarietto:/usr/local/sbin$ virt-manager

same error.

Isn't a method to disable PolicyKit authentication ? or even better,adding a granted permission for libvirtd.
 
Last edited:
Isn't a method to disable PoliciKit authentication ?
not that i know of. at least not for one program like i think you are asking.

i am trying to gather info, but i was just able to successfully install virt-manager with qemu and kvm in an x86_64 debian 12 xfce vm to see if that might help. i used this guide: https://kifarunix.com/install-kvm-on-debian-12/
Inside /usr/share/polkit-1/actions there are two interesting policies regarding libvirt
i have those as well:
Code:
ls -l /usr/share/polkit-1/actions/org.libvirt*
-rw-r--r-- 1 root root  34K Feb  6  2023 /usr/share/polkit-1/actions/org.libvirt.api.policy
-rw-r--r-- 1 root root 2.0K Jan 15  2021 /usr/share/polkit-1/actions/org.libvirt.unix.policy
did you have a question about them?
 
yes. let's take the more interesting one : org.libvirt.unix.policy

what happens if I change this :

<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>

to this :

<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
 
i don't think that should be necessary, but i am not well versed in policykit files. the vm i just created runs virt-manager just fine and i didn't have to adjust any files. if you want to try that anyways, i would suggest making a copy you can revert to.
 
I'm on the wrong path. I should look for this file,as suggested by the error : org.libvirt.unix.manage ; I'm not able to find it here. Do you have it ?
 
After=apparmor.service
do you know if you have apparmor installed and is the service running? you should be able to check with
Code:
apt list apparmor
Listing... Done
apparmor/stable,now 3.0.8-3 amd64 [installed,automatic]
sudo systemctl status apparmor
[sudo] password for deb12xfce: 
● apparmor.service - Load AppArmor profiles
     Loaded: loaded (/lib/systemd/system/apparmor.service; enabled; preset: enabled)
     Active: active (exited) since Sun 2023-08-27 17:22:03 CDT; 22min ago
       Docs: man:apparmor(7)
             https://gitlab.com/apparmor/apparmor/wikis/home/
    Process: 514 ExecStart=/lib/apparmor/apparmor.systemd reload (code=exited, status=0/SUCCESS)
   Main PID: 514 (code=exited, status=0/SUCCESS)
        CPU: 177ms

Aug 27 17:22:03 deb12xfce systemd[1]: Starting apparmor.service - Load AppArmor profiles...
Aug 27 17:22:03 deb12xfce apparmor.systemd[514]: Restarting AppArmor
Aug 27 17:22:03 deb12xfce apparmor.systemd[514]: Reloading AppArmor profiles
Aug 27 17:22:03 deb12xfce systemd[1]: Finished apparmor.service - Load AppArmor profiles.
one of the reasons i ask is these are the messages in the system journal i see after booting my debian 12 vm that involve libvirt:
Code:
sudo journalctl -b | grep -iE 'libvirt|virtlog|virtlock'
Aug 27 17:22:02 deb12xfce systemd[1]: Reached target virt-guest-shutdown.target - Libvirt guests shutdown.
Aug 27 17:22:03 deb12xfce audit[544]: AVC apparmor="STATUS" operation="profile_load" profile="unconfined" name="libvirtd" pid=544 comm="apparmor_parser"
Aug 27 17:22:03 deb12xfce audit[544]: AVC apparmor="STATUS" operation="profile_load" profile="unconfined" name="libvirtd//qemu_bridge_helper" pid=544 comm="apparmor_parser"
Aug 27 17:22:03 deb12xfce systemd[1]: Listening on libvirtd.socket - Libvirt local socket.
Aug 27 17:22:03 deb12xfce systemd[1]: Listening on libvirtd-admin.socket - Libvirt admin socket.
Aug 27 17:22:03 deb12xfce systemd[1]: Listening on libvirtd-ro.socket - Libvirt local read-only socket.
Aug 27 17:22:03 deb12xfce systemd[1]: Listening on virtlockd.socket - Virtual machine lock manager socket.
Aug 27 17:22:03 deb12xfce systemd[1]: Listening on virtlockd-admin.socket - Virtual machine lock manager admin socket.
Aug 27 17:22:03 deb12xfce systemd[1]: Listening on virtlogd.socket - Virtual machine log manager socket.
Aug 27 17:22:03 deb12xfce systemd[1]: Listening on virtlogd-admin.socket - Virtual machine log manager socket.
Aug 27 17:22:03 deb12xfce systemd[1]: Starting libvirt-guests.service - Suspend/Resume Running libvirt Guests...
Aug 27 17:22:03 deb12xfce systemd[1]: Starting libvirtd.service - Virtualization daemon...
Aug 27 17:22:03 deb12xfce systemd[1]: Finished libvirt-guests.service - Suspend/Resume Running libvirt Guests.
Aug 27 17:22:03 deb12xfce systemd[1]: Started libvirtd.service - Virtualization daemon.
you can see the second and third lines are about apparmor. these are all of the listed sockets:
Code:
ls -l /run/libvirt/
total 0
drwx------ 2 root root  60 Aug 27 17:22 common/
drwxr-xr-x 2 root root  40 Aug 27 17:22 hostdevmgr/
drwx------ 2 root root  40 Aug 27 17:37 interface/
srw------- 1 root root   0 Aug 27 17:22 libvirt-admin-sock=
srw-rw-rw- 1 root root   0 Aug 27 17:22 libvirt-sock=
srw-rw-rw- 1 root root   0 Aug 27 17:22 libvirt-sock-ro=
drwxr-xr-x 2 root root  60 Aug 27 17:37 lxc/
drwxr-xr-x 2 root root  80 Aug 27 17:37 network/
drwx------ 2 root root  40 Aug 27 17:37 nodedev/
drwx------ 2 root root  40 Aug 27 17:37 nwfilter/
drwx------ 2 root root  40 Aug 27 17:22 nwfilter-binding/
drwxr-xr-x 5 root root 120 Aug 27 17:37 qemu/
drwx------ 2 root root  40 Aug 27 17:37 secrets/
drwxr-xr-x 2 root root  60 Aug 27 17:37 storage/
srw------- 1 root root   0 Aug 27 17:22 virtlockd-admin-sock=
srw------- 1 root root   0 Aug 27 17:22 virtlockd-sock=
srw------- 1 root root   0 Aug 27 17:22 virtlogd-admin-sock=
srw------- 1 root root   0 Aug 27 17:22 virtlogd-sock=
 
I'm on the wrong path. I should look for this file,as suggested by the error : org.libvirt.unix.manage ; I'm not able to find it here. Do you have it ?
as far as i know that is just a section of the file
/usr/share/polkit-1/actions/org.libvirt.unix.policy:
Code:
    <action id="org.libvirt.unix.manage">
      <description>Manage local virtualized systems</description>
      <message>System policy prevents management of local virtualized systems</message>
      <defaults>
        <!-- Any program can use libvirt in read/write mode if they
             provide the root password -->
        <allow_any>auth_admin_keep</allow_any>
        <allow_inactive>auth_admin_keep</allow_inactive>
        <allow_active>auth_admin_keep</allow_active>
      </defaults>
    </action>
 
root@chromarietto:/home/marietto# systemctl status apparmor

apparmor.service - Load AppArmor profiles

Loaded: loaded (/lib/systemd/system/apparmor.service; enabled; preset: enabled)
Active: inactive (dead)
Condition: start condition failed at Sun 2023-08-27 22:16:49 UTC; 38min ago
└─ ConditionSecurity=apparmor was not met
Docs: man:apparmor(7)
unfurl="true"]https://gitlab.com/apparmor/apparmor/wikis/home/

Aug 27 22:16:49 chromarietto systemd[1]: apparmor.service - Load AppArmor profiles was skipped because of an unmet condition check
(ConditionSecurity=apparmor).

root@chromarietto:/home/marietto# sudo journalctl -b | grep -iE 'libvirt|virtlog|virtlock'
nothing.

root@chromarietto:/home/marietto# dmesg | grep apparmor
nothing.
 
when i installed virt-manager with kvm and qemu in the vm, this was the command i used:

sudo apt install virt-manager qemu-system libvirt-daemon qemu-utils

that resulted in the following packages being installed:

Code:
The following additional packages will be installed:
  dmeventd gir1.2-ayatanaappindicator3-0.1 gir1.2-gtk-vnc-2.0
  gir1.2-gtksource-4 gir1.2-libosinfo-1.0 gir1.2-libvirt-glib-1.0
  gir1.2-spiceclientglib-2.0 gir1.2-spiceclientgtk-3.0 gir1.2-vte-2.91
  gnutls-bin ibverbs-providers iptables ipxe-qemu libaio1 libcacard0
  libcapstone4 libdaxctl1 libdevmapper-event1.02.1 libexecs0 libfdt1 libfmt9
  libgfapi0 libgfrpc0 libgfxdr0 libglusterfs0 libgtk-vnc-2.0-0 libgvnc-1.0-0
  libibverbs1 libip6tc2 libiscsi7 libisoburn1 liblvm2cmd2.03 libndctl6
  libnfs13 libnss-mymachines libosinfo-1.0-0 libosinfo-l10n libphodav-3.0-0
  libphodav-3.0-common libpmem1 librados2 librbd1 librdmacm1 libslirp0
  libspice-client-glib-2.0-8 libspice-client-gtk-3.0-5 libspice-server1
  libssh-4 libtpms0 liburing2 libusbredirhost1 libusbredirparser1 libvdeplug2
  libvirglrenderer1 libvirt-clients libvirt-daemon-config-network
  libvirt-daemon-config-nwfilter libvirt-daemon-driver-lxc
  libvirt-daemon-driver-qemu libvirt-daemon-driver-vbox
  libvirt-daemon-driver-xen libvirt-daemon-system
  libvirt-daemon-system-systemd libvirt-glib-1.0-0 libvirt-glib-1.0-data
  libvirt-l10n libvirt0 libxencall1 libxendevicemodel1 libxenevtchn1
  libxenforeignmemory1 libxengnttab1 libxenhypfs1 libxenmisc4.17 libxenstore4
  libxentoolcore1 libxentoollog1 libxml2-utils lvm2 mdevctl netcat-openbsd
  osinfo-db ovmf python3-certifi python3-chardet python3-charset-normalizer
  python3-idna python3-libvirt python3-libxml2 python3-pkg-resources
  python3-requests qemu-block-extra qemu-efi-aarch64 qemu-efi-arm
  qemu-system-arm qemu-system-common qemu-system-data qemu-system-gui
  qemu-system-mips qemu-system-misc qemu-system-ppc qemu-system-sparc
  qemu-system-x86 seabios spice-client-glib-usb-acl-helper swtpm swtpm-libs
  swtpm-tools systemd-container thin-provisioning-tools virt-viewer virtinst
  xorriso
 


Follow Linux.org

Staff online

Members online


Latest posts

Top