Bug#638979: grub-mount shows symbolic links in mounted partitions as ordinary files
Aki
computer.enthusiastic at gmail.com
Tue Aug 23 13:16:52 UTC 2011
Package: grub-common
Version: 1.99-11
Severity: normal
Hello.
A first Debian GNU/Linux Wheezy amd64 (kernel 3.0.0-1-amd64) is
installed in /dev/sda1 as boot/root partition.
A second Debian GNU/Linux Wheezy (kernel 3.0.0-1-486) is installed in
/dev/sdb1 as root partition *skipping grub installation* using the
expert menu install; the contents of / and /boot in /dev/sdb1 are:
# ls -la init* vmlinu* boot/*
-rw-r--r-- 1 root root 130995 24 lug 17.11 boot/config-3.0.0-1-486
-rw-r--r-- 1 root root 9084991 21 ago 14.34 boot/initrd.img-3.0.0-1-486
-rw-r--r-- 1 root root 1516241 24 lug 17.11 boot/System.map-3.0.0-1-486
-rw-r--r-- 1 root root 2419024 24 lug 17.10 boot/vmlinuz-3.0.0-1-486
lrwxrwxrwx 1 root root 28 21 ago 14.33 initrd.img ->
/boot/initrd.img-3.0.0-1-486
lrwxrwxrwx 1 root root 24 21 ago 14.33 vmlinuz ->
boot/vmlinuz-3.0.0-1-486
The user boots Debian GNU/Linux Wheezy amd64 from /dev/sda1 and then
runs the script /usr/sbin/update-grub2:
# update-grub2
Generating grub.cfg ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-3.0.0-1-amd64
Found initrd image: /boot/initrd.img-3.0.0-1-amd64
Found Debian GNU/Linux (wheezy/sid) on /dev/sdb1
done
When the user boots GNU/Linux Wheezy amd64 from /dev/sda1, he/she finds
that four entries have been generated in /boot/grub/grub.cfg for the
single Debian GNU/Linux kernel installed in /dev/sdb1 (see attached
grub-dump.png and grub.cfg).
I suppose the cause is in /usr/bin/grub-mount.
All the following commands has been given given as root after booting
from /dev/sda1:
# mkdir -p /tmp/mnt
# grub-mount /dev/sdb1 /tmp/mnt/
# cd /tmp/mnt
# ls -la vmlinu* initrd* boot/vmlinu* boot/initrd* -la
-r--r--r-- 0 root root 22279168 21 ago 14.34 boot/initrd.img-3.0.0-1-486
-r--r--r-- 0 root root 2419024 24 lug 17.10 boot/vmlinuz-3.0.0-1-486
-r--r--r-- 0 root root 22279168 21 ago 14.33 initrd.img
-r--r--r-- 0 root root 2419024 21 ago 14.33 vmlinuz
# cd ..
# umount /tmp/mnt
# mount /dev/sdb1 /tmp/mnt/
# cd /tmp/mnt
# ls -la vmlinu* initrd* boot/vmlinu* boot/initrd* -la
-rw-r--r-- 1 root root 9084991 21 ago 14.34 boot/initrd.img-3.0.0-1-486
-rw-r--r-- 1 root root 2419024 24 lug 17.10 boot/vmlinuz-3.0.0-1-486
lrwxrwxrwx 1 root root 28 21 ago 14.33 initrd.img ->
/boot/initrd.img-3.0.0-1-486
lrwxrwxrwx 1 root root 24 21 ago 14.33 vmlinuz ->
boot/vmlinuz-3.0.0-1-486
# cd ..
# umount /tmp/mnt
As you can see, after mounting with grub-mount, symlinks are shown as
ordinary files in the mounted partition. This way the script
/usr/lib/linux-boot-probes/mounted/90fallback fails to recognize
symlinks (that it usually skips) at row 24 :
1 #!/bin/sh
2 # Fallback in case nothing else works. Look for vmlinu[xz]
file in root and
3 # /boot, see if there is a matching initrd, and wing it.
4 . /usr/share/os-prober/common.sh
5 set -e
6
7 partition="$1"
8 bootpart="$2"
9 mpoint="$3"
10 type="$4"
[..cut..]
22 for kernfile in $(eval ls "$mpoint$kernpat"
2>/dev/null); do
23 kernbasefile=$(echo "$kernfile" | sed
"s!^$mpoint!!")
===> 24 if [ -f "$kernfile" ] && [ ! -L "$kernfile" ]; then
25 initrdname=$(echo "$kernfile" | sed
"s/vmlinu[zx]/initrd\*/")
26 # Yellow Dog Linux appends .img to it.
27 initrdname1="${initrdname}.img"
A possible temporary work-around could be to rename the
/usr/bin/grub-mount to /bin/mount and then run /usr/sbin/update-grub2 again:
# cd /usr/bin/
# mv grub-mount grub-mount.old
# ln -s /bin/mount grub-mount
# ls grub-mount* -la
lrwxrwxrwx 1 root root 10 22 ago 11.04 grub-mount -> /bin/mount
-rwxr-xr-x 1 root root 281744 9 ago 02.46 grub-mount.old
# /usr/sbin/update-grub2
I suppose grub-mount should be fixed to let it recognize symlinks.
Let me know if you need further informations.
Thanks,
Aki.
-- System Information:
Debian Release: wheezy/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 3.0.0-1-amd64 (SMP w/1 CPU core)
Locale: LANG=it_IT.utf8, LC_CTYPE=it_IT.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages grub-common depends on:
ii gettext-base 0.18.1.1-4 GNU Internationalization
utilities
ii libc6 2.13-16 Embedded GNU C Library:
Shared lib
ii libdevmapper1.02.1 2:1.02.63-3.1 The Linux Kernel Device
Mapper use
ii libfreetype6 2.4.6-1 FreeType 2 font engine,
shared lib
ii libfuse2 2.8.5-4 Filesystem in Userspace
(library)
ii zlib1g 1:1.2.3.4.dfsg-3 compression library - runtime
Versions of packages grub-common recommends:
ii os-prober 1.47 utility to detect other
OSes on a
Versions of packages grub-common suggests:
ii desktop-base 6.0.6 common files for the Debian
Deskto
pn grub-emu <none> (no description available)
pn multiboot-doc <none> (no description available)
pn xorriso <none> (no description available)
-- no debconf information
-------------- next part --------------
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function load_video {
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
}
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root cc2fbfb3-89db-4555-a97f-99eea50b4808
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
load_video
insmod gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root cc2fbfb3-89db-4555-a97f-99eea50b4808
set locale_dir=($root)/boot/grub/locale
set lang=it_IT
insmod gettext
fi
terminal_output gfxterm
set timeout=5
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/05_debian_theme ###
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root cc2fbfb3-89db-4555-a97f-99eea50b4808
insmod png
if background_image /usr/share/images/desktop-base/spacefun-grub.png; then
set color_normal=light-gray/black
set color_highlight=white/black
else
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_debian_theme ###
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Debian GNU/Linux, con Linux 3.0.0-1-amd64' --class debian --class gnu-linux --class gnu --class os {
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root cc2fbfb3-89db-4555-a97f-99eea50b4808
echo 'Caricamento Linux 3.0.0-1-amd64...'
linux /boot/vmlinuz-3.0.0-1-amd64 root=UUID=cc2fbfb3-89db-4555-a97f-99eea50b4808 ro quiet
echo 'Caricamento ramdisk iniziale...'
initrd /boot/initrd.img-3.0.0-1-amd64
}
menuentry 'Debian GNU/Linux, con Linux 3.0.0-1-amd64 (modalità ripristino)' --class debian --class gnu-linux --class gnu --class os {
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root cc2fbfb3-89db-4555-a97f-99eea50b4808
echo 'Caricamento Linux 3.0.0-1-amd64...'
linux /boot/vmlinuz-3.0.0-1-amd64 root=UUID=cc2fbfb3-89db-4555-a97f-99eea50b4808 ro single
echo 'Caricamento ramdisk iniziale...'
initrd /boot/initrd.img-3.0.0-1-amd64
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Debian GNU/Linux (wheezy/sid) (on /dev/sdb1)" --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(/dev/sdb,msdos1)'
search --no-floppy --fs-uuid --set=root b65e7187-cbf0-4e02-b5f1-0561164f2281
linux /vmlinuz root=/dev/sdb1
initrd /initrd.img
}
menuentry "Debian GNU/Linux (wheezy/sid) (on /dev/sdb1)" --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(/dev/sdb,msdos1)'
search --no-floppy --fs-uuid --set=root b65e7187-cbf0-4e02-b5f1-0561164f2281
linux /vmlinuz root=/dev/sdb1
initrd /initrd.img
}
menuentry "Debian GNU/Linux (wheezy/sid) (on /dev/sdb1)" --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(/dev/sdb,msdos1)'
search --no-floppy --fs-uuid --set=root b65e7187-cbf0-4e02-b5f1-0561164f2281
linux /boot/vmlinuz-3.0.0-1-486 root=/dev/sdb1
initrd /boot/initrd.img-3.0.0-1-486
}
menuentry "Debian GNU/Linux (wheezy/sid) (on /dev/sdb1)" --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(/dev/sdb,msdos1)'
search --no-floppy --fs-uuid --set=root b65e7187-cbf0-4e02-b5f1-0561164f2281
linux /vmlinuz root=/dev/sdb1
initrd /initrd.img
}
menuentry "Debian GNU/Linux (wheezy/sid) (on /dev/sdb1)" --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(/dev/sdb,msdos1)'
search --no-floppy --fs-uuid --set=root b65e7187-cbf0-4e02-b5f1-0561164f2281
linux /vmlinuz root=/dev/sdb1
initrd /initrd.img
}
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###
### BEGIN /etc/grub.d/41_custom ###
if [ -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
-------------- next part --------------
A non-text attachment was scrubbed...
Name: grub-dump.png
Type: image/png
Size: 36128 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20110823/9fa69ae0/attachment-0001.png>
More information about the Pkg-grub-devel
mailing list