[Bug 1840477] [NEW] Probed linux entries not bootable if original initrd line has more than one file

Matt Heller matthewfheller+launchpad at gmail.com
Fri Aug 16 15:21:07 UTC 2019


Public bug reported:

I have Manjaro Linux 18.0.4 installed and then recently installed Ubuntu
19.04 on another partition. After the Ubuntu install the Ubuntu created
GRUB boot menu includes entries for booting Manjaro but they aren't
functional. It is repeatable after install too, If I run update-grub2
from Ubuntu the prober finds Manjaro and adds boot entries but they are
flawed in the same way. Namely the entries for booting Manjaro in the
original Manjaro created grub.cfg contain:

                linux   /vmlinuz-4.19-x86_64 root=UUID=c6b7b62a-66d5-45ef-89dd-4f06ec8e6cbe rw  
                initrd  /amd-ucode.img /initramfs-4.19-x86_64.img

but the entries in the Ubuntu created grub.cfg contain:

                linux   /vmlinuz-4.19-x86_64 root=UUID=c6b7b62a-66d5-45ef-89dd-4f06ec8e6cbe rw  
                initrd  /amd-ucode.img

The second initrd file goes missing. Thus if I try to boot using the Ubuntu created entry for Manjaro I hit 
"Kernel Panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)"
... immediately at the beginning of boot.

I tracked the problem down to /usr/lib/linux-boot-probes/mounted/40grub2 line # 81
      initrd="$(echo "$2" | sed 's/(.*)//')"
>From what I can tell the purpose of this is to strip GRUB style partition specifier prefix like "(hd0,1)" however it makes the assumption that the original initrd line it discovered in probing only contains a single file.

I am able to fix this behavior and make the Manjaro entry of the Ubuntu generate GRUB menu bootable if I change the "40grub2" prober and "30_os-prober" code as follows...
(borrows from the Manjaro version)

$ diff /usr/lib/linux-boot-probes/mounted/40grub2.original /usr/lib/linux-boot-probes/mounted/40grub2 
81,82d80
< 				initrd="$(echo "$2" | sed 's/(.*)//')"
< 				# Initrd same.
84c82,84
< 					initrd="/boot$initrd"
---
> 					initrd="$(echo "$line" | sed 's/initrd//;s/\t//;s|/|/boot/|g;s/(.*)//')"
> 				else
> 					initrd="$(echo "$line" | sed 's/initrd//;s/\t//;s/(.*)//')"

$ diff /etc/grub.d/30_os-prober.original /etc/grub.d/30_os-prober
246c246
<         LINITRD="`echo ${LINUX} | cut -d ':' -f 5`"
---
>         LINITRD="`echo ${LINUX} | cut -d ':' -f 5 | tr '^' ' '`"

ProblemType: Bug
DistroRelease: Ubuntu 19.04
Package: os-prober 1.74ubuntu1 [modified: usr/bin/linux-boot-prober]
ProcVersionSignature: Ubuntu 5.0.0-25.26-generic 5.0.18
Uname: Linux 5.0.0-25-generic x86_64
ApportVersion: 2.20.10-0ubuntu27.1
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Fri Aug 16 10:03:03 2019
InstallationDate: Installed on 2019-08-15 (1 days ago)
InstallationMedia: Ubuntu 19.04 "Disco Dingo" - Release amd64 (20190416)
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: os-prober
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: os-prober (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug disco

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to os-prober in Ubuntu.
https://bugs.launchpad.net/bugs/1840477

Title:
  Probed linux entries not bootable if original initrd line has more
  than one file

Status in os-prober package in Ubuntu:
  New

Bug description:
  I have Manjaro Linux 18.0.4 installed and then recently installed
  Ubuntu 19.04 on another partition. After the Ubuntu install the Ubuntu
  created GRUB boot menu includes entries for booting Manjaro but they
  aren't functional. It is repeatable after install too, If I run
  update-grub2 from Ubuntu the prober finds Manjaro and adds boot
  entries but they are flawed in the same way. Namely the entries for
  booting Manjaro in the original Manjaro created grub.cfg contain:

                  linux   /vmlinuz-4.19-x86_64 root=UUID=c6b7b62a-66d5-45ef-89dd-4f06ec8e6cbe rw  
                  initrd  /amd-ucode.img /initramfs-4.19-x86_64.img

  but the entries in the Ubuntu created grub.cfg contain:

                  linux   /vmlinuz-4.19-x86_64 root=UUID=c6b7b62a-66d5-45ef-89dd-4f06ec8e6cbe rw  
                  initrd  /amd-ucode.img

  The second initrd file goes missing. Thus if I try to boot using the Ubuntu created entry for Manjaro I hit 
  "Kernel Panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)"
  ... immediately at the beginning of boot.

  I tracked the problem down to /usr/lib/linux-boot-probes/mounted/40grub2 line # 81
        initrd="$(echo "$2" | sed 's/(.*)//')"
  From what I can tell the purpose of this is to strip GRUB style partition specifier prefix like "(hd0,1)" however it makes the assumption that the original initrd line it discovered in probing only contains a single file.

  I am able to fix this behavior and make the Manjaro entry of the Ubuntu generate GRUB menu bootable if I change the "40grub2" prober and "30_os-prober" code as follows...
  (borrows from the Manjaro version)

  $ diff /usr/lib/linux-boot-probes/mounted/40grub2.original /usr/lib/linux-boot-probes/mounted/40grub2 
  81,82d80
  < 				initrd="$(echo "$2" | sed 's/(.*)//')"
  < 				# Initrd same.
  84c82,84
  < 					initrd="/boot$initrd"
  ---
  > 					initrd="$(echo "$line" | sed 's/initrd//;s/\t//;s|/|/boot/|g;s/(.*)//')"
  > 				else
  > 					initrd="$(echo "$line" | sed 's/initrd//;s/\t//;s/(.*)//')"

  $ diff /etc/grub.d/30_os-prober.original /etc/grub.d/30_os-prober
  246c246
  <         LINITRD="`echo ${LINUX} | cut -d ':' -f 5`"
  ---
  >         LINITRD="`echo ${LINUX} | cut -d ':' -f 5 | tr '^' ' '`"

  ProblemType: Bug
  DistroRelease: Ubuntu 19.04
  Package: os-prober 1.74ubuntu1 [modified: usr/bin/linux-boot-prober]
  ProcVersionSignature: Ubuntu 5.0.0-25.26-generic 5.0.18
  Uname: Linux 5.0.0-25-generic x86_64
  ApportVersion: 2.20.10-0ubuntu27.1
  Architecture: amd64
  CurrentDesktop: ubuntu:GNOME
  Date: Fri Aug 16 10:03:03 2019
  InstallationDate: Installed on 2019-08-15 (1 days ago)
  InstallationMedia: Ubuntu 19.04 "Disco Dingo" - Release amd64 (20190416)
  ProcEnviron:
   TERM=xterm-256color
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=<set>
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: os-prober
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/os-prober/+bug/1840477/+subscriptions



More information about the foundations-bugs mailing list