[Bug 969604] [NEW] lxc-stop should be able to handle ephemeral containers more robustly

Gary Poster gary.poster at canonical.com
Fri Mar 30 21:08:34 UTC 2012

Public bug reported:

It is possible to have an ephemeral container remaining after lxc-start-
ephemeral has been killed--trivially by calling kill -9 on lxc-start-
ephemeral.  At that point, the script does not get a chance to clean up
after itself, and the system is left with a running ephemeral container
as well as several mounts.

lxc-stop can stop the container, but after an ephemeral container is
stopped, it ought to be destroyed, and it is not.  Moreover, if you then
try to use lxc-destroy, it will fail, because the ephemeral container's
directory is mounted, with another directory mounted inside
(ephemeralbind).  Moreover again, if you succeed in umounting those
directories, and then destroying the container, there is still a tmpfs
"/tmp/lxc-lp-XXXXXXX" directory (I suspect that "lp" segment of the name
is no longer appropriate, btw) hidden away consuming undefined amounts
amount of memory that would ideally have been removed for the user.

We have a script to handle this possibility in an automated way.  Beyond
handling the above, it does one more thing that lxc-stop can't do now:
it finds all of the ephemeral containers via a glob, to allow the
automated script to not have to know what temporary name the ephemeral
container has.  An equivalent would be "lxc-stop -n lptests-tmp-*".

It would be nice if lxc-stop could handle properly destroying ephemeral
containers when they are stopped.  (Perhaps this could even be a step
along the way to the non-COMMAND version of lxc-start-ephemeral ending
simply with either lxc-start -n $NAME or lxc-start -d -n $NAME.) It
would be even more nice if lxc-stop could handle globs, so we could do
away with our script.

The least obvious aspect of the implementation I see is how to know what
/tmp/lxc-lp-* directory to remove.  The best I can come up with is
parsing the output of "mount" to find the tmp directory used as the
"upperdir" for the primary overlayfs.  This would be a bit more lines of
code if you wanted to support aufs, but still doable.

If it's not already clear, I personally consider this a low priority

Thank you

** Affects: lxc (Ubuntu)
     Importance: Undecided
         Status: New

You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to lxc in Ubuntu.

  lxc-stop should be able to handle ephemeral containers more robustly

To manage notifications about this bug go to:

More information about the Ubuntu-server-bugs mailing list