Skip to content

Instantly share code, notes, and snippets.

@mikemccracken
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikemccracken/53c665e6094db21efc03 to your computer and use it in GitHub Desktop.
Save mikemccracken/53c665e6094db21efc03 to your computer and use it in GitHub Desktop.
libvirt errors inside utopic container
A problem with libvirt inside a container
uvtool-libvirt is failing to install inside my utopic container:
% sudo eatmydata apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet install libvirt-bin uvtool uvtool-libvirt software-properties-common openstack juju-local
Reading package lists...
Building dependency tree...
Reading state information...
software-properties-common is already the newest version.
uvtool is already the newest version.
uvtool-libvirt is already the newest version.
libvirt-bin is already the newest version.
openstack is already the newest version.
juju-local is already the newest version.
The following packages were automatically installed and are no longer required:
libfreetype6 os-prober
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 19 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up uvtool-libvirt (0~bzr92-0ubuntu2) ...
2015/01/08 09:57:30 socat[9790] E read(3, 0x1374a50, 8192): Permission denied
libvirtd does not appear to be listening on "/var/run/libvirt/libvirt-sock".
On Ubuntu, libvirtd is managed with the "libvirt-bin" upstart job.
Repair libvirtd, then reconfigure uvtool-libvirt with:
sudo apt-get -f install
dpkg: error processing package uvtool-libvirt (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
uvtool-libvirt
E: Sub-process /usr/bin/dpkg returned an error code (1)
The error message is from this line:
http://bazaar.launchpad.net/~uvtool-dev/uvtool/trunk/view/head:/debian/uvtool-libvirt.postinst#L8
That's just checking if connecting to the libvirt socket is working.
on my host system I can do that successfully:
% socat -d -d UNIX-CONNECT:/var/run/libvirt/libvirt-sock - < /dev/null
2015/01/06 14:47:10 socat[3139] N opening connection to AF=1 "/var/run/libvirt/libvirt-sock"
2015/01/06 14:47:10 socat[3139] N successfully connected from local address AF=1 "\0\0\0\0\0\0 \nUy\xEE\x7E\0\0\0\x01\0\0\0\0\0\0\x@0\vUy\xEE\x7E\0"
2015/01/06 14:47:10 socat[3139] N reading from and writing to stdio
2015/01/06 14:47:10 socat[3139] N starting data transfer loop with FDs [3,3] and [0,1]
2015/01/06 14:47:10 socat[3139] N socket 2 (fd 0) is at EOF
2015/01/06 14:47:10 socat[3139] N socket 1 (fd 3) is at EOF
2015/01/06 14:47:10 socat[3139] N socket 2 (fd 0) is at EOF
2015/01/06 14:47:10 socat[3139] N exiting with status 0
ubuntu@uoi-bootstrap:~$ groups
ubuntu adm dialout cdrom floppy sudo audio dip video plugdev netdev libvirtd
ubuntu@uoi-bootstrap:~$ socat -d -d UNIX-CONNECT:/var/run/libvirt/libvirt-sock - < /dev/null
2015/01/08 11:52:54 socat[10043] N opening connection to AF=1 "/var/run/libvirt/libvirt-sock"
2015/01/08 11:52:54 socat[10043] N successfully connected from local address AF=1 "\0\0\0\0\0\0\xA0c\x1Bm\xEE\x7E\0\0\0\x01\0\0\0\0\0\00e\x1Bm\xEE\x7E\0"
2015/01/08 11:52:54 socat[10043] N reading from and writing to stdio
2015/01/08 11:52:54 socat[10043] N starting data transfer loop with FDs [3,3] and [0,1]
2015/01/08 11:52:54 socat[10043] N socket 2 (fd 0) is at EOF
2015/01/08 11:52:54 socat[10043] E read(3, 0x1daa1d0, 8192): Permission denied
2015/01/08 11:52:54 socat[10043] N exit(1)
ubuntu@uoi-bootstrap:~$ sudo less /var/log/libvirt/libvirtd.log
WARNING: terminal is not fully functional
2015-01-08 17:52:47.954+0000: 9421: info : libvirt version: 1.2.8, package: 1.2.8-0ubuntu11.2
2015-01-08 17:52:47.954+0000: 9421: error : virPCIDeviceConfigOpen:303 : Failed to open config space file '/sys/bus/pci/devices/0000:00:00.0/config': Permission denied
2015-01-08 17:52:47.954+0000: 9421: error : virPCIDeviceConfigOpen:303 : Failed to open config space file '/sys/bus/pci/devices/0000:00:02.0/config': Permission denied
2015-01-08 17:52:47.955+0000: 9421: error : virPCIDeviceConfigOpen:303 : Failed to open config space file '/sys/bus/pci/devices/0000:00:14.0/config': Permission denied
2015-01-08 17:52:47.955+0000: 9421: error : virPCIDeviceConfigOpen:303 : Failed to open config space file '/sys/bus/pci/devices/0000:00:16.0/config': Permission denied
2015-01-08 17:52:47.955+0000: 9421: error : virPCIDeviceConfigOpen:303 : Failed to open config space file '/sys/bus/pci/devices/0000:00:16.3/config': Permission denied
2015-01-08 17:52:47.956+0000: 9421: error : virPCIDeviceConfigOpen:303 : Failed to open config space file '/sys/bus/pci/devices/0000:00:19.0/config': Permission denied
2015-01-08 17:52:47.956+0000: 9421: error : virPCIDeviceConfigOpen:303 : Failed to open config space file '/sys/bus/pci/devices/0000:00:1a.0/config': Permission denied
2015-01-08 17:52:47.957+0000: 9421: error : virPCIDeviceConfigOpen:303 : Failed to open config space file '/sys/bus/pci/devices/0000:00:1b.0/config': Permission denied
2015-01-08 17:52:47.957+0000: 9421: error : virPCIDeviceConfigOpen:303 : Failed to open config space file '/sys/bus/pci/devices/0000:00:1c.0/config': Permission denied
2015-01-08 17:52:47.957+0000: 9421: error : virPCIDeviceConfigOpen:303 : Failed to open config space file '/sys/bus/pci/devices/0000:00:1c.2/config': Permission denied
2015-01-08 17:52:47.957+0000: 9421: error : virPCIDeviceConfigOpen:303 : Failed to open config space file '/sys/bus/pci/devices/0000:02:00.0/config': Permission denied
2015-01-08 17:52:47.958+0000: 9421: error : virPCIDeviceConfigOpen:303 : Failed to open config space file '/sys/bus/pci/devices/0000:00:1d.0/config': Permission denied
2015-01-08 17:52:47.958+0000: 9421: error : virPCIDeviceConfigOpen:303 : Failed to open config space file '/sys/bus/pci/devices/0000:00:1f.0/config': Permission denied
2015-01-08 17:52:47.958+0000: 9421: error : virPCIDeviceConfigOpen:303 : Failed to open config space file '/sys/bus/pci/devices/0000:00:1f.2/config': Permission denied
2015-01-08 17:52:47.961+0000: 9421: error : virPCIDeviceConfigOpen:303 : Failed to open config space file '/sys/bus/pci/devices/0000:00:1f.3/config': Permission denied
2015-01-08 17:52:47.990+0000: 9421: error : virCommandWait:2522 : internal error: Child process (/usr/sbin/dmidecode -q -t 0,1,4,17) unexpected exit status 1: /dev/mem: Operation not permitted
2015-01-08 17:52:47.996+0000: 9421: error : virCommandWait:2522 : internal error: Child process (/usr/sbin/dmidecode -q -t 0,1,4,17) unexpected exit status 1: /dev/mem: Operation not permitted
2015-01-08 17:52:47.997+0000: 9421: error : virFileReadAll:1290 : Failed to open file '/sys/kernel/security/apparmor/profiles': Permission denied
2015-01-08 17:52:47.997+0000: 9421: error : profile_status:97 : Failed to read AppArmor profiles list '/sys/kernel/security/apparmor/profiles': Permission denied
2015-01-08 17:52:48.182+0000: 9421: error : virCommandWait:2522 : internal error: Child process (/usr/sbin/dmidecode -q -t 0,1,4,17) unexpected exit status 1: /dev/mem: Operation not permitted
2015-01-08 17:52:48.215+0000: 9421: error : virFileReadAll:1290 : Failed to open file '/sys/kernel/security/apparmor/profiles': Permission denied
2015-01-08 17:52:48.215+0000: 9421: error : profile_status:97 : Failed to read AppArmor profiles list '/sys/kernel/security/apparmor/profiles': Permission denied
2015-01-08 17:52:48.215+0000: 9421: error : virSecurityDriverLookup:80 : unsupported configuration: Security driver apparmor not enabled
2015-01-08 17:52:48.215+0000: 9421: error : virFileReadAll:1290 : Failed to open file '/sys/kernel/security/apparmor/profiles': Permission denied
2015-01-08 17:52:48.215+0000: 9421: error : profile_status:97 : Failed to read AppArmor profiles list '/sys/kernel/security/apparmor/profiles': Permission denied
2015-01-08 17:52:48.360+0000: 9396: error : virNetSocketReadWire:1527 : End of file while reading data: Input/output error
2015-01-08 17:52:48.362+0000: 9396: error : virNetSocketReadWire:1527 : End of file while reading data: Input/output error
2015-01-08 17:57:30.122+0000: 9396: error : virNetSocketReadWire:1527 : End of file while reading data: Input/output error
2015-01-08 17:57:30.124+0000: 9396: error : virNetSocketReadWire:1527 : End of file while reading data: Input/output error
The cloud-init userdata we're using attempts to set up the container for nested virtualization:
#cloud-config
write_files:
- content: |
#!/bin/sh
mkdir -p /dev/net || true
mknod /dev/kvm c 10 232
mknod /dev/net/tun c 10 200
exit 0
path: /etc/rc.local
permissions: '0755'
packages:
- libvirt-bin
- uvtool
- uvtool-libvirt
- software-properties-common
- openstack
- juju-local
groups:
- libvirtd: [ubuntu]
- sudo: [ubuntu]
apt_sources:
- source: "ppa:cloud-installer/testing"
- source: "ppa:juju/stable"
ssh_authorized_keys:
- ssh-rsa keygoeshere
package_update: true
password: ubuntu
chpasswd: { expire: False }
ssh_pwauth: True
manage_etc_hosts: localhost
# Make sure we load our modules on first creation
runcmd:
- [ sh, /etc/rc.local ]
- echo "export PATH=$PATH:/usr/sbin" >> /home/ubuntu/.bashrc
@mikemccracken
Copy link
Author

9854ubuntu@uoi-bootstrap:~$ sudo /usr/sbin/libvirtd -v
2015-01-08 20:53:15.277+0000: 10153: info : libvirt version: 1.2.8, package: 1.2.8-0ubuntu11.2
2015-01-08 20:53:15.277+0000: 10153: error : virPidFileAcquirePath:414 : Failed to acquire pid file '/var/run/libvirtd.pid': Resource temporarily unavailable
2015-01-08 20:53:15.277+0000: 10153: info : virNetlinkEventServiceStopAll:424 : stopping all netlink event services

@mikemccracken
Copy link
Author

ubuntu@uoi-bootstrap:~$ ps -ef | grep libvirt
libvirt+  9556     1  0 09:52 ?        00:00:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
root      9557  9556  0 09:52 ?        00:00:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
root      9854     1  0 10:24 ?        00:00:00 /usr/sbin/libvirtd -d
ubuntu   10155 10120  0 12:56 pts/0    00:00:00 grep libvirt

@mikemccracken
Copy link
Author

ubuntu@uoi-bootstrap:~$ groups
ubuntu adm dialout cdrom floppy sudo audio dip video plugdev netdev libvirtd
ubuntu@uoi-bootstrap:~$ virsh list
 Id    Name                           State
----------------------------------------------------

@mikemccracken
Copy link
Author

ubuntu@uoi-bootstrap:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libfreetype6 os-prober
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 19 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up uvtool-libvirt (0~bzr92-0ubuntu2) ...
2015/01/08 13:01:34 socat[10184] E read(3, 0x13b2a30, 8192): Permission denied
libvirtd does not appear to be listening on "/var/run/libvirt/libvirt-sock".
On Ubuntu, libvirtd is managed with the "libvirt-bin" upstart job.
Repair libvirtd, then reconfigure uvtool-libvirt with:
    sudo apt-get -f install
dpkg: error processing package uvtool-libvirt (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 uvtool-libvirt
E: Sub-process /usr/bin/dpkg returned an error code (1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment