[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 Wed, May 11, 2011 at 07:56:13PM +0100, Ben Hutchings wrote:
> On Wed, May 11, 2011 at 05:40:52PM +0100, rleigh wrote:
> [...]
> > 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.
> 
> How is that supposed to work when initramfs-tools mounts directories
> before /etc/fstab is accessible?

Well, the mnt_fsname for each is hard-coded in the initscripts scripts'
domount() calls.  If the user adds an fstab entry, they'll use the
same fsname (or else the scripts won't use it and you'll also get mount
errors).  As a result, there's no choice in the naming here--they have
been hardcoded in initscripts for many years.  The only reason we
haven't had much reported breakage is that until now very few users
have made /proc/mounts a symlink, and those that have probably manually
fixed things up rather than go to the effort of getting the initramfs
fixed.


The order is like this:

init (initramfs) mounts /proc /dev /dev/pts /sys /run etc.
---
mountkernfs.sh
  mounts /run, proc, /sys (if not already mounted by the initramfs).
  Defaults are taken from /lib/init and /etc/fstab.
mountdevsubfs.sh
  does the same for /dev/pts /dev/shm.
[root is made r/w]
mtab.sh
  generates the initial mtab; this uses the defaults from
  /lib/init and /etc/fstab as for the earlier scripts.
  mtab then remounts the filesystems with the options from /lib/init
  and /etc/fstab to ensure that user-configured filesystem options are
  applied to the initramfs mounts [note: this does not affect mnt_fsname]
mountall.sh
  calls "mount -a" to mount filesystems
  This is the problematic step.  When we use the generated mtab, it
  exactly matches what we did, and runs without error.  When we
  use a symlink to /proc/mounts, there's a mismatch with the options
  initramfs init used, and what the initscripts and fstab used, and
  this is what causes the error.

The cause is simple to test for yourself.  Just take the
  proc            /proc           proc    defaults        0       0
line from /etc/fstab, and change the first "proc" to "none" (or
anything else) and run "mount -a", and you'll see it fail.  Change it
back, and it works just fine.  This is why updating initramfs init
to use the same mnt_fsname for its mounts as the system/admin would
use corrects the problem.  It's purely the "none" mnt_fsname from
initramfs that's breaking mount here because it doesn't match what
every system has in their fstab (by default).


Regards,
Roger

-- 
  .''`.  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: