destroy-environment fails to clear lxc containers
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | juju-core |
High
|
Unassigned | ||
| | lxc (Ubuntu) |
Medium
|
Unassigned | ||
Bug Description
Running destroy-environment with --force happily cleans up evan-local-
% juju destroy-environment local --force
WARNING! this command will destroy the "local" environment (type: local)
This includes all machines, services, data and other resources.
Continue [y/N]? y
[sudo] password for evan:
ERROR failed to destroy lxc container: error executing "lxc-destroy": lxc_container: Error destroying rootfs for evan-local-
ERROR error executing "lxc-destroy": lxc_container: Error destroying rootfs for evan-local-
ERROR exit status 1
% sudo lxc-ls -f
NAME STATE IPV4 IPV6 AUTOSTART
-------
evan-local-
evan-local-
juju-precise-
% juju destroy-environment local --force
WARNING! this command will destroy the "local" environment (type: local)
This includes all machines, services, data and other resources.
Continue [y/N]? y
ERROR failed to destroy lxc container: error executing "lxc-destroy": lxc_container: Error destroying rootfs for evan-local-
ERROR error executing "lxc-destroy": lxc_container: Error destroying rootfs for evan-local-
ERROR exit status 1
% sudo lxc-ls -f
NAME STATE IPV4 IPV6 AUTOSTART
-------
evan-local-
evan-local-
juju-precise-
% juju destroy-environment local --force
WARNING! this command will destroy the "local" environment (type: local)
This includes all machines, services, data and other resources.
Continue [y/N]? y
% sudo lxc-ls -f
NAME STATE IPV4 IPV6 AUTOSTART
-------
evan-local-
evan-local-
juju-precise-
| Tim Penhey (thumper) wrote : | #1 |
| tags: | added: destroy-environment local-provider lxc |
| Changed in juju-core: | |
| status: | New → Triaged |
| importance: | Undecided → High |
| milestone: | none → 1.20.0 |
| John A Meinel (jameinel) wrote : | #3 |
Until we can reproduce this, I don't think we can address it.
| Changed in juju-core: | |
| status: | Triaged → Incomplete |
| Changed in juju-core: | |
| milestone: | 1.20.0 → none |
| Changed in juju-core: | |
| importance: | High → Medium |
| Launchpad Janitor (janitor) wrote : | #4 |
[Expired for juju-core because there has been no activity for 60 days.]
| Changed in juju-core: | |
| status: | Incomplete → Expired |
I've had this happen again. It looks like it lxc cannot remove the rootfs subvolume because it references other subvolumes:
http://
(.venv-
execve(
access(
access(
open("/
access(
open("/
access(
open("/
access(
open("/
access(
open("/
access(
open("/
access(
open("/
access(
open("/
access(
open("/
access(
open("/
access(
open("/
access(
open("/
access(
open("/
access(
open("/
access(
open("/
access(
open("/
statfs(
statfs("/selinux", 0x7fffe99765f0) = -1 ENOENT (No such file or directory)
open("/
open("/
stat("/
| Changed in juju-core: | |
| status: | Expired → New |
Yup, that's definitely it. Deleting the subvolumes under /var/lib/
To further clarify, this isn't a juju bug. lxc should be smart enough to delete dependent subvolumes before it deletes the rootfs subvolume. I took a stab at this over the weekend, but ran out of time. btrfs_destroy(
| Serge Hallyn (serge-hallyn) wrote : | #8 |
To be sure I understand, the issue is that inside your container you created btrfs subvolumes (by using btrfs containers or manually using btrfs subvolume create)?
| Changed in juju-core: | |
| status: | New → Triaged |
| importance: | Medium → High |
| importance: | High → Medium |
Correct. Attached is a juju-deployer config that reproduces the issue when used with the juju local provider and /var/lib/lxc in the host backed onto btrfs. If you deploy it and run juju destroy-environment --force -y local, it should fail.
This is because Ceph sees that /srv/ceph is on btrfs and makes use of it.
ubuntu@
/dev/sda2 on / type btrfs (rw)
So you'll end up with lots of snapshots created by Ceph inside LXC. These will be visible by running `btrfs subvolume list /var/lib/lxc` in the host:
(.venv-
ID 256 gen 9268 top level 5 path @lxc
ID 257 gen 8126 top level 256 path juju-precise-
ID 285 gen 8006 top level 256 path juju-trusty-
ID 762 gen 9208 top level 256 path vagrant-
ID 763 gen 9208 top level 256 path vagrant-
ID 764 gen 9208 top level 256 path vagrant-
ID 925 gen 9208 top level 256 path vagrant-
ID 934 gen 9208 top level 256 path vagrant-
ID 944 gen 9208 top level 256 path vagrant-
ID 951 gen 9208 top level 256 path vagrant-
ID 954 gen 9208 top level 256 path vagrant-
ID 957 gen 9208 top level 256 path vagrant-
ID 958 gen 9208 top level 256 path vagrant-
ID 959 gen 9208 top level 256 path vagrant-
ID 960 gen 9208 top level 256 path vagrant-
| Changed in lxc (Ubuntu): | |
| importance: | Undecided → Medium |
| status: | New → Triaged |
| tags: | added: ubuntu-engineering |
| Changed in juju-core: | |
| importance: | Medium → High |
| milestone: | none → next-stable |
| Serge Hallyn (serge-hallyn) wrote : | #10 |
The fix for this is applied in lxc's git HEAD.
| Changed in lxc (Ubuntu): | |
| status: | Triaged → Fix Committed |
| Launchpad Janitor (janitor) wrote : | #11 |
This bug was fixed in the package lxc - 1.1.0~alpha2-
---------------
lxc (1.1.0~
* Cherry-pick usptream bugfix for lxc-usernic test.
-- Stephane Graber <email address hidden> Thu, 02 Oct 2014 15:01:56 -0400
| Changed in lxc (Ubuntu): | |
| status: | Fix Committed → Fix Released |
| Changed in juju-core: | |
| status: | Triaged → Invalid |
| Changed in juju-core: | |
| milestone: | next-stable → none |


Hi Evan, Can I get you to please run and pastebin the following?
juju destroy-environment local --logging- config= golxc=TRACE; juju=DEBUG --show-log
This will give us the output of the lxc command and why it is failing.