FS#38455 - [grub] 10_archlinux and 10_linux produce duplicate menuentries in grub.cfg

Attached to Project: Arch Linux
Opened by Zhuoyun Wei (wzyboy) - Saturday, 11 January 2014, 08:41 GMT
Last edited by Tobias Powalowski (tpowa) - Monday, 07 April 2014, 16:58 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Tobias Powalowski (tpowa)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 43
Private No

Details

Description:
grub version 1:2.02.beta2-1 has a new script /etc/grub.d/10_archlinux. This script along with /etc/grub.d/10_linux will produce duplicate menuentries in grub.cfg, as shown:

### BEGIN /etc/grub.d/10_archlinux ###

menuentry "Arch Linux pkg-linux kernel" --class arch-linux --class arch --class gnu-linux --class gnu --class os {
[...]
}


menuentry "Arch Linux pkg-linux kernel (fallback initramfs)" --class arch-linux --class arch --class gnu-linux --class gnu --class os {
[...]
}

### END /etc/grub.d/10_archlinux ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux, mit Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-218e8912-90d4-4016-9fdd-9850cf1558cd' {
[...]
}

### END /etc/grub.d/10_linux ###



Steps to reproduce:
* pacman -S grub
* grub-mkconfig
* observe the output
This task depends upon

Closed by  Tobias Powalowski (tpowa)
Monday, 07 April 2014, 16:58 GMT
Reason for closing:  Fixed
Comment by Keshav Amburay (the.ridikulus.rat) - Saturday, 11 January 2014, 18:21 GMT
10_linux script (provided by upstream) detects Archlinux kernels but not the Archlinux initramfs files, so it creates menuentries without the "initrd" lines pointing to the initramfs files. "Arch Linux pkg-linux*" entries created by 10_archlinux script (provided by Arch) creates the correct menuentries including "initrd" lines for the main and fallback initramfs files for the detected kernels.

I do not know how to stop 10_linux from creating menuentries for Arch kernels.
Comment by Zhuoyun Wei (wzyboy) - Sunday, 12 January 2014, 02:39 GMT
10_linux actually creates a valid menuentry for Arch Linux:

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux, mit Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-218e8912-90d4-4016-9fdd-9850cf1558cd' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 10e5679d-4e3d-4572-8d6c-adca68ec3800
else
search --no-floppy --fs-uuid --set=root 10e5679d-4e3d-4572-8d6c-adca68ec3800
fi
echo 'Linux linux wird geladen …'
linux /vmlinuz-linux root=UUID=218e8912-90d4-4016-9fdd-9850cf1558cd rw cryptdevice=/dev/sda3:luks-sda3 acpi_backlight=vendor
echo 'Initiale Ramdisk wird geladen …'
initrd /initramfs-linux.img
}

### END /etc/grub.d/10_linux ###



To stop 10_linux from creating entries, just `chmod -x /etc/grub.d/10_linux` will do.
Comment by Joshua Wood (woodjrx) - Monday, 13 January 2014, 05:12 GMT
On my system, it was the 10_archlinux script in grub generating the duplicate (but not working) grub entries, and the 10_arch script generating the accurate grub entries.
Comment by Claire Farron (clfarron4) - Tuesday, 14 January 2014, 14:44 GMT
I get the standard entries from 10_archlinux and then duplicate entries for the non-recovery entries generated by 10_linux.

Mine before editing looked like:
Arch Linux pkg-linux kernel
Arch Linux pkg-linux kernel (fallback initramfs)
Arch Linux pkg-ck-linux kernel
Arch Linux pkg-ck-linux kernel (fallback initramfs)
Arch Linux pkg-lqx-linux kernel
Arch Linux pkg-lqx-linux kernel (fallback initramfs)
Arch Linux
Arch Linux Advanced Options
-->Arch Linux with Linux linux
-->Arch Linux pkg-ck-linux kernel
-->Arch Linux pkg-lqx-linux kernel
Comment by Steven Hum (sdothum) - Wednesday, 15 January 2014, 18:40 GMT
I did a fresh install 2 days ago with the 3.12.7-2-ARCH kernel and get the following grub entries

Arch Linux pkg-linux kernel
Arch Linux pkg-linux kernel (fallback initramfs)
Arch Linux
Arch Linux Advanced Options

Only "Arch Linux" (3rd line) would boot. The "pkg-linux" lines produce "/boot/vmlinux-linux not found" -- note: my boot drive has a btrfs subvolume configuration.
Comment by WD (warden989) - Friday, 24 January 2014, 09:27 GMT
I've the same problem of sdothum. Lines generated by 10_archlinux (not working) uses /boot/initramfs-linux.img. Instead lines configured with 10_linux uses the correct path for vmlinux and initramfs (/rootvol/boot/initramfs-linux.img) where rootvol is the btrfs subvolume mounted as /.
Comment by Peter Weber (hoschi) - Tuesday, 28 January 2014, 17:03 GMT
Furthermore it puts self compiled-kernels into a Sub-Menu. In previous times they was automatically appended to the two default Arch-Options.
Comment by John (graysky) - Wednesday, 29 January 2014, 10:52 GMT
@Steve - See  FS#38566  which has a patch in it that fixes the issue with BTRFS (at least it did for my system).
@Tpowa - I opened a ticket upstream referencing this flyspray since the script in question is provided by them.[1] Can you also take a look at the patch I mentioned in  FS#38566  above? That task is currently unassigned and contains a fix that should be considered.

1. https://savannah.gnu.org/bugs/index.php?41384
Comment by Peter Weber (hoschi) - Monday, 03 February 2014, 12:53 GMT
I have added a warning to our wiki:
https://wiki.archlinux.org/index.php?title=GRUB&diff=prev&oldid=296042

Please modifie it if not appropriate or this issue is resolved. I'm watching this task, but maybe I miss it.
Comment by Yogesh Marwaha (yogeshm.007) - Monday, 03 February 2014, 13:58 GMT
I installed Arch Linux (for the first time ever!) on Sunday (mine is BIOS based).
While grub does produce duplicate entries (as pointed out by op), all of them are effectively same on my system and all work.
PS: Why does 10_archlinux exists in first place? Is not 10_linux enough?
Comment by Bastien Traverse (Neitsab) - Tuesday, 04 February 2014, 18:28 GMT
Thanks @hoschi for updating the wiki, that's what brought me here when my search engine didn't return anything consistent :) Subscribing to this bug too.

In my case (ext4 on LVM on LUKS on BIOS/MBR), entries generated by 10_linux and 10_archlinux are all functional (didn't try fallback though). Relevant excerpt from /boot/grub/grub.cfg attached.
So that would mean, potentially 10_archlinux isn't needed anymore?

Btw, why does Arch provide the development version of Grub (latest git version from http://git.savannah.gnu.org/cgit/grub.git/) instead of latest stable one, which is referenced on ftp://ftp.gnu.org/gnu/grub/ as being 2.00? Needed to fix something maybe? I couldn't find info about that on arch-dev-public. Just wondering.



   grub.cfg (3.7 KiB)
Comment by Bastien Traverse (Neitsab) - Tuesday, 04 February 2014, 18:40 GMT
Okay I see. I just did a sudo chmod -x /etc/grub.d/10_archlinux & updated grub, and fallback initramfs entries are not present anymore. So that answers my question whether "10_archlinux" is not needed anymore: it _is_ if one wants those entries.

Apart from that everything looked fine, with a first standard entry called "Arch linux" and a second one called "Advanced options" opening a submenu with every kernels available (reminder: submenus can be disabled by adding "GRUB_DISABLE_SUBMENU=y" in /etc/default/grub).

Disabling 10_archlinux fixes this bug (redundant entries) for me, but this isn't a perfect fix since fallback entries aren't generated anymore.
Comment by Claire Farron (clfarron4) - Tuesday, 04 February 2014, 22:46 GMT
@hoschi, I run about 5 different kernels: core, ck (repository), mainline (self-compiled), lts-ck (self-compiled) and lqx (self-compiled).

My freshly generated GRUB does this:
Arch Linux pkg-linux kernel
Arch Linux pkg-linux kernel (fallback initramfs)
Arch Linux pkg-ck-linux kernel
Arch Linux pkg-ck-linux kernel (fallback initramfs)
Arch Linux pkg-lqx-linux kernel
Arch Linux pkg-lqx-linux kernel (fallback initramfs)
Arch Linux pkg-lts-ck-linux kernel
Arch Linux pkg-lts-ck-linux kernel (fallback initramfs)
Arch Linux pkg-mainline-linux kernel
Arch Linux pkg-mainline-linux kernel (fallback initramfs)
Arch Linux
Arch Linux Advanced Options
-->Arch Linux with Linux linux
-->Arch Linux pkg-ck-linux kernel
-->Arch Linux pkg-lqx-linux kernel
-->Arch Linux pkg-lts-ck-linux kernel
-->Arch Linux pkg-mainline-linux kernel

The last five entries are in a submenu, headed under "Arch Linux Advanced Options". Also, I haven't a clue why there is an "Arch Linux" option, but it works (and boots the [core] kernel).

Also, all the entries work for me.

I've downgraded to grub 2.00.5086-1 because it works (yes, it puts the kernels in reverse alphabetical order, but I'd rather have that because I don't want the extra entries).
Comment by Peter Weber (hoschi) - Thursday, 06 February 2014, 10:39 GMT
For me (personally) also all options are bootable, but me mainline-kernels (self-compiled) only show up unter "Advanced Options".
/boot/vmlinuz-custom # self compiled from mainline
/boot/initramfs-custom.img # self generated initramfs, with my kernel it is not necessary. I add it for sheer convenience e.g. for things like grub, dm-mod, os-prober
Comment by MyCookie! (MyCookie) - Monday, 10 February 2014, 00:22 GMT
Hello, just wanted to add that I was not able to boot the [core] LTS kernel with only 10_linux. I had chmodded -x 10_archlinux, and once I brought it back I was able to boot LTS as normal. I had a VFS root filesystem not found error. I didn't have a lot of time to figure out what was wrong, but just wanted to point out my experience, as it hasn't been said before.
Comment by Eugene Shalygin (eshalygin) - Tuesday, 11 February 2014, 12:14 GMT
In my case there is no save_default_entry call in the 'Arch Linux' entry produced by 10_archlinux, while 10_linux generates it
Comment by Eugene Shalygin (eshalygin) - Tuesday, 11 February 2014, 16:36 GMT
Why don't you just create symlinks initramfs-fallback.img -> initramfs-linux-fallback.img and vmlinuz-fallback -> vmlinuz-linux? Then 10_linux detects both kernels and initrd images.
Comment by Dustin Falgout (lots0logs) - Monday, 17 February 2014, 03:47 GMT
There is no fallback kernel, both initramfs use the same kernel. I tested your symlink idea by creating a link to vmlinuz-linux named vmlinuz-linux-fallback but the resulting grub.cfg was still incorrect.
Comment by Eugene Shalygin (eshalygin) - Monday, 17 February 2014, 10:06 GMT
Sorry, I do not know what does mean "still incorrect". If 10_linux does not see your initramfs (this is only a guess), then you have not followed version scheme that it expects. One can find it in in the /etc/grub.d/10_linux, in my case starting from line 177. I gave just one example of the suitable file names.
Comment by Dustin Falgout (lots0logs) - Monday, 17 February 2014, 10:13 GMT
Meaning the result is the same as what's already been reported here. It inserts two entries that both reference the regular initramfs img (one should be using the fallback initramfs)
Comment by Eugene Shalygin (eshalygin) - Monday, 17 February 2014, 11:47 GMT
# LANG="C" ls -1l /boot/ | cut -c 46- | grep linux
initramfs-fallback.img -> initramfs-linux-fallback.img
initramfs-linux
initramfs-linux-fallback.img
initramfs-linux.img
kernel26-fallback.img -> initramfs-linux-fallback.img
kernel26.img -> initramfs-linux.img
vmlinuz-fallback -> vmlinuz-linux
vmlinuz-linux
vmlinuz26 -> vmlinuz-linux

and # cat /boot/grub/grub.cfg | grep -E 'initrd|linux'
loadfont ($root)/grub/themes/Archlinux/Sans-10.pf2
loadfont ($root)/grub/themes/Archlinux/Sans-12.pf2
loadfont ($root)/grub/themes/Archlinux/Sans-14.pf2
set theme=($root)/grub/themes/Archlinux/theme.txt
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-8ffa44c0-d1e5-44bd-9963-9d9671eddab3' {
echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=8ffa44c0-d1e5-44bd-9963-9d9671eddab3 rw resume=/dev/sda2 loglevel=4
initrd /initramfs-linux.img
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-8ffa44c0-d1e5-44bd-9963-9d9671eddab3' {
menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-8ffa44c0-d1e5-44bd-9963-9d9671eddab3' {
echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=8ffa44c0-d1e5-44bd-9963-9d9671eddab3 rw resume=/dev/sda2 loglevel=4
initrd /initramfs-linux.img
menuentry 'Arch Linux, with Linux fallback' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-fallback-advanced-8ffa44c0-d1e5-44bd-9963-9d9671eddab3' {
linux /vmlinuz-fallback root=UUID=8ffa44c0-d1e5-44bd-9963-9d9671eddab3 rw resume=/dev/sda2 loglevel=4
initrd /initramfs-fallback.img
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
linux16 /memtest86+/memtest.bin
Comment by Peter Weber (hoschi) - Tuesday, 25 February 2014, 10:07 GMT
@Tobias Powalowski:
Can we help you in some way? Or should we think about reverting the Arch specific changes in the last package-releases?
Comment by Tobias Powalowski (tpowa) - Tuesday, 25 February 2014, 10:54 GMT
To understand your issue correct:
the 10_linux does it correct but does not offer fallback options.
the 10_archlinux does nothing correct?

Thanks
Comment by Florian Walch (fwalch) - Tuesday, 25 February 2014, 11:00 GMT
@tpowa:
For me, 10_archlinux is fully correct (incl. fallback option) and is the default boot option;
10_linux is without fallback option and has some differences to the other entry regarding insmods. Didn't try to boot it, though.

I attached the relevant parts of the grub.cfg
Comment by Tobias Powalowski (tpowa) - Tuesday, 25 February 2014, 11:35 GMT
Please try 2.02.beta2-2 package from testing repository.
Comment by Florian Walch (fwalch) - Tuesday, 25 February 2014, 12:08 GMT
Hm.. that doesn't seem to have changed anything (see attachment).
   out (0.8 KiB)
Comment by Claire Farron (clfarron4) - Tuesday, 25 February 2014, 22:02 GMT
This is mine with 2.02.beta2-2.
   grub.cfg (15.7 KiB)
Comment by Tomasz Borkowski (Tomasz) - Thursday, 27 February 2014, 21:49 GMT
The only one disadvantage of 10_archlinux is that it seems not to generate "savedefault" entries, even if "GRUB_SAVEDEFAULT=true" is set in /etc/default/grub.
This feature is very useful in multi-boot systems.
Comment by Eugene Shalygin (eshalygin) - Thursday, 27 February 2014, 21:59 GMT
Don't you think that the disadvantage is the need of support for 10_archlinux and synchronization with 10_linux?
Comment by Tomasz Borkowski (Tomasz) - Thursday, 27 February 2014, 22:43 GMT
For me, it would be fine if at least "10_archlinux" implemented the whole functionality (inclusive savedefault), as "10_archlinux" and "30_os-prober" would meet rather all my requirements.
Of course, in my opinion, if both of them are provided in grub, both should work correctly.
Comment by Tomasz Borkowski (Tomasz) - Thursday, 27 February 2014, 23:58 GMT
Comment by Tomasz Borkowski (Tomasz) - Friday, 28 February 2014, 00:00 GMT
removed doubled posting
Comment by Robert (tapek) - Sunday, 09 March 2014, 15:00 GMT
solution is simple, disable 10_linux:

# chmod -x /etc/grub.d/10_linux
Comment by Peter Weber (hoschi) - Monday, 17 March 2014, 09:11 GMT
My kernel ans images:
* Default Archlinux with initramfs and initramfs-fallback
* Custom Kernel with custom initramfs (named: vmlinuz-custom, mkinitcpio-custom)

After update:
1. Archlinux with initramfs # okay
2. Archlinux with initramfs (fallback) #okay
3. Archlinux with initrd # false, same as 1
4. Submenu
4.1 Archlinux with initramfs # false, same as 1
4.2 Custom kernel # okay, but should be a top-level

Comment by Wilbert van Bakel (wilbert-vb) - Wednesday, 26 March 2014, 17:32 GMT
10-archlinux does not support subvolumes on a btrfs file system

The rootflags= directive is missing from the entry.

Resulting in halting boot with '/sbin/init not found' error
Comment by Tobias Powalowski (tpowa) - Monday, 07 April 2014, 14:57 GMT
Please try latest grub from testing.
Comment by Florian Walch (fwalch) - Monday, 07 April 2014, 16:22 GMT
Latest grub resolves this bug for me (default kernel). 10_linux provides default and fallback entries; 10_archlinux is gone, so there are no duplicate entries.

Loading...