> For the complete documentation index, see [llms.txt](https://platform9.com/kb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://platform9.com/kb/pmo/solution/pf9-ostackhost-service-fails-to-connect-to-libvirt.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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 following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

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.
