Bug#638979: grub-mount shows symbolic links in mounted partitions as ordinary files

Vladimir 'φ-coder/phcoder' Serbinenko phcoder at gmail.com
Sat Jan 14 09:35:25 UTC 2012


tag 638979 wont-fix
thanks
grub-mount uses GRUB internal FS modules and it's API doesn't expose 
symlinks
On 23.08.2011 15:16, Aki wrote:
> 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
>
>
>
> _______________________________________________
> Pkg-grub-devel mailing list
> Pkg-grub-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grub-devel


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko






More information about the Pkg-grub-devel mailing list