# pf9-ostackhost Service Fails to Connect to Libvirt

## Problem

* The host is reported **offline** in Clarity UI.
* */var/log/pf9/hostagent.log* showsthat ***pf9-ostackhost*** service has failed to start.

{% tabs %}
{% tab title="None" %}

```none
815 - pf9_app.py INFO - Setting service state pf9-ostackhost.3.5.0-3246. Command: sudo /etc/init.d/pf9-ostackhost start
```

{% endtab %}
{% endtabs %}

* */var/log/pf9/ostackhost.log* contains the message "Failed to connect socket to /var/run/libvirt/libvirt-sock".

{% tabs %}
{% tab title="None" %}

```none
310 ESC[00;36mINFO nova.service [-ESC[00;36m] ESC[00;36mStarting compute node (version 2013.2.1)322 ESC[00;36mINFO nova.virt.libvirt.driver [-ESC[00;36m] ESC[00;36mConnection event '0' reason 'Failed to connect to libvirt'783 ESC[01;31mERROR nova.virt.libvirt.host [req-e5803ac8-b08f-4d3f-a6c9-93f36f37d0e0 None NoneESC[01;31m] ESC[01;31mConnection to libvirt failed: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
```

{% endtab %}
{% endtabs %}

* */var/log/libvirt/libvirtd.log* contains the message "Unable to bind to port".

{% tabs %}
{% tab title="None" %}

```none
794+0000: 20652: info : libvirt version: 1.2.2794+0000: 20652: error : virNetSocketNewListenTCP:311 : Unable to bind to port: Address already in use
```

{% endtab %}
{% endtabs %}

* In */var/log/syslog.log,* it is observed that the ***libvirt*** service has stopped and is not able to restart.

{% tabs %}
{% tab title="None" %}

```none
kernel: [69549.764040] init: libvirt-bin main process (20652) terminated with status 6kernel: [69549.764068] init: libvirt-bin respawning too fast, stoppedkernel: [69549.766659] init: libvirt-bin post-start process (20663) terminated with status 1​
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="None" %}

```none
# service libvirt-bin status  libvirt-bin stop/waiting
```

{% endtab %}
{% endtabs %}

## Environment

* Platform9 Managed OpenStack - v3.5.0 and Higher
* Ubuntu 14.04

## Cause

A stale ***libvirt*** process is holding the lock on the service port.

## Resolution

1. Kill the stale ***libvirtd*** daemon.

{% tabs %}
{% tab title="None" %}

```none
# kill [pid]
```

{% endtab %}
{% endtabs %}

2. Start the ***libvirt-bin*** service.

{% tabs %}
{% tab title="None" %}

```none
# service libvirt-bin start
```

{% endtab %}
{% endtabs %}

3. Start the ***pf9-ostackhost*** service.

{% tabs %}
{% tab title="None" %}

```none
# service pf9-ostackhost start
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://platform9.com/kb/pmo/solution/pf9-ostackhost-service-fails-to-connect-to-libvirt.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
