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

Bug#621803: mountkernfs.sh unconditionally mounts /run

On Tue, May 10, 2011 at 11:55:48AM +0200, Michael Biebl wrote:
> Am 10.05.2011 11:39, schrieb rleigh:
> > On Tue, May 10, 2011 at 11:11:20AM +0200, Michael Biebl wrote:
> >> Am 09.05.2011 23:40, schrieb rleigh:
> >>> On Mon, May 09, 2011 at 10:56:39PM +0200, chris h wrote:
> >>>> with initscripts 2.88dsf-13.5 from exp and initramfs-tools maks/run
> >>>> there's a new warning during boot:
> >>>> mount: can't find /run in /etc/fstab or /etc/mtab
> >>>>
> >>>> Apparently this is caused by mountkernfs.sh which assumes that it has
> >>>> the authority to mount /run (line 42).
> >>>> With the newer initramfs-tools /run gets moved by the initramfs' init,
> >>>> but this doesn't make it into the mtab, causing the warning.
> >>>>
> >>>> I'm unsure what the correct solution would be...
> >>>
> >>> You need the patch from #621803 applying to the maks/run branch?
> >>> Or was this already applied?
> >>
> >> I can reproduce this issue. I used sysvinit/initscripts 2.88dsf-13.5 and built
> >> initramfs-tools from the maks/run branch (a6167ad4d32f56db89989e40d1863887c199cc61)
> >>
> >> During boot I get
> >> mount: can't find /run in /etc/fstab or /etc/mtab
> >> mount: can't find /sys in /etc/fstab or /etc/mtab
> >>
> >> and as a consequence
> >> startpar: service(s) returned failure: mountkernfs.sh ... failed!

This is due to mountkernfs returning nonzero, but it did actually
succeed.  All the filesystems are mounted, it just failed to apply
the mount options (if any) from fstab due to mtab not being

> > I think I know what's going on here, but I'll need to test.  If
> > /run and /sys were mounted before reboot, they exist in the old
> > /etc/mtab before mtab.sh is run.  If they weren't, the remount
> > will fail.  mtab is not cleared until S08checkroot.sh, so
> > mountkernfs still sees the old contents.
> I only get this error message once: During next reboot after the upgrade, i.e.
> /run is mounted by the initramfs but is not (yet) in /etc/mtab.
> A simple way to reproduce the issue is to run
> : > /etc/mtab
> and reboot

Yes, I've now been able to reproduce it, thanks.
I think that we should drop the special-case remount, since we can't
remount until mtab exists and is valid, and it's safe to do this
later.  We can do the remounting by calling "mountkernfs reload" after
creating the mtab.  I think this would overall be much cleaner:

diff --git a/debian/src/initscripts/etc/init.d/mtab.sh b/debian/src/initscripts/etc/init.d/mtab.sh
index 18c9bc7..65ad2d2 100644
--- a/debian/src/initscripts/etc/init.d/mtab.sh
+++ b/debian/src/initscripts/etc/init.d/mtab.sh
@@ -77,10 +77,12 @@ do_start () {
 	# Add entries for mounts created in early boot
 	# S01mountkernfs.sh
 	/etc/init.d/mountkernfs.sh mtab
+	/etc/init.d/mountkernfs.sh reload
 	# S03udev
 	domount mtab tmpfs "" /dev "udev" "-omode=0755"
 	# S03mountdevsubfs.sh
 	/etc/init.d/mountdevsubfs.sh mtab
+	/etc/init.d/mountdevsubfs.sh reload
 	# Add everything else in /proc/mounts into /etc/mtab, with
 	# special exceptions.
diff --git a/debian/src/initscripts/lib/init/mount-functions.sh b/debian/src/initscripts/lib/init/mount-functions.sh
index beb2c1f..076a2ad 100644
--- a/debian/src/initscripts/lib/init/mount-functions.sh
+++ b/debian/src/initscripts/lib/init/mount-functions.sh
@@ -208,8 +208,8 @@ domount () {
 			if mountpoint -q "$MTPT"; then
 			    # Already mounted, probably moved from the
 			    # initramfs, so remount with the
-			    # user-specified mount options.
-			    mount $MOUNTFLAGS -oremount $CALLER_OPTS $FSTAB_OPTS $MTPT
+			    # user-specified mount options later on.
+			    :
 				if [ "$VERBOSE" != "no" ]; then
 					is_empty_dir "$MTPT" >/dev/null 2>&1 || log_warning_msg "Files under mount point '$MTPT' will be hidden."

> > The solution here, if this is the problem, is to comment out the
> > remounting until we have eliminated /etc/mtab by symlinking to
> > /proc/mounts.
> When symlinking /etc/mtab → /proc/self/mounts, I get
> Mounting local filesystems... failed

This is due to an inconsistency in /etc/fstab compared with
/proc/mounts.  "mount -a -v" should tell you what is wrong.
For me, it was s/^proc/none/ for procfs since the initramfs
sets it to "none" rather than "proc".  This is an unrelated
issue, which we can deal with separately.  Not yet clear
whether it should be fixed in the initramfs or in fstab; since
it's in all fstab files by default(?), so amending the
initramfs would probably be better.  The same might apply to
other initramfs mount commands using "none" if it's common
practice to use other names in fstab.


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