Libvirt Socket Binding Failed/Unable to Acquire PID File

Problem

  • The pf9-ostackhost service is failing, indicating that it is unable to connect to the Libvirt socket.

TRACE oslo_service.periodic_task HypervisorUnavailable: Connection to the hypervisor is broken on host: [HOST_UUID]TRACE nova.virt.libvirt.host libvirtError: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused
  • The libvirtd/libvirt-bin service is failing to start, complaining about being unable to access its pidfile.

libvirtd[404581]: libvirt version: 1.3.1, package: 1ubuntu10.24 (Marc Deslauriers [marc.deslauriers@ubuntu.com] Wed, 23 May 2018 13:29:29 -0400)libvirtd[404581]: hostname: kdt-dpckvm01libvirtd[404578]: /usr/sbin/libvirtd: error: Unable to obtain pidfile. Check /var/log/messages or run without --daemon for more info.libvirtd[404581]: Failed to acquire pid file '/var/run/libvirtd.pid': Resource temporarily unavailablesystemd[1]: libvirt-bin.service: Main process exited, code=exited, status=1/FAILUREsystemd[1]: libvirt-bin.service: Unit entered failed state.systemd[1]: libvirt-bin.service: Failed with result 'exit-code'.systemd[1]: libvirt-bin.service: Service hold-off time over, scheduling restart.

Environment

  • Platform9 Managed OpenStack – v3.6 – v4.0

  • Nova

  • Libvirt 1.3.1

  • Ubuntu 16.04

Cause

Libvirtd is configured with the '-d' (daemon) option (set in /etc/default/libvirt-bin) which makes it unmanageable from a systemctl/systemd perspective – thus, attempting to start/restart the service will cause overlapping behavior, as a process is already started.

root@kdt-dpckvm01:/var/log# ps aux | grep libvirtdroot       4085  0.2  0.0 1373036 43796 ?       Sl    2018 1582:45 /usr/sbin/libvirtd -d -l

In order for the service to be properly managed – this flag should be unset.

Resolution

  1. Kill any running Libvirt process(es).

  1. Edit /etc/default/libvirt-bin and omit the '-d' flag from 'LIBVIRT_OPTS'.

  2. Save the file.

  3. Start the Libvirt service.

Last updated