[Pkg-sysvinit-devel] Unexpected problem with /etc/mtab -> /proc/mounts

Henrique de Moraes Holschuh hmh at debian.org
Sat Jan 21 21:16:56 UTC 2006


On Sat, 21 Jan 2006, Petter Reinholdtsen wrote:
> When testing the new sysvinit package, I just discovered a problem
> with this change:
> 
>   * Use /proc/mounts instead of /etc/mtab when unmounting  (Closes: #338801)
> 
> It make df very confused in a chroot:

The fact is that /proc/mounts does not reflect the process' namespace.  That
by itself could be considered a kernel bug/limitation, but... neither does
/etc/mtab.  It's just that most /etc/mtab are empty on chroots, and end up
containing little more than sys or proc when people mount that inside the
chroot...

That said, why are we caring about system startup and system shutdown
initscripts being run inside a chroot?

IMHO as far as initscript goes, we must ensure that we umount everything we
can, but we simply don't have the information we need to do that properly if
we are chrooted.  We umount everything we can, try to kick everything else
to read-only, and keep going.  When operating on bogus mountpoints, all this
will do is fill the output channel with error messages.

We could process BOTH /etc/mtab and /proc/mounts, though, as anything we
umount sucessfully from /etc/mtab will disappear from /proc/mounts anyway.
This sounds right.

Anyone thinks we should ask the kernel people to provide us with a process
namespace (and chroot status)-aware /proc/mounts (or somesuch) ?

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh



More information about the Pkg-sysvinit-devel mailing list