I just (foolishly) completed the upgrade from 14.04.4 to 16.04. Apparently there's a bug due to the introduction of systemd that breaks libvirt... or I've broken aptitude. Is there a workaround or fix for this? Should I go back to 14.04?

root@KVM0:~# apt-get install libvirt-bin
Reading package 
lists... Done
Building dependency tree
Reading state information... Done
libvirt-bin is already the newest version (1.3.1-1ubuntu10).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up libvirt-bin (1.3.1-1ubuntu10) ...
Job for libvirt-bin.service failed because the control process exited with error code. See "systemctl status libvirt-bin.service" and "journalctl -xe" for details.
invoke-rc.d: initscript libvirt-bin, action "start" failed.
dpkg: error processing package libvirt-bin (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

This seems to be caused by apparmor as you will find something similar to this in your syslog:

kernel: [ 2386.130467] audit: type=1400 audit(1461767119.644:89): apparmor="DENIED" operation="create" profile="/usr/sbin/libvirtd" pid=21368 comm="libvirtd" family="netlink" sock_type="raw" protocol=0 requested_mask="create" denied_mask="create"

Until the bug is fixed, one insecure workaround is to temporarily disable apparmor for the installation:

sudo systemctl stop apparmor.service
sudo apt-get -f install
sudo systemctl start apparmor.service

Please don't uncomment this in /etc/libvirt/libvirtd.conf:

# You need to uncomment this line

Leave it as the default like:

# You need to uncomment this line

It was referred to in the official libvirt wiki: http://wiki.libvirt.org/page/The_daemon_cannot_be_started, but it doesn't help at all.

The best option is to first run:

sudo systemctl stop apparmor.service
sudo apt-get -f install
sudo systemctl start apparmor.service

Then you can try:

systemctl status libvirt-bin.service

The output of which should be something like this:

libvirt-bin.service - Virtualization daemon

Loaded: loaded (/lib/systemd/system/libvirt-bin.service; enabled; vendor prese

Active: active (running) since Fr 2016-08-19 14:02:04 EST; 43s ago
Docs: man:libvirtd(8)

Main PID: 8620 (libvirtd)
CGroup: /system.slice/libvirt-bin.service
       ├─8620 /usr/sbin/libvirtd
       ├─9013 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.
       └─9014 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.
  • I get that output but after that there is a line in red: libvirtd[1008]: End of file while reading data: Input/output error
    – paddotk
    Jul 24 '17 at 15:47

I had simillar problem with apt dist-upgrade. I fix it by stoping libvirt-bin service and killing all running libvirt processes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.