Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#52910 - [grub] in os-prober part cuts off all but first initrd arguments

Attached to Project: Arch Linux
Opened by hotice (hotice) - Thursday, 09 February 2017, 09:47 GMT
Last edited by Doug Newgard (Scimmia) - Saturday, 08 July 2017, 15:48 GMT
Task Type Bug Report
Category Packages: Core
Status Assigned
Assigned To Ronald van Haren (pressh)
Christian Hesse (eworm)
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 2
Private No



Arch has customized grub package that can't boot other Linuxes that have more than one initrd parameter.
The bug shows as os-prober (30_ entries) appear truncated in grub.cfg in a way that only first initrd argument survives.

Relevant Arch entry in /boot/grub/grub.cfg is
initrd /boot/intel-ucode.img /boot/initramfs-linux.img
or, Manjaro entry:
initrd /boot/intel-ucode.img /boot/initramfs-4.9-x86_64.img

But, with Arch grub the result is truncated as below and obviously unbootable:
initrd /boot/intel-ucode.img

There is the obvious difference in script code that handles initrd row in Manjaro (that works) and Arch (that doesn't).

The situation forces to keep Manjaro version of grub in MBR of /dev/sda

Additional info:

Name : grub
Version : 1:2.02.beta3-6 and 1:2.02.rc1-1
Description : GNU GRand Unified Bootloader (2)
Architecture : x86_64

Steps to reproduce:

Single SSD BIOS/MBR multiboot config with Windows, Arch, Manjaro (Linuxes in extended part). All 3 are up to date.

parted -l output:

Model: ATA Samsung SSD 850 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 1049kB 106MB 105MB primary ntfs boot
2 106MB 190GB 190GB primary ntfs
3 190GB 500GB 310GB extended lba
5 190GB 377GB 187GB logical ntfs
6 377GB 471GB 94.1GB logical ext4
7 471GB 476GB 4340MB logical linux-swap(v1)
8 476GB 500GB 24.1GB logical ext4
9 500GB 500GB 214MB logical

/dev/sda6 is Archlinux root, /dev/sda8 is Manjaro root

All results were double checked on actual SSD partitioned as above. Arch/Manjaro grubs were sequentially set into SSD MBR.
Also performed boot from Archlinux official live CD and Manjaro official distro by using these commands to see the result in console:

mount /dev/sda6 /mnt
arch-chroot /mnt

manjaro-chroot -a
[select either Arch or Manjaro autodetected partition]
This task depends upon

Comment by Christian Hesse (eworm) - Sunday, 09 July 2017, 19:57 GMT
You mention grub versions 1:2.02.beta3-6 and 1:2.02.rc1-1, but we have 2:2.02-1 in the repositories. So looks like your system is *not* up to date.
Comment by Doug Newgard (Scimmia) - Sunday, 09 July 2017, 19:59 GMT
eworm, notice the date on the ticket. I'm trying to catch up with old tickets.
Comment by Christian Hesse (eworm) - Sunday, 09 July 2017, 20:12 GMT
BTW, /etc/grub.d/30_os-prober is unmodified and delivered from upstream grub source.
If there is an obvious difference in script code... What is it?
Comment by Christian Hesse (eworm) - Sunday, 09 July 2017, 20:15 GMT
Ah, right... Sorry, missed the date. ;)
Tix, does the issue still persist with latest package?
Comment by hotice (hotice) - Monday, 10 July 2017, 09:12 GMT

pacaur -Qi grub
Name : grub
Version : 2:2.02-1

pacaur -Qi os-prober
Name : os-prober
Version : 1.75-1

Now looks like there was a ROUGH workaround applied on ArchLinux part. That is ArchLinux is now simply ignores os-probe initrd /boot/intel-ucode.img entry by skipping it. So the initrd has only one parameter that makes a generated entry bootable. And YES, there was and still are the obvious differences in Arch and Manjaro corresponding scripts, as Manjaro script is still able to generate multi-argument initrd entries (that include /boot/intel-ucode.img) in os-probe section!
Comment by Christian Hesse (eworm) - Monday, 10 July 2017, 09:48 GMT
There is nothing applied on the Arch Linux part. As said this is shipped unmodified as provided from upstream.

Looks like we are mis-communicating about "obvious differences". For you it is just "obvious differences in the result", no?
In your original post you wrote about "obvious difference in script code". That made me think you could point to a file and line number to find the difference.

Anyway, can you provide a complete grub.cfg file (or at least the complete block generated by 30_os-prober) and a list of files (linux kernel, initrd) and their naming patterns?

Not sure if we want to load the microcode for foreign operating systems, though. This may work for Manjaro, but break for others. Some distributions use a concatenated initrd, including the microcode: See the dracut documentation [0] and its parameter '--early-microcode' for example.

Comment by hotice (hotice) - Monday, 10 July 2017, 10:59 GMT
Applying common sense logic the obvious differences in the end result that are 100% reproducable are most probably caused by obvious differences in script code :)
I remember I took Manjaro and Arch related scripts and saw clear diffs there in handling initrd line. As I have neither sufficient knowledge nor ability to suggest a fix, I just reported the issue here.

"Not sure if we want to load the microcode for foreign operating systems, though." - I think that's the key issue here. This also goes against common sense, as if Arch generates microcode for main entry, but not for others (which includes Manjaro that itself based on Arch, or even other possible pure Arch "foreign" installations for that matter!). Also Manjaro does this more consistently, microcode clause is included irrespectively of the instance of OS that put GRUB into boot sector, so that "domestic" and "foreign" OSes are handled similarly. Also, as you repeatedly told that Arch is direct copy of upstream code in this regard, the question arises why Manjaro team bothered to complicate it in the first place? The answer was obvious (as originally reported here, Arch just stripped off all but the first argiment from intrd causing faulty entry in case microcode was added), and the current situation is just a lazy and dirty workaround, either from upstream or from Arch team. All that IMHO of course.
Comment by sf (callmejoe) - Friday, 20 May 2022, 04:29 GMT
seeing this issue still, now that i added an Artix install to my machine. grub os-prober doesnt include the initramfs images for other OS