2

I ran

unshare -mfp sh -c 'mount -tproc none /proc ; ls /proc'

That printed a /proc with only directories for PID 1 and PID 3, and exited, leaving me back in my old prompt in the root namespace, as expected.

Then I did

ls /proc

and I got back a listing without any PID directories. I was expecting my usual /proc full of processes. I had to mount proc again to fix things.

Why is this happening? How do I fix things so the /proc I mounted inside the PID namespace stays local to it?

I tried passing --mount-private to mount, but it didn't seem to have any effect.

I'm on Amazon Linux on util-linux 2.23.2.

  • -m takes an optional argument, are you sure it's not getting treating fp as a filename? – poolie Dec 16 '16 at 18:53
  • 1
    I tried the above on WRL7 (had to add -- BTW to workaround an arg processing bug in unshare). It worked as expected, so sounds like a bug. unshare -mfp -- sh -c 'mount -tproc none /proc ; ls /proc' – Neil McGill Jan 17 '17 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.