An article in this context is written to discuss about an error triggered at the time virtual machine manager is being executed. An error which is triggered is already stated in the title of this article where it is “Failed to acquire pid file ‘/var/run/libvirtd.pid’ : Resource temporary unavailable”. The error itself is simply stated in the following output generated by the command execution :
libvirtd -v
Below is the output generated from the above command execution :
root@hostname:~# libvirtd -v 2017-07-25 07:59:25.064+0000: 11379: info : libvirt version: 1.3.1, package: 1ubuntu10.1 (dann frazier <[email protected]> Fri, 03 Jun 2016 14:41:21 -0600) 2017-07-25 07:59:25.064+0000: 11379: info : hostname: hostname 2017-07-25 07:59:25.064+0000: 11379: info : virObjectNew:202 : OBJECT_NEW: obj=0x55932a8f6260 classname=virAccessManagerClass 2017-07-25 07:59:25.064+0000: 11379: info : virObjectNew:202 : OBJECT_NEW: obj=0x55932a8ec6f0 classname=virAccessManagerClass 2017-07-25 07:59:25.064+0000: 11379: info : virObjectRef:296 : OBJECT_REF: obj=0x55932a8f6260 2017-07-25 07:59:25.064+0000: 11379: info : virObjectUnref:259 : OBJECT_UNREF: obj=0x55932a8f6260 2017-07-25 07:59:25.064+0000: 11379: error : virPidFileAcquirePath:422 : Failed to acquire pid file '/var/run/libvirtd.pid': Resource temporarily unavailable 2017-07-25 07:59:25.064+0000: 11379: info : virNetlinkEventServiceStopAll:556 : stopping all netlink event services
As shown in the above output display, there is an error specified in the following lines :
error : virPidFileAcquirePath:422 : Failed to acquire pid file '/var/run/libvirtd.pid': Resource temporarily unavailable
The libvirtd.pid file which is represented is actually can be found in the location. But it seems the file which is the representative of the libvirt process identifier has became obsolete and need to replaced with the new one. Below is an attempt to recreate the pid by renaming the old pid file to another name :
root@hostname:/var/run# mv libvirtd.pid libvirtd.pid.old
After renaming the file, try to restart the libvirt-bin process as shown below in order to recreate the pid file :
root@hostname:/var/run# systemctl stop libvirt-bin root@hostname:/var/run# systemctl start libvirt-bin
Actually, it went well and after restarting the service and try to start the ‘libvirtd -v’ command again, below is the output generated :
root@hostname:/var/run# libvirtd -v 2017-07-25 08:02:10.473+0000: 11784: info : libvirt version: 1.3.1, package: 1ubuntu10.1 (dann frazier <[email protected]> Fri, 03 Jun 2016 14:41:21 -0600) 2017-07-25 08:02:10.473+0000: 11784: info : hostname: hostname 2017-07-25 08:02:10.473+0000: 11784: info : virObjectNew:202 : OBJECT_NEW: obj=0x556ac78bc260 classname=virAccessManagerClass 2017-07-25 08:02:10.473+0000: 11784: info : virObjectNew:202 : OBJECT_NEW: obj=0x556ac78b26f0 classname=virAccessManagerClass 2017-07-25 08:02:10.473+0000: 11784: info : virObjectRef:296 : OBJECT_REF: obj=0x556ac78bc260 2017-07-25 08:02:10.473+0000: 11784: info : virObjectUnref:259 : OBJECT_UNREF: obj=0x556ac78bc260 2017-07-25 08:02:10.473+0000: 11784: info : virObjectNew:202 : OBJECT_NEW: obj=0x556ac78b2a80 classname=virNetServer 2017-07-25 08:02:10.473+0000: 11784: info : virObjectNew:202 : OBJECT_NEW: obj=0x556ac78b3e40 classname=virNetDaemon 2017-07-25 08:02:10.473+0000: 11784: info : virEventPollAddHandle:140 : EVENT_POLL_ADD_HANDLE: watch=1 fd=5 events=1 cb=0x7ff9a690f0c0 opaque=(nil) ff=(nil) 2017-07-25 08:02:10.473+0000: 11784: info : virObjectRef:296 : OBJECT_REF: obj=0x556ac78b2a8
And there is a new file which is actually created in the /var/run/ with the name of ‘libvirtd.pid’ as shown below :
root@hostname:/var/run# ls -al | grep libvirtd.pid -rw-r--r-- 1 root root 5 Jul 26 11:17 libvirtd.pid root@hostname:/var/run#
But as soon as the libvirt-bin service is stopped, the file will be removed or erased which is actually the correct implementation of the pid file. If the service or the process has already stopped, the pid file will be deleted. It will be re-created as soon as the libvirt-bin service is started.
Try to stop the service or the libvirt-bin daemon :
root@hostname:/var/run# systemctl status libvirt-bin
Check the status of turning off the libvirt-bin service :
root@hostname:/var/run# systemctl status libvirt-bin ● libvirt-bin.service - Virtualization daemon Loaded: loaded (/lib/systemd/system/libvirt-bin.service; enabled; vendor preset: enabled) Active: inactive (dead) since Rab 2017-07-26 11:17:22; 19s ago Docs: man:libvirtd(8) http://libvirt.org Process: 1481 ExecStart=/usr/sbin/libvirtd $libvirtd_opts (code=exited, status=0/SUCCESS) Main PID: 1481 (code=exited, status=0/SUCCESS) Tasks: 2 Memory: 12.2M CPU: 665ms CGroup: /system.slice/libvirt-bin.service ├─2461 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper └─2462 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper Jul 26 09:34:42 hostname dnsmasq[2461]: reading /etc/resolv.conf Jul 26 09:34:42 hostname dnsmasq[2461]: using nameserver 127.0.1.1#53 Jul 26 09:34:46 hostname dnsmasq[2461]: reading /etc/resolv.conf Jul 26 09:34:46 hostname dnsmasq[2461]: using nameserver 127.0.1.1#53 Jul 26 09:35:43 hostname dnsmasq[2461]: reading /etc/resolv.conf Jul 26 09:35:43 hostname dnsmasq[2461]: using nameserver 127.0.1.1#53 Jul 26 09:39:49 hostname dnsmasq[2461]: reading /etc/resolv.conf Jul 26 09:39:49 hostname dnsmasq[2461]: using nameserver 127.0.1.1#53 Jul 26 11:17:22 hostname systemd[1]: Stopping Virtualization daemon... Jul 26 11:17:22 hostname systemd[1]: Stopped Virtualization daemon.
Prove that terminating the libvirt-bin service will trigger the removal process of pid file. Check it as shown below :
root@hostname:/var/run# ls -al | grep libvirtd.pid root@hostname:/var/run#
So, a solution which can be taken when the error stated in the title of this article occur, just stop the service and try to remove the pid file. After removing the pid file, restart the libvirt-bin service.