[lxc-users] Error: /proc must be mounted

Itamar Gal itamarggal at gmail.com
Sun Nov 27 19:43:45 UTC 2016


Hey Fajar,

Thank you for your help. Following your advice, I checked to make sure
that lxcfs is running:

    $ pgrep lxcfs | xargs ps -f -p

    UID        PID  PPID  C STIME TTY          TIME CMD
    root     29988     1  0 13:17 ?        00:00:00 /usr/bin/lxcfs
/var/lib/lxcfs


It appears that is running. I then tried creating a new container as
you suggested:

    sudo lxc-create --template=download --name=lxc-debug


I chose the following options from the interactive prompt:

    Distribution: ubuntu
    Release: trusty
    Architecture: amd64


Then I started the container and checked to make sure it was running:

    $ sudo lxc-start -n lxc-debug
    $ sudo lxc-ls --fancy | grep debug

    lxc-debug      RUNNING 0         -      10.0.3.142               -


According to the printed instructions no user accounts are created for
downloaded containers and you have to use lxc-attach to create the
initial account. Just as a sanity check I tried logging in using
lxc-console and the ubuntu user, but sure enough the usual password
from the ubuntu template didn't work (i.e. I was unable to
authenticate). So I tried using lxc-attach instead. Unfortunately
lxc-attach was unsuccessful:

    $ sudo lxc-attach -n lxc-debug -- "echo testing"

    lxc-attach: lxc-debug: attach.c:
    lxc_attach_to_ns: 252 No such file or directory - failed to open
namespace: 'mnt'.
    lxc-attach: lxc-debug: attach.c: lxc_attach: 981 failed to enter
the namespace


In fact, it turns out that I get the same error message when
attempting to use lxc-attach with my older (working) containers.
Moving on, I used chroot to set the password for the ubuntu user:

    $ sudo chroot /var/lib/lxc/lxc-debug/rootfs passwd ubuntu


After setting the password I can use lxc-console to enter the
container, but the ps command still doesn't work - it generates the
same error message.

Any further thoughts? Thanks again for your help.

Cheers,
Itamar

On Wed, Nov 23, 2016 at 11:41 PM, Fajar A. Nugraha <list at fajar.net> wrote:
> On Thu, Nov 24, 2016 at 12:29 AM, Itamar Gal <itamarggal at gmail.com> wrote:
>>
>> I have a server running Ubuntu 12.04.5 LTS (Precise Pangolin). I recently
>
>
> ouch
>
> I HIGHLY recommend you upgrade your OS to xenial. Or even install xenial to
> a new disk using zfs root, if you have it (that way you can optionally run
> you original precise root as a container later)
>
>>
>>
>>     $ apt-show-versions | grep lxc
>>
>>     liblxc1/precise uptodate 2.0.5+master~20161122-0513-0ubuntu1~precise
>
>
> at least that's good. and you also have lxcfs
>
>
>>
>> Once inside the container, I try to run the ps command and follow some
>> instructions:
>>
>>     $ ps
>>
>>     Error: /proc must be mounted
>>       To mount /proc at boot you need an /etc/fstab line like:
>>           proc   /proc   proc    defaults
>>       In the meantime, run "mount proc /proc -t proc"
>>
>>
>>     $ sudo mount proc /proc -t proc
>>
>>     mount: proc already mounted
>>
>
>
> depending on your versions, lxcfs might get killed/restarted during upgrade.
> Try:
> - check if lxcfs is running (in the host, "ps -ef | grep lxcfs")
> - if lxcfs is running, create a new container, using the DOWNLOAD template
> (NOT ubuntu template) and start it. Does ps work there?
> - if it does, restart your problematic container. Does it work now?
> --> if YES, problem solved. It was lxcfs restarted problem
> --> if NO, check the config difference between your old new newly-created
> container.
>
> --
> Fajar
>
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users


More information about the lxc-users mailing list