Skip to contentSkip to conversation

Fix 'root=LABEL=/'

PATCH Applied Bill Nottingham 3 participants 8 messages Jan 10, 2009 – Jan 13, 2009 5 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Fix 'root=LABEL=/'

As you can't have /dev/disk/by-label//, we need to escape the '/' character in the same way that udev does.

---
 init |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
init +4 -1
index 5b94e3d..12144d2 100755
@@ -64,7 +64,10 @@ if [ -z "$root" ]; then
   echo "Warning: no root specified"
   root="/dev/sda1"
 elif [ "${root#LABEL=}" != $root ]; then
-  root="/dev/disk/by-label/${root#LABEL=}"
+  # FIXME: may need to do more escaping here
+  l=${root#LABEL=}
+  label=${l//\//\\x2f}
+  root="/dev/disk/by-label/${label}"
 elif [ "${root#UUID=}" != $root ]; then
   root="/dev/disk/by-uuid/${root#UUID=}"
 fi
Signature · 6 lines
1.6.1

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1231617553-4206-1-git-send-email-notting-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#2 lore raw

PATCH 2/3 Fix tense.

---
 init |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
init +1 -1
index 12144d2..9b7cfe9 100755
@@ -81,7 +81,7 @@ while [ ! -e $root ]; do
       emergency_shell
   fi
 done
-echo -e "\n\nMounted rootfs after $tries seconds"
+echo -e "\n\nMounting rootfs after $tries seconds"
 ln -s "$root" /dev/root    
 mount -o ro /dev/root $NEWROOT
 
Signature · 6 lines
1.6.1

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1231617553-4206-2-git-send-email-notting-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#4 lore raw

PATCH 3/3 Go to an emergency shell if mounting the root filesystem fails.

---
 init |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
init +1 -1
index 9b7cfe9..ce6359b 100755
@@ -83,7 +83,7 @@ while [ ! -e $root ]; do
 done
 echo -e "\n\nMounting rootfs after $tries seconds"
 ln -s "$root" /dev/root    
-mount -o ro /dev/root $NEWROOT
+mount -o ro /dev/root $NEWROOT || emergency_shell
 
 # now we need to prepare to switchroot
 mount --bind /dev $NEWROOT/dev
Signature · 6 lines
1.6.1

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1231617553-4206-3-git-send-email-notting-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#6 lore raw

Re: [PATCH 3/3] Go to an emergency shell if mounting the root filesystem fails.

init while [ ! -e $root ]; do · line 86

Quoted 2 lines · Bill Nottingham
init +1 -1
-mount -o ro /dev/root $NEWROOT
+mount -o ro /dev/root $NEWROOT || emergency_shell

And also applied. Although it raises the question of if it makes sense to use 'set -e' so that any command failing drops you to the prompt

Jeremy
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw

Re: [PATCH 2/3] Fix tense.

In reply to a message not in the archive

init while [ ! -e $root ]; do · line 84

Quoted 2 lines · Bill Nottingham
init +1 -1
-echo -e "\n\nMounted rootfs after $tries seconds"
+echo -e "\n\nMounting rootfs after $tries seconds"

Picky, picky... applied :)

Jeremy
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Applied
#8 lore raw
In reply to a message not in the archive
Quoted 2 lines · Bill Nottingham

As you can't have /dev/disk/by-label//, we need to escape the '/' character in the same way that udev does.

Applied, thanks. Though I still want to get to where we use a udev rule to create the /dev/root symlink so that we can not have to do this sort of escaping.

Jeremy
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): B9A9EF7B-50A6-4E37-8485-F9486F96C5FA-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#10 lore raw
Quoted 5 lines · Jeremy Katz
Quoted 2 lines · Bill Nottingham

As you can't have /dev/disk/by-label//, we need to escape the '/' character in the same way that udev does.

Applied, thanks. Though I still want to get to where we use a udev rule to create the /dev/root symlink so that we can not have to do this sort of escaping.

Just out of curiosity. Any idea how to do a udev rule like that?

Cheers,
Philippe

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw
Quoted 5 lines · Seewer Philippe
Quoted 3 lines

Applied, thanks. Though I still want to get to where we use a udev rule to create the /dev/root symlink so that we can not have to do this sort of escaping.

Just out of curiosity. Any idea how to do a udev rule like that?

Before you start udev, in the initramfs init script, you'd do something like:

if [ "${root#LABEL=}" != "$root" ]; then

	l=${root#LABEL=}
	cat > /etc/udev/rules.d/99-rootfs.rules << EOF

ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="$l", SYMLINK+="root" EOF
fi

Then, you'd just wait for /dev/root to show up, rather than a particular device.

Bill
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html