juju status fails in kvm when libvirt-bin is just installed

Bug #1308088 reported by Tycho Andersen on 2014-04-15
32
This bug affects 4 people
Affects Status Importance Assigned to Milestone
juju-core
Low
Unassigned

Bug Description

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 uvt-kvm 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?

Tycho Andersen (tycho-s) on 2014-04-15
tags: added: cloud-installer
description: updated
Tycho Andersen (tycho-s) wrote :

Ah ha, turns out running juju status once with a new shell is what fixed it. So... a better error message would be nice, but at least now I understand the magic :-)

Curtis Hovey (sinzui) on 2014-04-15
tags: added: kvm local-provider status
Changed in juju-core:
status: New → Triaged
importance: Undecided → High
summary: - juju status fails in kvm provider with "ERROR failed getting all
- instances: exit status 1"
+ juju status fails in kvm when libvirt-bin is just installed
Changed in juju-core:
milestone: none → 1.19.1
John A Meinel (jameinel) on 2014-04-22
Changed in juju-core:
milestone: 1.19.1 → 1.20.0
John A Meinel (jameinel) wrote :

So your actual failure for "juju status" is because you didn't have a default environment set:
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.

The environment "" would not be an actual environment.
You would either need to run "juju switch local" or export JUJU_ENV=local, or a couple of other ways to say what your default environment is (edit environments.yaml set default: local).

The uvt-kvm list not working isn't something that we can control.

Changed in juju-core:
milestone: 1.20.0 → none
Curtis Hovey (sinzui) on 2014-10-28
Changed in juju-core:
importance: High → Medium
mahmoh (mahmoh) wrote :

Hit the same problem with 1.20.13-trusty-amd64, I tested it and forced it to work immediately by opening up /var/run/libvirt/libvirt-sock .

Changed in juju-core:
importance: Medium → High
Curtis Hovey (sinzui) on 2016-04-24
Changed in juju-core:
importance: High → Low
Changed in juju-core:
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers