Comment 0 for bug 1308088

Revision history for this message
Tycho Andersen (tycho-s) wrote : juju status fails in kvm provider with "ERROR failed getting all instances: exit status 1"

If I try to use the kvm-based local provider, juju tells me to install uvtool, which installs libvirt-bin as a dependency. This creates the libvirtd group, which adds everyone in sudo, but doesn't take effect until a user does another login.

The TROUBLESHOOTING section at the bottom of the man page says:

"Do you have permission to connect to libvirt? On Ubuntu, you must belong to the libvirtd group. Users with sudo(8) access are added to this group by default, but users only get group membership on the next login after the libvirt-bin package has been installed. To temporarily add yourself to this group in advance of your next login, try newgrp libvirtd."

So if I bootstrap an environment but then run juju status I get:

blackbox:~ 1 juju status
ERROR failed getting all instances: exit status 1
ERROR Unable to connect to environment "".
Please check your credentials or use 'juju bootstrap' to create a new environment.

Error details:
exit status 1

blackbox:~ 1 id
uid=1000(tycho) gid=1000(tycho) groups=1000(tycho),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),110(lpadmin),111(sambashare)
blackbox:~ uvt-kvm list
error: failed to connect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied

however, after a while it starts working:

blackbox:~ id
uid=1000(tycho) gid=1000(tycho) groups=1000(tycho),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),110(lpadmin),111(sambashare)
blackbox:~ juju status
environment: local
machines:
  "0":
    agent-state: started
    agent-version: 1.18.1.1
    dns-name: localhost
    instance-id: localhost
    series: trusty
  "1":
    agent-state: started
    agent-version: 1.18.1.1
    dns-name: 10.0.3.193
    instance-id: tycho-local-machine-1
    series: precise
    hardware: arch=amd64 cpu-cores=1 mem=512M root-disk=8192M
services:
  mysql:
    charm: cs:precise/mysql-40
    exposed: false
    relations:
      cluster:
      - mysql
    units:
      mysql/0:
        agent-state: started
        agent-version: 1.18.1.1
        machine: "1"
        public-address: 10.0.3.193
blackbox:~ uvt-kvm list
error: failed to connect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied

two things: 1. can someone explain to me why this works, even though the user still isn't in the libvirtd group and uvt-kvm is still faililing? and 2. can we work whatever magic is being worked a little earlier so it never fails?