[lxc-users] [BUG] lxc-destroy destroying wrong containers

Tomasz Chmielewski mangoo at wpkg.org
Tue Nov 10 05:19:41 UTC 2015


lxc-destroy may be destroying wrong containers!

To reproduce:

1) have a container you want to clone - here, testvm012d:

# lxc-ls -f
NAME                                        STATE    IPV4                
    IPV6  GROUPS  AUTOSTART
---------------------------------------------------------------------------------------------------
testvm012d                                  STOPPED  -                   
    -     -       NO


2) clone it - but before the command returns, press ctrl+c (say, you 
realized you used a wrong name and want to interrupt):

# lxc-clone -B dir testvm012d testvm13d
[ctrl+c]


3) lxc-ls will now show two containers:

# lxc-ls -f
NAME                                        STATE    IPV4                
    IPV6  GROUPS  AUTOSTART
---------------------------------------------------------------------------------------------------
testvm012d                                  STOPPED  -                   
    -     -       NO
testvm13d                                   STOPPED  -                   
    -     -       NO


4) we can see that the "interrupted" container was not fully copied - 
let's remove it then with lxc-destroy:

# du -sh testvm012d testvm13d
462M    testvm012d
11M     testvm13d

# lxc-destroy -n testvm13d

# echo $?
0


5) as expected, lxc-ls only lists the original container now:

# lxc-ls -f
NAME                                        STATE    IPV4                
    IPV6  GROUPS  AUTOSTART
---------------------------------------------------------------------------------------------------
testvm012d                                  STOPPED  -                   
    -     -       NO


6) unfortunately rootfs for the original container is gone:

# du -sh testvm012d
4.0K    testvm012d

# ls testvm012d/
config



If it matters, my containers are in /srv/lxc/, symlinked from 
/var/lib/lxc/


Tomasz Chmielewski
http://wpkg.org



More information about the lxc-users mailing list