Skip to contentSkip to conversation

/proc/self/mounts in chroot vs lxc

DISCUSSION Harald Dunkel 2 participants 3 messages Feb 5, 2012 – Feb 6, 2012

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi folks,

AFAIK /proc/mounts (-> self/mounts) is supposed to replace /etc/mtab. Problem is: In a chroot it contains too much (invalid) information about the parent's mount points. It is very hard to figure out which lines are correct.

For lxc there seems to be no such problem, so I wonder if it would be possible to extend this scheme to chroot?

I am not sure if this is a kernel or libc issue. Any helpful comment would be highly appreciated.

Regards

Harri
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk8uQSAACgkQUTlbRTxpHjebAACcDv8p76s834XRmt24Abyi2lei Bg4An2zTYIvKz8uD7iYZ3f46fymZ+Guk
=pYTm
-----END PGP SIGNATURE-----

#1 lore raw
Quoted 7 lines · Harald Dunkel

Hi folks,

AFAIK /proc/mounts (-> self/mounts) is supposed to replace /etc/mtab. Problem is: In a chroot it contains too much (invalid) information about the parent's mount points. It is very hard to figure out which lines are correct.

Quoted 5 lines

For lxc there seems to be no such problem, so I wonder if it would be possible to extend this scheme to chroot?

I am not sure if this is a kernel or libc issue. Any helpful comment would be highly appreciated.

/proc is _always_ kernel thing.

For lxc, it creates a separate namespace where all "extra" mounts are unmounted. So /proc/mounts does not contain unnecessary entries.

But plain chroot does not create new namespace, the process inherits parent namespace, so there is no way to clean in up cleanly.

This is how it always worked, I'd say it is too late to change this, and changing it isn't really trivial due to various implications bind mounts are giving us.

I think anway.

/mjt.

#2 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 3 lines · Michael Tokarev

But plain chroot does not create new namespace, the process inherits parent namespace, so there is no way to clean in up cleanly.

If I do a chroot to /mnt, then there is no "/mnt" in /proc/self/mounts within this environment. Instead I see yet another entry for '/'. This certainly looks like something private.

Maybe it would be easier for everybody if /proc/mounts (without "/self") could always show the "real" mount points at the top level? A bind mount of /abc to /mnt/abc would appear as /mnt/abc in /proc/mounts at all levels. I could live with that.

Regards

Harri
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk8vdDQACgkQUTlbRTxpHjcQOgCfXwKqVu7mAFTDctvcs1YAMQCq FIsAn2UHiL+TncraqQffzdecN0eMadJy
=huO6
-----END PGP SIGNATURE-----