[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#820838: os-prober: 40grub2 does not handle multiple initrd paths



Package: os-prober
Version: 1.63
Severity: important
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu xenial ubuntu-patch

Dear Maintainer,

Having installed Manjaro and Ubuntu on a single machine, I found that update-grub2
failed to produce bootable entries for Manjaro (from Ubuntu) because only the first
initrd path ended up in the grub.cfg.  Manjaro uses two paths on the initrd line,
e.g.:
	initrd	/boot/intel-ucode.img /boot/initramfs-4.4-x86_64.img

The problem is partly caused by grub2's 30_os-prober script which can't properly handle
multiple initrd paths.  This is reported separately here:
https://savannah.gnu.org/bugs/index.php?47681
But the script still depends on linux-boot-prober's output, which currently only gives
the first path on the initrd line, ignoring anything on the line after it.

While the entire system seems hackish to me, a simple fix for this situation is given in
the included diff, and it's no more hackish than the rest of the script.

Applying the attached patch, in addition to applying the fix suggested for grub2 in the link
above, allows update-grub2 to produce correct, bootable entries for Manjaro.

  * linux-boot-probes/mounted/common/40grub2: must be able to handle
    multiple initrd paths, as used in some distros, e.g. Manjaro.

This is my first-ever attempt at reporting a bug to Debian, so please overlook anything
I may have done wrong.  (I DO wish Debian just had a NORMAL bug tracker like everyone
else.)

Thanks for considering the patch.


-- System Information:
Debian Release: jessie/sid
  APT prefers trusty-updates
  APT policy: (500, 'trusty-updates'), (500, 'trusty-security'), (500, 'trusty'), (100, 'trusty-backports')
Architecture: i386 (i686)

Kernel: Linux 3.13.0-85-generic (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru os-prober-1.63ubuntu1.1/debian/changelog os-prober-1.63ubuntu1.1ppa1/debian/changelog
diff -Nru os-prober-1.63ubuntu1.1/debian/control os-prober-1.63ubuntu1.1ppa1/debian/control
--- os-prober-1.63ubuntu1.1/debian/control	2016-01-12 16:29:39.000000000 +0000
+++ os-prober-1.63ubuntu1.1ppa1/debian/control	2016-04-12 21:49:05.000000000 +0000
@@ -1,8 +1,7 @@
 Source: os-prober
 Section: debian-installer
 Priority: optional
-Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
-XSBC-Original-Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
+Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
 Uploaders: Colin Watson <cjwatson@debian.org>, Joey Hess <joeyh@debian.org>, Christian Perrier <bubulle@debian.org>, Steve McIntyre <93sam@debian.org>
 Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.15.7)
 Standards-Version: 3.9.4
diff -Nru os-prober-1.63ubuntu1.1/linux-boot-probes/mounted/common/40grub2 os-prober-1.63ubuntu1.1ppa1/linux-boot-probes/mounted/common/40grub2
--- os-prober-1.63ubuntu1.1/linux-boot-probes/mounted/common/40grub2	2016-01-12 16:29:39.000000000 +0000
+++ os-prober-1.63ubuntu1.1ppa1/linux-boot-probes/mounted/common/40grub2	2016-04-12 18:08:04.000000000 +0000
@@ -78,11 +78,22 @@
 				fi
 			;;
 			initrd)
-				initrd="$(echo "$2" | sed 's/(.*)//')"
+				shift
+				initrd=""
+				for initrd_path in "$@"
+				do
+				# sed hack, as above
+				initrd_path="$(echo "$initrd_path" | sed 's/(.*)//')"
 				# Initrd same.
 				if [ "$partition" != "$bootpart" ]; then
-					initrd="/boot$initrd"
+					initrd_path="/boot$initrd_path"
 				fi
+				if [ -z "$initrd" ]; then
+					initrd="$initrd_path"
+				else
+					initrd="$initrd $initrd_path"
+				fi
+				done
 			;;
 			"}")
 				entry_result

Reply to: