Debian Bug report logs - #603944
retry mounting of root

version graph

Package: initramfs-tools; Maintainer for initramfs-tools is Debian kernel team <debian-kernel@lists.debian.org>; Source for initramfs-tools is src:initramfs-tools (PTS, buildd, popcon).

Reported by: "Serge E. Hallyn" <serge.hallyn@canonical.com>

Date: Thu, 18 Nov 2010 17:45:01 UTC

Severity: normal

Tags: moreinfo

Found in version initramfs-tools/0.98

Done: Ben Hutchings <ben@decadent.org.uk>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian kernel team <debian-kernel@lists.debian.org>:
Bug#603944; Package initramfs-tools. (Thu, 18 Nov 2010 17:45:04 GMT) (full text, mbox, link).


Acknowledgement sent to "Serge E. Hallyn" <serge.hallyn@canonical.com>:
New Bug report received and forwarded. Copy sent to Debian kernel team <debian-kernel@lists.debian.org>. (Thu, 18 Nov 2010 17:45:04 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: "Serge E. Hallyn" <serge.hallyn@canonical.com>
To: submit@bugs.debian.org
Subject: retry mounting of root
Date: Thu, 18 Nov 2010 11:42:49 -0600
Package: initramfs-tools
Version: 0.98

When using multipath, it is possible that mountroot() will race with
udev's renaming of /dev/disk/by-uuid/{rootfs-uuid} from /dev/sd?? to
/dev/mapper/something.  After multipath has grabbed the /dev/sd?? and
until udev completes the rename, mounting
/dev/disk/by-uuid/{rootfs-uuid} will fail with -EBUSY.

Here is a patch I've been using successfully for awhile.  Colin Watson
has suggested that:

> A poll/retry loop is generally a suboptimal way to do this kind of
> thing; what we really want is to wait for udev to tell us that it has
> finished with the event that triggered renaming of the device.

which does seem cleaner.

thanks,
-serge

diff -Nru initramfs-tools-0.98ubuntu2/debian/changelog initramfs-tools-0.98ubuntu3/debian/changelog
--- initramfs-tools-0.98ubuntu2/debian/changelog	2010-08-20 03:48:58.000000000 -0500
+++ initramfs-tools-0.98ubuntu3/debian/changelog	2010-08-24 22:31:31.000000000 -0500
@@ -1,3 +1,14 @@
+initramfs-tools (0.98ubuntu3) maverick; urgency=low
+
+  * Add retries to mountroot().  This is particularly needed when we
+    use multipath, because it is possible that mountroot() will race
+    with udev's renaming of /dev/disk/by-uuid/{rootfs-uuid} from
+    /dev/sd?? to /dev/mapper/something.  After multipath has grabbed
+    the /dev/sd?? and until udev completes the rename, mounting
+    /dev/disk/by-uuid/{rootfs-uuid} will fail with -EBUSY.
+
+ -- Serge Hallyn <serge.hallyn@canonical.com>  Tue, 24 Aug 2010 22:17:57 -0500
+
 initramfs-tools (0.98ubuntu2) maverick; urgency=low
 
   * The ramzswap device changed its interface so that the disk size needs to
diff -Nru initramfs-tools-0.98ubuntu2/scripts/local initramfs-tools-0.98ubuntu3/scripts/local
--- initramfs-tools-0.98ubuntu2/scripts/local	2010-08-20 03:48:58.000000000 -0500
+++ initramfs-tools-0.98ubuntu3/scripts/local	2010-08-24 22:16:17.000000000 -0500
@@ -86,10 +86,19 @@
 	# FIXME This has no error checking
 	[ -n "${FSTYPE}" ] && modprobe ${FSTYPE}
 
-	# FIXME This has no error checking
 	# Mount root
-	mount ${roflag} ${FSTYPE:+-t ${FSTYPE} }${ROOTFLAGS} ${ROOT} ${rootmnt}
-	mountroot_status="$?"
+	tries=0
+	ret=1
+	while [ $tries -lt 10 -a $ret -ne 0 ]; do
+		mount ${roflag} ${FSTYPE:+-t ${FSTYPE} }${ROOTFLAGS} ${ROOT} ${rootmnt}
+		ret=$?
+		if [ $ret -ne 0 ]; then
+			echo "failed attempt $tries to mount $ROOT as root"
+			sleep 1
+			tries=$((tries+1))
+		fi
+	done
+	mountroot_status=$ret
 	if [ "$LOOP" ]; then
 		if [ "$mountroot_status" != 0 ]; then
 			if [ ${FSTYPE} = ntfs ] || [ ${FSTYPE} = vfat ]; then




Information forwarded to debian-bugs-dist@lists.debian.org, Debian kernel team <debian-kernel@lists.debian.org>:
Bug#603944; Package initramfs-tools. (Thu, 09 Dec 2010 21:24:03 GMT) (full text, mbox, link).


Acknowledgement sent to "Serge E. Hallyn" <serge.hallyn@canonical.com>:
Extra info received and forwarded to list. Copy sent to Debian kernel team <debian-kernel@lists.debian.org>. (Thu, 09 Dec 2010 21:24:03 GMT) (full text, mbox, link).


Message #10 received at 603944@bugs.debian.org (full text, mbox, reply):

From: "Serge E. Hallyn" <serge.hallyn@canonical.com>
To: 603944@bugs.debian.org
Subject: Updated patch
Date: Thu, 9 Dec 2010 15:20:28 -0600
Here is a patch (against the ubuntu package, just as example)
which instead of doing a dumb retry loop, waits for udev.

=== modified file 'debian/changelog'
--- debian/changelog	2010-04-26 15:17:47 +0000
+++ debian/changelog	2010-12-08 21:44:32 +0000
@@ -1,3 +1,15 @@
+initramfs-tools (0.92bubuntu79) natty; urgency=low
+
+  * When using multipath, it is possible that mountroot() will race
+    with udev's renaming of /dev/disk/by-uuid/{rootfs-uuid} from
+    /dev/sd?? to /dev/mapper/something.  After multipath has grabbed
+    the /dev/sd?? and until udev completes the rename, mounting
+    /dev/disk/by-uuid/{rootfs-uuid} will fail with -EBUSY.  In that
+    case, call 'udevsettle' to wait until udev has finished all its
+    related actions. (Closes LP: #686832)
+
+ -- Serge Hallyn <serge.hallyn@ubuntu.com>  Fri, 19 Nov 2010 12:19:43 -0600
+
 initramfs-tools (0.92bubuntu78) lucid; urgency=low
 
   * hooks/compcache: Escape $-expansions inside <<EOF (thanks, Eugene San;

=== modified file 'scripts/local'
--- scripts/local	2009-12-21 23:06:53 +0000
+++ scripts/local	2010-11-20 01:03:26 +0000
@@ -69,10 +69,19 @@
 	# FIXME This has no error checking
 	[ -n "${FSTYPE}" ] && modprobe ${FSTYPE}
 
-	# FIXME This has no error checking
 	# Mount root
-	mount ${roflag} ${FSTYPE:+-t ${FSTYPE} }${ROOTFLAGS} ${ROOT} ${rootmnt}
-	mountroot_status="$?"
+	tries=0
+	ret=1
+	while [ $tries -lt 2 -a $ret -ne 0 ]; do
+		mount ${roflag} ${FSTYPE:+-t ${FSTYPE} }${ROOTFLAGS} ${ROOT} ${rootmnt}
+		ret=$?
+		if [ $ret -ne 0 ]; then
+			echo "failed attempt $tries to mount $ROOT as root"
+			udevadm settle
+			tries=$((tries+1))
+		fi
+	done
+	mountroot_status=$ret
 	if [ "$LOOP" ]; then
 		if [ "$mountroot_status" != 0 ]; then
 			if [ ${FSTYPE} = ntfs ] || [ ${FSTYPE} = vfat ]; then





Information forwarded to debian-bugs-dist@lists.debian.org, Debian kernel team <debian-kernel@lists.debian.org>:
Bug#603944; Package initramfs-tools. (Wed, 09 Dec 2015 20:39:07 GMT) (full text, mbox, link).


Acknowledgement sent to Ben Hutchings <ben@decadent.org.uk>:
Extra info received and forwarded to list. Copy sent to Debian kernel team <debian-kernel@lists.debian.org>. (Wed, 09 Dec 2015 20:39:07 GMT) (full text, mbox, link).


Message #15 received at 603944@bugs.debian.org (full text, mbox, reply):

From: Ben Hutchings <ben@decadent.org.uk>
To: "Serge E. Hallyn" <serge.hallyn@canonical.com>
Cc: 603944@bugs.debian.org
Subject: Re: Updated patch
Date: Wed, 09 Dec 2015 20:35:29 +0000
[Message part 1 (text/plain, inline)]
Serge, I'm sorry this patch hasn't had any attention for so long.

On Thu, 9 Dec 2010 15:20:28 -0600 "Serge E. Hallyn" <serge.hallyn@canonical.com> wrote:
> Here is a patch (against the ubuntu package, just as example)
> which instead of doing a dumb retry loop, waits for udev.
> 
> === modified file 'debian/changelog'
> --- debian/changelog	2010-04-26 15:17:47 +0000
> +++ debian/changelog	2010-12-08 21:44:32 +0000
> @@ -1,3 +1,15 @@
> +initramfs-tools (0.92bubuntu79) natty; urgency=low
> +
> +  * When using multipath, it is possible that mountroot() will race
> +    with udev's renaming of /dev/disk/by-uuid/{rootfs-uuid} from
> +    /dev/sd?? to /dev/mapper/something.  After multipath has grabbed
> +    the /dev/sd?? and until udev completes the rename, mounting
> +    /dev/disk/by-uuid/{rootfs-uuid} will fail with -EBUSY.  In that
> +    case, call 'udevsettle' to wait until udev has finished all its
> +    related actions. (Closes LP: #686832)
> +
> + -- Serge Hallyn <serge.hallyn@ubuntu.com>  Fri, 19 Nov 2010 12:19:43 -0600

(Bear in mind that I have no experience of using multipath.)

If one path shows up quickly and the other rather later, can't we still
end up mounting the single-path device rather than the multipath
device?  How do we tell when multipath discovery is complete?

Does it even make sense to specify a multipath device by UUID rather
than by its device-mapper name?  This certainly isn't supported for
LVM.

Ben.

>  initramfs-tools (0.92bubuntu78) lucid; urgency=low
>  
>    * hooks/compcache: Escape $-expansions inside <<EOF (thanks, Eugene San;
> 
> === modified file 'scripts/local'
> --- scripts/local	2009-12-21 23:06:53 +0000
> +++ scripts/local	2010-11-20 01:03:26 +0000
> @@ -69,10 +69,19 @@
>  	# FIXME This has no error checking
>  	[ -n "${FSTYPE}" ] && modprobe ${FSTYPE}
>  
> -	# FIXME This has no error checking
>  	# Mount root
> -	mount ${roflag} ${FSTYPE:+-t ${FSTYPE} }${ROOTFLAGS} ${ROOT} ${rootmnt}
> -	mountroot_status="$?"
> +	tries=0
> +	ret=1
> +	while [ $tries -lt 2 -a $ret -ne 0 ]; do
> +		mount ${roflag} ${FSTYPE:+-t ${FSTYPE} }${ROOTFLAGS} ${ROOT} ${rootmnt}
> +		ret=$?
> +		if [ $ret -ne 0 ]; then
> +			echo "failed attempt $tries to mount $ROOT as root"
> +			udevadm settle
> +			tries=$((tries+1))
> +		fi
> +	done
> +	mountroot_status=$ret
>  	if [ "$LOOP" ]; then
>  		if [ "$mountroot_status" != 0 ]; then
>  			if [ ${FSTYPE} = ntfs ] || [ ${FSTYPE} = vfat ]; then
> 
> 
> 
> 
-- 
Ben Hutchings
I'm always amazed by the number of people who take up solipsism because
they heard someone else explain it. - E*Borg on alt.fan.pratchett
[signature.asc (application/pgp-signature, inline)]

Added tag(s) moreinfo. Request was from Ben Hutchings <ben@decadent.org.uk> to control@bugs.debian.org. (Wed, 09 Dec 2015 20:39:20 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian kernel team <debian-kernel@lists.debian.org>:
Bug#603944; Package initramfs-tools. (Mon, 25 Jan 2016 15:03:04 GMT) (full text, mbox, link).


Acknowledgement sent to Ben Hutchings <ben@decadent.org.uk>:
Extra info received and forwarded to list. Copy sent to Debian kernel team <debian-kernel@lists.debian.org>. (Mon, 25 Jan 2016 15:03:04 GMT) (full text, mbox, link).


Message #22 received at 603944@bugs.debian.org (full text, mbox, reply):

From: Ben Hutchings <ben@decadent.org.uk>
To: "Serge E. Hallyn" <serge.hallyn@canonical.com>
Cc: 603944@bugs.debian.org
Subject: Re: Updated patch
Date: Mon, 25 Jan 2016 15:01:38 +0000
[Message part 1 (text/plain, inline)]
On Wed, 2015-12-09 at 20:35 +0000, Ben Hutchings wrote:
> Serge, I'm sorry this patch hasn't had any attention for so long.
> 
> On Thu, 9 Dec 2010 15:20:28 -0600 "Serge E. Hallyn"  wrote:
> > Here is a patch (against the ubuntu package, just as example)
> > which instead of doing a dumb retry loop, waits for udev.
> >  
> > === modified file 'debian/changelog'
> > --- debian/changelog	2010-04-26 15:17:47 +0000
> > +++ debian/changelog	2010-12-08 21:44:32 +0000
> > @@ -1,3 +1,15 @@
> > +initramfs-tools (0.92bubuntu79) natty; urgency=low
> > +
> > +  * When using multipath, it is possible that mountroot() will race
> > +    with udev's renaming of /dev/disk/by-uuid/{rootfs-uuid} from
> > +    /dev/sd?? to /dev/mapper/something.  After multipath has grabbed
> > +    the /dev/sd?? and until udev completes the rename, mounting
> > +    /dev/disk/by-uuid/{rootfs-uuid} will fail with -EBUSY.  In that
> > +    case, call 'udevsettle' to wait until udev has finished all its
> > +    related actions. (Closes LP: #686832)
> > +
> > + -- Serge Hallyn <serge.hallyn@ubuntu.com>  Fri, 19 Nov 2010 12:19:43 -0600
> 
> (Bear in mind that I have no experience of using multipath.)
> 
> If one path shows up quickly and the other rather later, can't we still
> end up mounting the single-path device rather than the multipath
> device?  How do we tell when multipath discovery is complete?
> 
> Does it even make sense to specify a multipath device by UUID rather
> than by its device-mapper name?  This certainly isn't supported for
> LVM.

You need to answer these questions, otherwise I'm just going to close
this bug.

Ben.

> >   initramfs-tools (0.92bubuntu78) lucid; urgency=low
> >   
> >     * hooks/compcache: Escape $-expansions inside <
> >  
> > === modified file 'scripts/local'
> > --- scripts/local	2009-12-21 23:06:53 +0000
> > +++ scripts/local	2010-11-20 01:03:26 +0000
> > @@ -69,10 +69,19 @@
> >   	# FIXME This has no error checking
> >   	[ -n "${FSTYPE}" ] && modprobe ${FSTYPE}
> >   
> > -	# FIXME This has no error checking
> >   	# Mount root
> > -	mount ${roflag} ${FSTYPE:+-t ${FSTYPE} }${ROOTFLAGS} ${ROOT} ${rootmnt}
> > -	mountroot_status="$?"
> > +	tries=0
> > +	ret=1
> > +	while [ $tries -lt 2 -a $ret -ne 0 ]; do
> > +		mount ${roflag} ${FSTYPE:+-t ${FSTYPE} }${ROOTFLAGS} ${ROOT} ${rootmnt}
> > +		ret=$?
> > +		if [ $ret -ne 0 ]; then
> > +			echo "failed attempt $tries to mount $ROOT as root"
> > +			udevadm settle
> > +			tries=$((tries+1))
> > +		fi
> > +	done
> > +	mountroot_status=$ret
> >   	if [ "$LOOP" ]; then
> >   		if [ "$mountroot_status" != 0 ]; then
> >   			if [ ${FSTYPE} = ntfs ] || [ ${FSTYPE} = vfat ]; then
> >  
> >  
> >  
> >  
-- 
Ben Hutchings
Klipstein's 4th Law of Prototyping and Production:
                                    A fail-safe circuit will destroy others.
[signature.asc (application/pgp-signature, inline)]

Reply sent to Ben Hutchings <ben@decadent.org.uk>:
You have taken responsibility. (Sat, 16 Apr 2016 22:30:11 GMT) (full text, mbox, link).


Notification sent to "Serge E. Hallyn" <serge.hallyn@canonical.com>:
Bug acknowledged by developer. (Sat, 16 Apr 2016 22:30:11 GMT) (full text, mbox, link).


Message #27 received at 603944-done@bugs.debian.org (full text, mbox, reply):

From: Ben Hutchings <ben@decadent.org.uk>
To: 603944-done@bugs.debian.org
Subject: Re: Updated patch
Date: Sat, 16 Apr 2016 23:26:53 +0100
[Message part 1 (text/plain, inline)]
On Mon, 2016-01-25 at 15:01 +0000, Ben Hutchings wrote:
> On Wed, 2015-12-09 at 20:35 +0000, Ben Hutchings wrote:
[...]
> > (Bear in mind that I have no experience of using multipath.)
> > 
> > If one path shows up quickly and the other rather later, can't we still
> > end up mounting the single-path device rather than the multipath
> > device?  How do we tell when multipath discovery is complete?
> > 
> > Does it even make sense to specify a multipath device by UUID rather
> > than by its device-mapper name?  This certainly isn't supported for
> > LVM.
> You need to answer these questions, otherwise I'm just going to close
> this bug.

Closing due to lack of response.

Ben.

-- 
Ben Hutchings
All the simple programs have been written, and all the good names taken.
[signature.asc (application/pgp-signature, inline)]

Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sun, 15 May 2016 07:27:18 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Thu Jan 4 06:41:19 2018; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.