Bug#513504: flash-kernel should handle LVM roots better

2009-01-29 Thread Paul Jakma

Package: flash-kernel
Version: 2.12
Severity: critical
Justification: breaks the whole system

LVM roots are not handled well. If one specifies an LVM root in 
/etc/fstab in the form of /dev/vg/lv (e.g. /dev/VG-n2100/root_lv) 
then the system will fail to boot. Instead, one must use the 
/dev/mapper/VG-vg-lv form in fstab.


The problem, according to waldi/maks on #debian-kernel is that the 
/dev/vg/lv form devices are just symlinks to the /dev/mapper devices. 
These symlinks do not exist when initramfs goes to mount the root. 
(If I /understood correctly).


A workaround, according to tbm, would be to have flash-kernel 
canonicalise LVM devices to their /dev/mapper/... form - I gather.


-- System Information:
Debian Release: 5.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'testing-proposed-updates'), (500, 
'unstable')
Architecture: armel (armv5tel)

Kernel: Linux 2.6.26-1-iop32x
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=locale: 
Cannot set LC_CTYPE to default locale: No such file or directory

locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages flash-kernel depends on:
ii  devio 1.2-1  correctly read (or write) a region
ii  initramfs-tools   0.92o  tools for generating an initramfs

flash-kernel recommends no packages.

Versions of packages flash-kernel suggests:
pn  uboot-mkimage none (no description available)

-- debconf information exclude



--
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#513504: flash-kernel should handle LVM roots better

2009-01-29 Thread Martin Michlmayr
* Paul Jakma paul+debianb...@jakma.org [2009-01-29 17:45]:
 A workaround, according to tbm, would be to have flash-kernel
 canonicalise LVM devices to their /dev/mapper/... form - I gather.

It's not a workaround; it's the proper solution.

maks, can you comment on this patch.  I've attached the full hook for
context.  Maybe you'll find other cases that need to be handled in a
special way.

Index: initramfs-tools/hooks/flash_kernel_set_root
===
--- initramfs-tools/hooks/flash_kernel_set_root (revision 56152)
+++ initramfs-tools/hooks/flash_kernel_set_root (working copy)
@@ -43,6 +43,13 @@
 # Record the root filesystem device for use during boot
 rootdev=$(egrep '^[^#  ]+[ ]+/[]' /etc/fstab | awk '{print $1}') || 
true
 
+# Map LVM devices in the form of /dev/vg/lv to /dev/mapper/, otherwise
+# initramfs won't initialize them.
+link=$(readlink -f $rootdev)
+if echo $link | grep -q ^/dev/mapper/; then
+   rootdev=$link
+fi
+
 # Translate LABEL and UUID entries into a proper device name.
 if echo $rootdev | grep -q =; then
a=$(echo $rootdev | cut -d = -f 1)

-- 
Martin Michlmayr
http://www.cyrius.com/
#!/bin/sh

# This code is covered by the GNU General Public License (GPLv2 or higher)

PREREQ=

prereqs() {
echo $PREREQ
}

pause_error() {
#exit 1 # won't work; initramfs-tools ignores hook script exit code
echo  2
if [ $DEBIAN_FRONTEND = noninteractive ] ; then
echo Unable to abort; system will probably be broken! 2
else
echo Press Ctrl-C to abort build, or Enter to continue 2
read
fi
}

case $1 in
prereqs)
prereqs
exit 0
;;
esac

. /usr/share/initramfs-tools/hook-functions

# Only run on some machines
machine=$(grep ^Hardware /proc/cpuinfo | sed 's/Hardware\s*:\s*//')
case $machine in
Buffalo Linkstation Pro/Live | Buffalo/Revogear Kurobox Pro | 
D-Link DNS-323 | GLAN Tank | HP Media Vault mv2120 | Linksys NSLU2 | 
QNAP TS-109/TS-209 | QNAP TS-409 | Thecus N2100)
# Pass the check and continue below
;;
*)
# If the machine is not listed, don't run this hook
exit 0
;;
esac

# Record the root filesystem device for use during boot
rootdev=$(egrep '^[^#   ]+[ ]+/[]' /etc/fstab | awk '{print $1}') || 
true

# Map LVM devices in the form of /dev/vg/lv to /dev/mapper/, otherwise
# initramfs won't initialize them.
link=$(readlink -f $rootdev)
if echo $link | grep -q ^/dev/mapper/; then
rootdev=$link
fi

# Translate LABEL and UUID entries into a proper device name.
if echo $rootdev | grep -q =; then
a=$(echo $rootdev | cut -d = -f 1)
b=$(echo $rootdev | cut -d = -f 2- | sed -e 's/^\(.*\)$/\1/')
case $a in
LABEL)
c=$(echo $b | sed 's#/#\\x2f#g')
if [ -e /dev/disk/by-label/$c ]; then
rootdev=/dev/disk/by-label/$c
else
echo Label $b not found in /dev/disk/by-label 
2
fi
;;
UUID)
rootdev=/dev/disk/by-uuid/$b
if [ ! -e $rootdev ]; then
echo UUID $b doesn't exist in 
/dev/disk/by-uuid 2
fi
;;
*)
echo /etc/fstab parse error; cannot recognize root 
$rootdev 2
;;
esac
fi

if [ ! -e $rootdev ]; then
rootdev=/dev/sda2
echo Warning: /etc/fstab parse error; guessing that the root device is 
$rootdev 2
pause_error
fi
case $machine in
# The boot loader doesn't pass root= on the command line, so
# provide a default.
Linksys NSLU2)
install -d $DESTDIR/conf/conf.d
echo ROOT=\$rootdev\  $DESTDIR/conf/conf.d/default_root
;;
# The boot loader passes a bogus root= (e.g. root=/dev/ram), so
# override the command line parameter.
Buffalo Linkstation Pro/Live | Buffalo/Revogear Kurobox Pro | 
D-Link DNS-323 | GLAN Tank | HP Media Vault mv2120 | QNAP TS-109/TS-209 
| QNAP TS-409 | Thecus N2100)
install -d $DESTDIR/conf
echo ROOT=\$rootdev\  $DESTDIR/conf/param.conf
;;
# This shouldn't happen - only if a device from the case statement
# above wasn't added here.
*)
echo Device $machine not supported.  Please file a bug. 2
pause_error
;;
esac



Bug#513504: flash-kernel should handle LVM roots better

2009-01-29 Thread Paul Jakma

Hi,

This works for me, see comments below!

On Thu, 29 Jan 2009, Martin Michlmayr wrote:

maks, can you comment on this patch.  I've attached the full hook 
for context.  Maybe you'll find other cases that need to be handled 
in a special way.



Index: initramfs-tools/hooks/flash_kernel_set_root
===
--- initramfs-tools/hooks/flash_kernel_set_root (revision 56152)
+++ initramfs-tools/hooks/flash_kernel_set_root (working copy)
@@ -43,6 +43,13 @@
# Record the root filesystem device for use during boot
rootdev=$(egrep '^[^#   ]+[ ]+/[]' /etc/fstab | awk '{print $1}') || 
true


Aside: I think this may be fragile (literal tabs), using [:white:] 
would be better. Indeed, grep piped to AWK is often redundant (as AWK 
will parse the line again, and has its own POSIX RE support). Indeed 
AWK has, what I would consider more comprehensible way of writing 
this (tested along with the patch):


rootdev=$(awk '$1 !~ /^#/  $2 == / { print $1; exit }' /etc/fstab) || true


+# Map LVM devices in the form of /dev/vg/lv to /dev/mapper/, otherwise
+# initramfs won't initialize them.
+link=$(readlink -f $rootdev)
+if echo $link | grep -q ^/dev/mapper/; then
+   rootdev=$link
+fi
+
# Translate LABEL and UUID entries into a proper device name.
if echo $rootdev | grep -q =; then
a=$(echo $rootdev | cut -d = -f 1)


This works fine for me!

Thanks very much!

regards,
--
Paul Jakma  p...@clubi.ie   p...@jakma.org  Key ID: 64A2FF6A
Fortune:
You can't cheat an honest man.  Never give a sucker an even break or
smarten up a chump.
-- W.C. Fields



--
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#513504: flash-kernel should handle LVM roots better

2009-01-29 Thread Martin Michlmayr
severity 513504 important
thanks

* Paul Jakma paul+debianb...@jakma.org [2009-01-29 17:45]:
 Package: flash-kernel
 Version: 2.12
 Severity: critical

Thinking about this some more, I realized that this situation must be
quite rare.  d-i generates a /etc/fstab in the form of /dev/mapper/...
so in order to end up with a system that doesn't boot you have to edit
fstab manually and replace /dev/mapper/... with /dev/vg/lv.

Still, it's a bug that needs to be fixed.
-- 
Martin Michlmayr
http://www.cyrius.com/



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Processed: Re: Bug#513504: flash-kernel should handle LVM roots better

2009-01-29 Thread Debian Bug Tracking System
Processing commands for cont...@bugs.debian.org:

 severity 513504 important
Bug#513504: flash-kernel should handle LVM roots better
Severity set to `important' from `critical'

 thanks
Stopping processing here.

Please contact me if you need assistance.

Debian bug tracking system administrator
(administrator, Debian Bugs database)


-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org