On a fresh new container, I do:

lxc-attach -n mycontainer -- apt-get install -y wget

But the installation of wget fails partially with the following message

Processing triggers for ca-certificates (20160104) ...
mktemp: failed to create file via template ‘/some/path/on/host/machine’: No such file or directory
dpkg: error processing package ca-certificates (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:

1 Answer 1


The solution was simply to clear environment variables, like this:

lxc-attach --clear-env -n mycontainer -- apt-get install -y wget

From lxc-attach --help:

  --clear-env   Clear all environment variables before attaching.
                The attached shell/program will start with only
                container=lxc set.
  --keep-env    Keep all current environment variables. This
                is the current default behaviour, but is likely to
                change in the future.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .