lxc-stop -n unknown-container creates a corrupted container

Bug #1477453 reported by Chris West
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxc (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Running lxc-stop on a container which doesn't exist actually creates the container, and messes up its permissions, causing sequences like:

$ lxc-stop -n foo && lxc-destroy -n foo && lxc-clone clean-machine foo

..to fail with bad errors:

# it definitely doesn't exist to start with:
% lxc-ls foo

% lxc-info -n foo
foo doesn't exist

% ls ~/.local/share/lxc/foo -al
ls: cannot access /home/faux/.local/share/lxc/foo: No such file or directory

# now let's stop it:
% lxc-stop -n foo
foo is not running

# tooling still thinks it doesn't exist:
% lxc-ls foo

% lxc-info -n foo
foo doesn't exist

# .. but there are some files!
% ls ~/.local/share/lxc/foo -al
total 0
drwxr-xr-x 1 faux faux 14 Jul 23 09:45 .
drwxr-xr-x 1 faux faux 8070 Jul 23 09:45 ..
-rw-rw-r-- 1 faux faux 0 Jul 23 09:45 foo.log

# and now lxc-clone is totally broken:
% lxc-clone base foo
lxc_container: lxccontainer.c: lxcapi_clone: 2707 Permission denied - open /home/faux/.local/share/lxc/foo/config
clone failed

Can we worked around by manually rm -rfing ~/.local/share/lxc/foo.

ProblemType: Bug
DistroRelease: Ubuntu 15.04
Package: lxc 1.1.2-0ubuntu3
ProcVersionSignature: Ubuntu 3.19.0-22.22-generic 3.19.8-ckt1
Uname: Linux 3.19.0-22-generic x86_64
NonfreeKernelModules: nvidia
ApportVersion: 2.17.2-0ubuntu1.1
Architecture: amd64
Date: Thu Jul 23 09:45:56 2015
SourcePackage: lxc
UpgradeStatus: No upgrade log present (probably fresh install)
defaults.conf:
 lxc.network.type = veth
 lxc.network.link = lxcbr0
 lxc.network.flags = up
 lxc.network.hwaddr = 00:16:3e:xx:xx:xx

Revision history for this message
Chris West (faux) wrote :
Revision history for this message
Stéphane Graber (stgraber) wrote :

stgraber@dakara:~/data/code/lxc/lxd (stgraber/master)$ lxc-stop -n foo ; lxc-destroy -n foo ; lxc-clone clean-machine foo
foo is not running
Container is not defined
Error: container clean-machine is not defined

Changed in lxc (Ubuntu):
status: New → 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.