Install-grub: a new way to keep your EFI/MBR in-sync with grub package

It already does.

$ pacman -Ql install-grub

install-grub /etc/
install-grub /etc/install-grub.conf
install-grub /usr/
install-grub /usr/bin/
install-grub /usr/bin/install-grub
install-grub /usr/share/
install-grub /usr/share/libalpm/
install-grub /usr/share/libalpm/hooks/
install-grub /usr/share/libalpm/hooks/98-install-grub.hook
1 Like

We can vote every hour until all agree to use
HanzGrubber
:rofl:

2 Likes

Not sure if I am making sense or if this concerns only Plymouth, but you can alter the boot loading screen. Just my 2c to take this into consideration or testing if it was altered before.

@philm
A version/build number on the Grub menu screen presented to the user would also be a welcome addition for some.
( Small text, bottom / right, for example. )

2 Likes

I installed from stable today, 30 December 2023. On my dual-boot system (Manjaro/Win10) I had a warning, but it appears to be spurious. Grub was updated to 2.12-3 and rebooted successfully as usual. The warning was at the end:

Grub will be installed on: EFI
Installing for x86_64-efi platform.
Installation finished. No error reported.
Update UEFI Fallback file: /boot/efi/EFI/Manjaro/grubx64.efi
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.6-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-6.6-x86_64.img
Found initrd fallback image: /boot/initramfs-6.6-x86_64-fallback.img
Found linux image: /boot/vmlinuz-6.1-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-6.1-x86_64.img
Found initrd fallback image: /boot/initramfs-6.1-x86_64-fallback.img
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Windows Boot Manager on /dev/mmcblk0p1@/efi/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
Found memtest86+ image: /boot/memtest86+/memtest.bin
/usr/bin/grub-probe: warning: unknown device type mmcblk0.
Found memtest86+ EFI image: /boot/memtest86+/memtest.efi
/usr/bin/grub-probe: warning: unknown device type mmcblk0.
done
Warning: GRUB bootloader at /boot/efi/EFI/Manjaro was updated,
but it seems like you are not using it by default.
Please check your EFI boot priorities!

Not sure if the warning should be modified to allay user fears in case of dual-boots, which seem to be common among new users.

GRUB is such a bloated piece of crap I don’t understand why Manjaro isn’t using systemd-boot, or anything else.

Well, we can discuss the warning and how to write it up. It just checks if your UEFI had selected the bootloader of Manjaro or something else like Windows. Some users won’t see it even. It might also happen when you’re not using grub at all, but then you might not have this package installed to keep grub updated to begin with.

Grub is so far the only bootloader which still works on BIOS and UEFI and has the same approach how users us it UI wise. Mostly you won’t see the bootloader at all. Some say that systemd covers too many functions and gain more functions each release. But you might need to update systemd bootloader installs similar like we try to solve here.

2 Likes

Ok, I guess I recommend it for 99% of users then instead of everyone.

Well, there is a systemd service for that.

I can see why. Also, it’s systemd, not D.

1 Like

This has gone completely off-topic here, but my 2c FWIW:


@Kobold, if you say that, then I’m guessing you don’t use systemd either? No offense meant, but if that’s why you got banned, you deserve it.


I’m no expert with grub, or refind, or systemd-boot. And I also know this is minor. But from what I could find, it seems systemd-boot isn’t as customizable as grub. At least not easily and for the average person. Or if it is, I couldn’t find it, anyway.

As I said, I know it’s minor, but that’s kind of very important to me. I like it to fiddle, make things as I like 'em, basically. And this doesn’t seem possible, or at least not easy as things are with it.

For that reason, I think Manjaro sticking with grub, themed for Manjaro, is the way to go. Because, it’s Linux and nobody’s stopping you from changing to systemd-boot. Or refind, for that matter.

1 Like

I actually prefer rEFInd, and booting to kernel stub; but that’s only personal taste. I still recognise the benefits of using Grub, or a likewise Linux-centric loader whenever needed.

And that’s fine then! As I mentioned, that’s one of the beauties of Linux. Not being forced to only do it one way…

I told myself to never get involved with GPT/bios setup, and yesterday I was handed a 10 year old computer, only with old bios… sigh.

BUT, installing Manjaro xfce with btrfs and separate home worked flawlessly.
I did not know exactly how to handle the first bits of the drive but CALAMARES TOLD ME WHAT TO DO WHEN PRESSING NEXT, so I pressed back and added the unformated 8MiB partition flagging it as lba and it all worked flawlessly.

I am now a bit curious about how this script will handle this setup and will most likely try (after I made proper backups and such after just finishing setting up the computer as the user wanted it).

update-grub works without errors for me, but I am curious about install-grub (or whatever the name will land as)

Edit

$ sudo install-grub
cat: /tmp/install-grub.log: No such file or directory
rm: cannot remove '/tmp/install-grub.log': No such file or directory
Grub will be installed on: MBR
Installing for i386-pc platform.
Installation finished. No error reported.
Generating grub configuration file ...
Found theme: /usr/share/grub/themes/manjaro/theme.txt
Found linux image: /boot/vmlinuz-6.6-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-6.6-x86_64.img
Found initrd fallback image: /boot/initramfs-6.6-x86_64-fallback.img
Found linux image: /boot/vmlinuz-6.1-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-6.1-x86_64.img
Found initrd fallback image: /boot/initramfs-6.1-x86_64-fallback.img
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Detecting snapshots ...
Found snapshot: 2023-12-30 03:59:03 | timeshift-btrfs/snapshots/2023-12-30_03-59-03/@ | ondemand                      | {timeshift-autosnap} {created before upgrade} |
Found snapshot: 2023-12-30 01:51:35 | timeshift-btrfs/snapshots/2023-12-30_01-51-35/@ | ondemand daily weekly monthly | {timeshift-autosnap} {created before upgrade} |
Found 2 snapshot(s)
Unmount /tmp/grub-btrfs.HavMtxnBW4 .. Success
Found memtest86+ image: /boot/memtest86+/memtest.bin
Found memtest86+ EFI image: /boot/memtest86+/memtest.efi
done

I just realized, I haven’t rebooted yet, but I’m sure it’s fine! :slight_smile:

2 Likes

Sometimes a whole bunch of EFI files accumulate. This is what it looks like at my pc (untidy)

find .efi and detect type (bash)
for F in $(sudo find /efi /boot -iname '*.efi');do sudo sha256sum $F|grep -Eo '[0-f]{64}'|tr '\n' ' ';sudo ls -sh1 $F|tr '\n' ' ';echo "-unknown-"|sudo cat $F -|grep -Eiao --max-count=1 '/grub|refind,0.{6}|shell/RELEASE|load memtest86 |-unknown-'; done
find: ‘/efi’: Datei oder Verzeichnis nicht gefunden
cdabef3d29ccc6bca06e123baa76d72520c2702fdbbf7639c68f25693ceebb2e 284K /boot/efi/EFI/manjaro/grubx64.efi /grub
cc6acf6ab36b1b83b2aa0f81d182ec107a520e07173d10932cdc92c41d10ffce 272K /boot/efi/EFI/boot/bootx64.efi /grub
096eec99e388216afe56b81b60ccbba556d496ecf4e0dbccdeba8ef3e67ca2cf 328K /boot/efi/EFI/refind/refind_x64.efi refind,0.14.0,
790ce0400a691eda4653f669d8d762ae9a3c2c325f76db3225170aa90ba684a6 116K /boot/efi/EFI/refind/drivers_x64/btrfs_x64.efi refind,0.14.0,
e4e2aa894bbdd8a59b44b39061753f14a5305b50db6a219be02b0fbdf8574fd0 908K /boot/efi/EFI/tools/Shell.efi Shell/RELEASE
-unknown-
f7512dc80c02593b5f94d900dd01c6a8dd1e9c4aa73ef2e0d73661c2a52ea316 1008K /boot/efi/EFI/tools/Shell_Full.efi Shell/RELEASE
-unknown-
04406f3053f02bacbfe861ba24c792b7e22adab48fca97339b01dab204ba97bb 1,4M /boot/efi/EFI/tools/shellx64.efi load MemTest86 
cdabef3d29ccc6bca06e123baa76d72520c2702fdbbf7639c68f25693ceebb2e 284K /boot/grub/x86_64-efi/core.efi /grub
b9322e2166167e9ea9a35b18a43181ac40eeb8e4acb32e20699bacbcf1c99238 284K /boot/grub/x86_64-efi/grub.efi -unknown-
047be79942bef5dbeeef330e904b16f4ec0638f5d603eae9bf7e2d5bfa7be9ae 164K /boot/efi_backup/EFI/boot/bootx64.efi /grub
047be79942bef5dbeeef330e904b16f4ec0638f5d603eae9bf7e2d5bfa7be9ae 164K /boot/efi_backup/EFI/manjaro/grubx64.efi /grub
find .efi and detect type (maxi)
maxi -e
Currently running: 6.1.69-1-MANJARO (linux61)
Info about: efi bootloaders
[sudo] Passwort für andreas: 
 cdabef3d29ccc6bca06e123baa76d72520c2702fdbbf7639c68f25693ceebb2e  284K   /boot/efi/EFI/manjaro/grubx64.efi               /grub
 cc6acf6ab36b1b83b2aa0f81d182ec107a520e07173d10932cdc92c41d10ffce  272K   /boot/efi/EFI/boot/bootx64.efi                  /grub
 096eec99e388216afe56b81b60ccbba556d496ecf4e0dbccdeba8ef3e67ca2cf  328K   /boot/efi/EFI/refind/refind_x64.efi             refind,0.14.0,
 790ce0400a691eda4653f669d8d762ae9a3c2c325f76db3225170aa90ba684a6  116K   /boot/efi/EFI/refind/drivers_x64/btrfs_x64.efi  refind,0.14.0,
 e4e2aa894bbdd8a59b44b39061753f14a5305b50db6a219be02b0fbdf8574fd0  908K   /boot/efi/EFI/tools/Shell.efi                   Shell/RELEASE
 f7512dc80c02593b5f94d900dd01c6a8dd1e9c4aa73ef2e0d73661c2a52ea316  1008K  /boot/efi/EFI/tools/Shell_Full.efi              Shell/RELEASE
 04406f3053f02bacbfe861ba24c792b7e22adab48fca97339b01dab204ba97bb  1,4M   /boot/efi/EFI/tools/shellx64.efi                load MemTest86
 cdabef3d29ccc6bca06e123baa76d72520c2702fdbbf7639c68f25693ceebb2e  284K   /boot/grub/x86_64-efi/core.efi                  /grub
 b9322e2166167e9ea9a35b18a43181ac40eeb8e4acb32e20699bacbcf1c99238  284K   /boot/grub/x86_64-efi/grub.efi                  -unknown-
 047be79942bef5dbeeef330e904b16f4ec0638f5d603eae9bf7e2d5bfa7be9ae  164K   /boot/efi_backup/EFI/boot/bootx64.efi           /grub
 047be79942bef5dbeeef330e904b16f4ec0638f5d603eae9bf7e2d5bfa7be9ae  164K   /boot/efi_backup/EFI/manjaro/grubx64.efi        /grub
Info about: efi vars (needs efibootmgr)
 Boot0000* manjaro                  HD(1,GPT,b1d3d562-88ff-4ac2-8326-9c5d82892379,0x800,0x1dc800) \EFI\MANJARO\GRUBX64.EFI  
 Boot0001* rEFInd Boot Manager      HD(1,GPT,b1d3d562-88ff-4ac2-8326-9c5d82892379,0x800,0x1dc800) \EFI\REFIND\REFIND_X64.EFI
 Boot0003* UEFI: Built-in EFI Shell VenMedia(5023b95c-db26-429b-a648-bd47664c8012)                                          
 Boot0004* UEFI OS                  HD(1,GPT,b1d3d562-88ff-4ac2-8326-9c5d82892379,0x800,0x1dc800) \EFI\BOOT\BOOTX64.EFI     
 Boot001A* UEFI OS                  HD(1,GPT,99e0488b-1204-4acc-83a6-30d2c839b094,0x800,0x100000) \EFI\BOOT\BOOTX64.EFI     
 Boot0020* UEFI OS                  HD(1,GPT,4f943c21-f008-4448-aaf4-ff8be3fd2a28,0x800,0x200000) \EFI\BOOT\BOOTX64.EFI     
 Boot0022* Hard Drive               BBS(HD,,0x0)                                                                            
 Boot0023* CD/DVD Drive             BBS(CDROM,,0x0)                                                                         
 Boot0024* USB                      BBS(USB,,0x0)            

:footprints:

Did another test, this time on MY computer with btfrs.

Close to every time I update the firmware of my gigabyte motherboard my manjaro install gets removed and only leaves windows.

So every time I have to start a live env, chroot and install grub.

Following is how I chroot (bcause of btrfs)

sudo mount -t btrfs -o subvol=@ /dev/sda7 /mnt
sudo mount -t vfat /dev/sda5 /mnt/boot/efi
sudo mount --bind /run /mnt/hostrun
sudo manjaro-chroot /mnt /bin/bash

# then inside chroot:
mount --bind /hostrun /run

Updated and installed install-grub

pacman -Syu
pacman -S install-grub

I then ran install-grub witch gave me no errors and looked to complete successfully.
Rebooted, but that did NOT solve my problem, still no manjaro boot option.

So I rebooted in live env again, redid the chroot like above and used my normal method instead:

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck
grub-mkconfig -o /boot/grub/grub.cfg

And that worked.
Not sure why install-grub did not.
Since I dual boot with windows I have 2 boot partitions, maybe that has something to do with it.

The presumption is that Grub only expects one ESP (Call it an ESP, as ‘boot partition’ is too easily confused with an MBR based system).

Grub is correct; there should only be one ESP per disk, as the standard dictates. However, in practice, more than one ESP is possible, which makes it convenient for those who insist on multibooting several OS on the same disk.

Same disk multibooting is not ideal. The long established safest method is to have one OS on each disk. There are certainly fewer issues with this method.

Grub will traditionally look for the first ESP on the disk, and in your case, it finds the ESP containing Windows UEFI boot files (which is generally too small, anyway). As you found, you still had to perform a manual Grub installation.

I don’t know whether @Philm has considered a 2x ESP (same disk) scenario, or even if it’s really needed; as most who can adequately configure a multiboot system are probably already comfortable with installing Grub manually.

:endof meandering thoughts. :upside_down_face:

You are correct in my wording not being accurate. But in my situation it IS 2 partitions AND 2 ESP’s (one on each partition).
Unless now install-grub might have added something to my windows ESP so there now are 2. xD
I haven’t tried to boot into windows, I stop at the bios ESP selection menu.

You are talking about install-grub here right? Because the grub-install above is what fixes it for me.

Oh wait, do you mean it is because it it on the same device?
The fat32:s ARE on different partitions, but on the same device…

NAME        FSTYPE FSVER LABEL         UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda                                                                                        
├─sda1      vfat   FAT32 WIN-BOOT      5483-0EFB                                           
├─sda2                                                                                     
├─sda3      ntfs         windows       6654845D5484323B                                    
├─sda4      ntfs         windows-extra E61A49731A4941B3                                    
├─sda5      vfat   FAT32               AC73-C072                             510,7M     0% /boot/efi
├─sda6      swap   1                   5ae8fbf5-a704-41ea-be6d-bf26b38325ed                [SWAP]
├─sda7      btrfs        root          700d034d-b99a-482b-880b-9060acf3a6b3   49,3G    35% /var/log
│                                                                                          /var/cache
│                                                                                          /
└─sda8      btrfs        home          2a875645-5701-4450-bd08-adf1f966a07c   48,2G    49% /home

sda1 = windows
sda5 = manjaro

Edit
I mounted the windows boot partition and yepp, there is a manjaro/grub64.efi there, but I think it is since the first install I made and never kept.
I shared the boot so I remade the install with a separate partition, just forgot to remove the directories. The file/direcotry has not been changed since then.
So I have no idea what install-grub did, or why it did not throw any errors.

efibootmgr only shows the 2 so… :person_shrugging:

BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000,0001
Boot0000* manjaro       HD(5,GPT,3a0a9571-9df2-1c46-a547-9468e01607ac,0x19177000,0x100000)/File(\EFI\manjaro\grubx64.efi)
Boot0001* Windows Boot Manager  HD(1,GPT,472a11de-c3b9-4acc-b41a-bb9fb810d35d,0x800,0x32000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)0000424f

Yes, both partitions, and both ESP’s; on the same disk. :slight_smile:
Choose Windows from your Grub menu, and press F8 before the Windows logo appears. At least, I think it’s F8.

That typically works, but to have it show by default during Windows boot, from memory this should do it:

bcdedit /set {bootmgr} displaybootmenu yes
shutdown /r

(Same commands to reset it, but using no instead of yes). These commands will need to be run from an administrative command prompt in Windows.

Well, I did use the word traditionally; so, that’s not meaning the new script.

Yes. :trophy:

Naa, I don’t think I want to do that any more, since the efi file is VERY old. xD
But thank you for the reminder of F8 for windows menu.

Well, grub-install works, install-grub does not, maybe I should take a look at the script itself, but I don’t have a gitlab account so cant really do much anyway.

Besides, they might consider this “a strange setup” and disregard this anyway.

It would be interesting to see that. Of course, we can just open our own copy with nano, for the sake of curiosity.

I am with 2 ESPs and the script works. EXT4 however.