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

FYI - I checked the boot order at the suggestion of another user who experienced the same problem, so it wasn’t just me. :slight_smile:

Yes, and the other user that gave the suggestion, was me. :slight_smile:

The point was that it’s happened to a few people lately as a consequence of the Grub upgrade, and being that it’s not a common occurrence, it leaves some users clueless as to what the problem is, and how to recover.

1 Like

Pamac GUI

no, the script is using the Bootloader-ID from /etc/default/grub file as in: GRUB_DISTRIBUTOR='Manjaro' You can check again in your install if that is the case and if your EFI folder really has a manjaro or Manjaro folder.

In my case DISTRIBUTOR is with capital letter, but bootloader-id as per grub-install is small case. Works fine.

[teo@teo-lenovo-v15 ~]$ sudo install-grub 
Grub will be installed on: EFI
Installing for x86_64-efi 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.
Found Windows Boot Manager on /dev/nvme0n1p1@/efi/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
Root filesystem isn't btrfs
If you think an error has occurred, please file a bug report at "https://github.com/Antynea/grub-btrfs"
Found memtest86+ image: /boot/memtest86+/memtest.bin
/usr/bin/grub-probe: warning: unknown device type nvme0n1.
Found memtest86+ EFI image: /boot/memtest86+/memtest.efi
/usr/bin/grub-probe: warning: unknown device type nvme0n1.
done
[teo@teo-lenovo-v15 ~]$ sudo ls /boot/efi -Rl
/boot/efi:
total 1
drwx------ 3 root root 512 24. Jun 2023   EFI
drwx------ 2 root root 512 25. Jun 2023  'System Volume Information'

/boot/efi/EFI:
total 1
drwx------ 2 root root 512 24. Jun 2023  manjaro

/boot/efi/EFI/manjaro:
total 140
-rwx------ 1 root root 143360 28. Dez 11:22 grubx64.efi

'/boot/efi/System Volume Information':
total 0
[teo@teo-lenovo-v15 ~]$ cat /etc/default/grub |grep DISTRIBUTOR
GRUB_DISTRIBUTOR="Manjaro"

Just checked

GRUB_DISTRIBUTOR=“Manjaro”

and EFI folder really was all lowercase “manjaro” as per my previous post

→ I just manually corrected it to Manjaro… but had to

mv manjaro anjaro
mv anjaro Manjaro

because

mv manjaro Manjaro

Failed due to case insensitivity which wanted to move manjaro dir inside itself :frowning: !

This should work (untested):

sudo pacman -Syu perl-rename
rename manjaro Manjaro

Regardless, this isn’t necessary, as the named directory is usually created according to the content of bootloader-id=, unless created by a previous or foreign UEFI bootloader installation.

Hmm, what happens if the bootloader-id is all Capital. Might be UEFI BIOS related. I also saw EFI/Boot and EFI/boot folders.

In an actual Windows system, all-caps can sometimes be automatically converted to (sentence-case, I think) depending on default settings.
On a vfat filesystem (outside of Windows), I think the capitals will likely remain; the EFI directory is already allcaps, usually.

I think it doesn’t matter in the end for VFAT. It is all case insensitive, except the EFI folder. So a bootloader-id of Manjaro or manjaro or even MANJARO will act the same. Now we just have to figure out on how to make it case insensitive inside of the script.

Aren’t you glad there are no multi-language considerations?! :wink: At least, not as far as I’m aware; I don’t recall base UEFI locations being other than English.

If the directory already exists, say /EFI/manjaro and the bootloader-id is Manjaro does the script currently attempt to use the existing directory, or does it overwrite it with bootloader-id content? Maybe it’s better to first remove any existing directory (regardless of case) if it exists. VFAT is indeed case-insensitive, but tools needing to reference the directory, might not be.

Which will update this with everything else, like everything else…

1 Like

Then it’s best to use the existing directory!

You don’t know if any UEFI has a problematic implementation of fat32. If you use existing upper/lower-case names it will certainly work.

1 Like

It uses the existing directory regardless of the case sensitivity.

Should we change the name to grub-reinstall?

  • keep the name ‘install-grub’
  • switch to ‘grub-reinstall’
0 voters
2 Likes

I just think it looks/organizes nice with install-grub :slight_smile:

$ pacman -Ss grub
core/grub 2.12-3 [installed]
    GNU GRand Unified Bootloader (2)
core/install-grub 2.12-3.6
    GNU Grub (2) Install Script on Updates
core/update-grub 2.12-3 [installed]
    GNU Grub (2) Update Menu Script
extra/breeze-grub 5.27.10-1
    Breeze theme for GRUB
extra/grub-btrfs 4.13-1 [installed]
    Include btrfs snapshots in GRUB boot options
extra/grub-theme-live-common 20.2-16
    Manjaro Linux grub theme for live ISO (common files)
extra/grub-theme-live-manjaro 20.2-16
    Manjaro Linux grub theme for live ISO
------------ etc etc etc --------------

reinstall-grub to keep the norms.

  • reinstall-grub
  • grub-reinstall
0 voters
3 Likes

reinstall-grub.

Because that’s what it does. And the potential for confusion is less like that.

4 Likes

Seems legit.

Perhaps the manjaro- prefix is important to keep it consistent with other Manjaro modified packages, and differentiate it from other similar sounding tools.

  • manjaro-grub-reinstall
  • manjaro-reinstall-grub
  • manjaro-grub-installer
  • manjaro-grub-install
  • manjaro-install-grub
0 voters

As a Die Hard fan, I’m still liking ‘HansGrubber’.

2 Likes

I would prefer

manjaro-restore-grub

as it’s not just a re-installation of the grub package.

  • manjaro-reinstall-grub
  • manjaro-restore-grub
0 voters

Feedback: starting from the version 7 I got the package working for me (encrypted, btrfs)

Details
$ grep "install-grub" /var/log/pacman.log
[2023-12-26T01:32:59+0300] [PACMAN] Running 'pacman -S install-grub'
[2023-12-26T01:33:03+0300] [ALPM] installed install-grub (2.12-3.3)
[2023-12-26T04:59:48+0300] [ALPM] upgraded install-grub (2.12-3.3 -> 2.12-3.4)
[2023-12-26T12:04:08+0300] [ALPM] upgraded install-grub (2.12-3.4 -> 2.12-3.5)
[2023-12-26T12:11:47+0300] [ALPM] upgraded install-grub (2.12-3.5 -> 2.12-3.6)
[2023-12-28T15:31:31+0300] [ALPM] upgraded install-grub (2.12-3.6 -> 2.12-3.7)
[2023-12-28T21:54:16+0300] [ALPM] upgraded install-grub (2.12-3.7 -> 2.12-3.9)

I tried those versions from 3 to 6 and all of them returns an error.

When I got version 7th and 9th I found that it completed successfully for my setup
$ sudo pacman -Syu
:: Synchronising package databases...
 core is up to date
 extra is up to date
 chaotic-aur                                                                                                                             2.6 MiB  1335 KiB/s 00:02 [####################################################################################################] 100%
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...

Package (1)        Old Version  New Version  Net Change  Download Size

core/install-grub  2.12-3.6     2.12-3.7       0.00 MiB       0.02 MiB

Total Download Size:   0.02 MiB
Total Installed Size:  0.01 MiB
Net Upgrade Size:      0.00 MiB

:: Proceed with installation? [Y/n] 
:: Retrieving packages...
 install-grub-2.12-3.7-x86_64                                                                                                           22.6 KiB   148 KiB/s 00:00 [####################################################################################################] 100%
(1/1) checking keys in keyring                                                                                                                                     [####################################################################################################] 100%
(1/1) checking package integrity                                                                                                                                   [####################################################################################################] 100%
(1/1) loading package files                                                                                                                                        [####################################################################################################] 100%
(1/1) checking for file conflicts                                                                                                                                  [####################################################################################################] 100%
(1/1) checking available disk space                                                                                                                                [####################################################################################################] 100%
:: Running pre-transaction hooks...
(1/1) Creating Timeshift snapshot before upgrade...
Using system disk as snapshot device for creating snapshots in BTRFS mode
Mounted '/dev/dm-0 (nvme0n1p2)' at '/run/timeshift/115568/backup'
btrfs: Quotas are not enabled
Creating new backup...(BTRFS)
Saving to device: /dev/dm-0, mounted at path: /run/timeshift/115568/backup
Created directory: /run/timeshift/115568/backup/timeshift-btrfs/snapshots/2023-12-28_15-31-29
Created subvolume snapshot: /run/timeshift/115568/backup/timeshift-btrfs/snapshots/2023-12-28_15-31-29/@
Created control file: /run/timeshift/115568/backup/timeshift-btrfs/snapshots/2023-12-28_15-31-29/info.json
BTRFS Snapshot saved successfully (0s)
Tagged snapshot '2023-12-28_15-31-29': ondemand
------------------------------------------------------------------------------
Generating grub configuration file ...
Found theme: /usr/share/grub/themes/manjaro/theme.txt
Found linux image: /boot/vmlinuz-6.7-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-6.7-x86_64.img
Found initrd fallback image: /boot/initramfs-6.7-x86_64-fallback.img
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
Detecting snapshots ...
Found snapshot: 2023-12-28 15:31:29 | timeshift-btrfs/snapshots/2023-12-28_15-31-29/@ | ondemand | {timeshift-autosnap} {created before upgrade} |
Found snapshot: 2023-12-26 23:35:15 | timeshift-btrfs/snapshots/2023-12-26_23-35-15/@ | ondemand | {timeshift-autosnap} {created before upgrade} |
Found 2 snapshot(s)
Unmount /tmp/grub-btrfs.ZJHkjpT2l6 .. Success
Found memtest86+ image: /boot/memtest86+/memtest.bin
done
:: Processing package changes...
(1/1) upgrading install-grub                                                                                                                                       [####################################################################################################] 100%
:: Running post-transaction hooks...
(1/2) Arming ConditionNeedsUpdate...
(2/2) Refreshing PackageKit...

$ sudo install-grub
Grub will be installed on: EFI
Installing for x86_64-efi 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.7-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-6.7-x86_64.img
Found initrd fallback image: /boot/initramfs-6.7-x86_64-fallback.img
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
Detecting snapshots ...
Found snapshot: 2023-12-28 15:31:29 | timeshift-btrfs/snapshots/2023-12-28_15-31-29/@ | ondemand | {timeshift-autosnap} {created before upgrade} |
Found snapshot: 2023-12-26 23:35:15 | timeshift-btrfs/snapshots/2023-12-26_23-35-15/@ | ondemand | {timeshift-autosnap} {created before upgrade} |
Found 2 snapshot(s)
Unmount /tmp/grub-btrfs.bTals25ssd .. Success
Found memtest86+ image: /boot/memtest86+/memtest.bin
done

$ sudo pacman -Syu
:: Synchronising package databases...
 core                                                                                                                                  145.4 KiB   469 KiB/s 00:00 [####################################################################################################] 100%
 extra is up to date
 chaotic-aur                                                                                                                             2.6 MiB  1487 KiB/s 00:02 [####################################################################################################] 100%
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...

Package (1)        Old Version  New Version  Net Change  Download Size

core/install-grub  2.12-3.7     2.12-3.9       0.00 MiB       0.02 MiB

Total Download Size:   0.02 MiB
Total Installed Size:  0.01 MiB
Net Upgrade Size:      0.00 MiB

:: Proceed with installation? [Y/n] 
:: Retrieving packages...
 install-grub-2.12-3.9-x86_64                                                                                                           22.9 KiB   168 KiB/s 00:00 [####################################################################################################] 100%
(1/1) checking keys in keyring                                                                                                                                     [####################################################################################################] 100%
(1/1) checking package integrity                                                                                                                                   [####################################################################################################] 100%
(1/1) loading package files                                                                                                                                        [####################################################################################################] 100%
(1/1) checking for file conflicts                                                                                                                                  [####################################################################################################] 100%
(1/1) checking available disk space                                                                                                                                [####################################################################################################] 100%
:: Running pre-transaction hooks...
(1/1) Creating Timeshift snapshot before upgrade...
Using system disk as snapshot device for creating snapshots in BTRFS mode
Mounted '/dev/dm-0 (nvme0n1p2)' at '/run/timeshift/254864/backup'
btrfs: Quotas are not enabled
Creating new backup...(BTRFS)
Saving to device: /dev/dm-0, mounted at path: /run/timeshift/254864/backup
Created directory: /run/timeshift/254864/backup/timeshift-btrfs/snapshots/2023-12-28_21-54-15
Created subvolume snapshot: /run/timeshift/254864/backup/timeshift-btrfs/snapshots/2023-12-28_21-54-15/@
Created control file: /run/timeshift/254864/backup/timeshift-btrfs/snapshots/2023-12-28_21-54-15/info.json
BTRFS Snapshot saved successfully (0s)
Tagged snapshot '2023-12-28_21-54-15': ondemand
------------------------------------------------------------------------------
Generating grub configuration file ...
Found theme: /usr/share/grub/themes/manjaro/theme.txt
Found linux image: /boot/vmlinuz-6.7-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-6.7-x86_64.img
Found initrd fallback image: /boot/initramfs-6.7-x86_64-fallback.img
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
Detecting snapshots ...
Found snapshot: 2023-12-28 21:54:15 | timeshift-btrfs/snapshots/2023-12-28_21-54-15/@ | ondemand | {timeshift-autosnap} {created before upgrade} |
Found snapshot: 2023-12-28 15:31:29 | timeshift-btrfs/snapshots/2023-12-28_15-31-29/@ | ondemand | {timeshift-autosnap} {created before upgrade} |
Found snapshot: 2023-12-26 23:35:15 | timeshift-btrfs/snapshots/2023-12-26_23-35-15/@ | ondemand | {timeshift-autosnap} {created before upgrade} |
Found 3 snapshot(s)
Unmount /tmp/grub-btrfs.UicOMiAoYL .. Success
Found memtest86+ image: /boot/memtest86+/memtest.bin
done
:: Processing package changes...
(1/1) upgrading install-grub                                                                                                                                       [####################################################################################################] 100%
:: Running post-transaction hooks...
(1/2) Arming ConditionNeedsUpdate...
(2/2) Refreshing PackageKit...

$ sudo install-grub
Grub will be installed on: EFI
Installing for x86_64-efi 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.7-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-6.7-x86_64.img
Found initrd fallback image: /boot/initramfs-6.7-x86_64-fallback.img
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
Detecting snapshots ...
Found snapshot: 2023-12-28 21:54:15 | timeshift-btrfs/snapshots/2023-12-28_21-54-15/@ | ondemand | {timeshift-autosnap} {created before upgrade} |
Found snapshot: 2023-12-28 15:31:29 | timeshift-btrfs/snapshots/2023-12-28_15-31-29/@ | ondemand | {timeshift-autosnap} {created before upgrade} |
Found snapshot: 2023-12-26 23:35:15 | timeshift-btrfs/snapshots/2023-12-26_23-35-15/@ | ondemand | {timeshift-autosnap} {created before upgrade} |
Found 3 snapshot(s)
Unmount /tmp/grub-btrfs.R1pULKI6hN .. Success
Found memtest86+ image: /boot/memtest86+/memtest.bin
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!
$

Thanks!

Suggestions:

  1. please add build version number into terminal output to simplify diagnosing what version a user ran.
  2. may be to include it as automated action post-install script after grub package get update?
1 Like