[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#603858: Mount options for proc conflict with /etc/fstab breaking /etc/init.d/mountall.sh

On Tue, May 10, 2011 at 11:12:07PM +0100, Roger Leigh wrote:
> On Wed, Nov 17, 2010 at 11:04:15PM +0100, Goswin von Brederlow wrote:
> > I recently installed a squeeze system. The generated /etc/fstab
> > contains the following line:
> > 
> >    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
> >    proc            /proc           proc    defaults        0       0
> > 
> > But in /usr/share/initramfs-tools/init you have:
> > 
> >    mount -t proc -o nodev,noexec,nosuid none /proc
> > 
> > This causes mount to return an error when mounting all local
> > filesystems because "proc" and "none" are different divices and it
> > can't mount /proc again over an existing mountpoint. The
> > /etc/init.d/mountall.sh script reports a red FAILED because of that.
> > 
> > Node: /etc/mtab is a link to /proc/mounts here. That might affect this
> > issue.
> It certainly does.  I've attached a patch which fixes this for
> all filesystems handed over to the host from the initramfs so
> that read-only root works correctly.  This matches up the mount
> options with those used by initscripts so that everything works
> whether you're using /etc/mtab as a file or as a symlink to
> /proc/mounts (as will occur soon; see #620710 and
> http://people.debian.org/~rleigh/util-linux_2.19.1-1.dsc).  The
> new mount uses libmount and /run/mount/utab which makes a
> /proc/mounts symlink work correctly.

Just to add a small bit of clarification: for "mount -a" to work,
the mnt_fsname and mnt_dir and mnt_type must match or else mount
reports a mount error.

This information is recorded in three places:

1) /etc/fstab
2) /etc/mtab (or /proc/mounts if symlinked)
3) initscripts mounting filesystems (mountkernfs.sh, mountdevsubfs.sh)

The information needs to be identical between all three when running
"mount -a" or else the result is a mount failure (exit status 32).

Historically, mtab is a regular file.  In this case, the options it
stores come from the initscripts doing the mounting and/or fstab if
any entries are present.  Typically no fstab entries will be present,
so initscripts is the only source of the options found in mtab, and
hence they are always the same.  The only one present in fstab by
default is /proc, and initscripts is careful to use the same options
to avoid a mismatch.

initramfs-tools only comes into the picture when we make /etc/mtab a
symlink to /proc/mounts.  At this point, the mount options used by
initramfs-tools init are visible to mount where previously they were
hidden.  Because initramfs-tools doesn't use the same options as
historical practice in initscripts or fstab, the result is a mismatch
between /etc/mtab and /etc/fstab which results in "mount -a" returning
with a mount failure status.

The fix for this is straightforward: by making initramfs-tools use the
same options as initscripts and any additional user entries in
/etc/fstab (which will naturally use the same options as the scripts
in order to be functional), mount failures are prevented and existing
user configuration is preserved and functional.


  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.

Attachment: signature.asc
Description: Digital signature

Reply to: