Cannot destroy lxc env on trusty with juju-core 1.17.4-0ubuntu2

Bug #1296739 reported by Liam Young
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
juju-core
Fix Released
Critical
Andrew Wilkins

Bug Description

Destroying an lxc env no longer works for me on trusty with juju-core 1.17.4-0ubuntu2 (I'm not sure if it has ever worked on Trusty tbh):

$ juju destroy-environment local
WARNING! this command will destroy the "local" environment (type: local)
This includes all machines, services, data and other resources.

Continue [y/N]? y
sudo: Sorry, you are not allowed to set the following environment variables: JUJU_HOME
ERROR failed to destroy environment "local"

If the environment is unusable, then you may run

    juju destroy-environment --force

to forcefully destroy the environment. Upon doing so, review
your environment provider console for any resources that need
to be cleaned up.

ERROR exit status 1
$ juju destroy-environment --force local
WARNING! this command will destroy the "local" environment (type: local)
This includes all machines, services, data and other resources.

Continue [y/N]? y
sudo: Sorry, you are not allowed to set the following environment variables: JUJU_HOME
ERROR exit status 1

Related branches

Revision history for this message
Liam Young (gnuoy) wrote :

I can workaround this using hazmats suggestion of editing /etc/sudoers:

=== modified file 'sudoers'
--- sudoers 2014-03-24 14:15:28 +0000
+++ sudoers 2014-03-24 14:15:53 +0000
@@ -8,6 +8,7 @@
 #
 Defaults editor=/usr/bin/vi
 Defaults env_reset
+Defaults env_keep += "JUJU_HOME"
 Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

 # Host alias specification

Revision history for this message
Curtis Hovey (sinzui) wrote :

This is a regression if the juju 1.17.2+ was used to boostrap. Which juju was used to bootstrap?

If sudo was used to boostrap the local env (old lxc rules), then this issue is a migration problem. Many users have has to postpone using the new juju because they chose to defer recreating their lxc envs. Most people have reported that they needed to remove files left behind by the old juju to use new juju per https://launchpad.net/juju-core/+milestone/1.17.2

tags: added: destroy-environment local-provider lxc
Changed in juju-core:
status: New → Incomplete
importance: Undecided → Critical
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: none → 1.17.7
Revision history for this message
Liam Young (gnuoy) wrote :

I don't think I have old files left behind but I'm happy to retest if you point me at what files might be a problem. either way the bootstrap was with 1.17.4:

$ cat $JUJU_HOME/environments.yaml
default: local

environments:
  local:
    type: local
    admin-secret: password
    root-dir: /home/liam/lxc
    default-series: precise
$ juju --version
1.17.4-trusty-amd64
$ sudo rm -rf /var/lib/lxc/*
$ juju bootstrap -e local
Logging to /home/liam/lxc/log/cloud-init-output.log on remote host
Starting MongoDB server (juju-db-liam-local)
Bootstrapping Juju machine agent
Starting Juju machine agent (juju-agent-liam-local)
$ juju status
environment: local
machines:
  "0":
    agent-state: started
    agent-version: 1.17.4.1
    dns-name: localhost
    instance-id: localhost
    series: trusty
services: {}
$ juju destroy-environment local
WARNING! this command will destroy the "local" environment (type: local)
This includes all machines, services, data and other resources.

Continue [y/N]? y
sudo: Sorry, you are not allowed to set the following environment variables: JUJU_HOME
ERROR failed to destroy environment "local"

If the environment is unusable, then you may run

    juju destroy-environment --force

to forcefully destroy the environment. Upon doing so, review
your environment provider console for any resources that need
to be cleaned up.

ERROR exit status 1

Revision history for this message
Liam Young (gnuoy) wrote :

sorry, this time deleting the root-dir:

$ cat $JUJU_HOME/environments.yaml
default: local

environments:
  local:
    type: local
    admin-secret: password
    root-dir: /home/liam/lxc
    default-series: precise

$ sudo rm -rf /home/liam/lxc/*

$ juju bootstrap -e local
Logging to /home/liam/lxc/log/cloud-init-output.log on remote host
Starting MongoDB server (juju-db-liam-local)
Bootstrapping Juju machine agent
Starting Juju machine agent (juju-agent-liam-local)

$ juju status
environment: local
machines:
  "0":
    agent-state: started
    agent-version: 1.17.4.1
    dns-name: localhost
    instance-id: localhost
    series: trusty
services: {}

$ juju destroy-environment local
WARNING! this command will destroy the "local" environment (type: local)
This includes all machines, services, data and other resources.

Continue [y/N]? y
sudo: Sorry, you are not allowed to set the following environment variables: JUJU_HOME
ERROR failed to destroy environment "local"

If the environment is unusable, then you may run

    juju destroy-environment --force

to forcefully destroy the environment. Upon doing so, review
your environment provider console for any resources that need
to be cleaned up.

ERROR exit status 1

Andrew Wilkins (axwalk)
Changed in juju-core:
assignee: nobody → Andrew Wilkins (axwalk)
Andrew Wilkins (axwalk)
Changed in juju-core:
status: Incomplete → In Progress
Revision history for this message
Andrew Wilkins (axwalk) wrote :

Trivially reproduced by adding "NOSETENV:" to the appropriate sudoer line. Easy to fix.

Andrew Wilkins (axwalk)
Changed in juju-core:
status: In Progress → Fix Committed
Curtis Hovey (sinzui)
Changed in juju-core:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.