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

You may now fail due to one check I added lately:

if [[ "$grub_type" == "EFI" ]] && [[ -e "/boot/grub/$efi_target/core.efi" ]] \
    && [[ -e "$efi_source_file" ]]; then
    _grub_install="grub-install --no-nvram --target=$efi_target --efi-directory=$efi_directory \
--bootloader-id=$bootloader_id --recheck --force" && did_update=true
...
fi

if [[ -z "$_grub_install" ]]; then
    echo "WARNING: Grub is not properly installed, system may not be bootable or other bootloader is used" >&2
    exit 1
fi

It boils down to the existence of $efi_source_file, which is in your case /efi/EFI/Manjaro/grubx64.efi. So how is your special setup of your grub install made? Maybe give me a tree output of your files related to EFI to understand more. On my end it works.

The only thing I did was create the /efi directory and mount the esp there (in fstab).
So, for example, my normal invocation would look like:

sudo grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=Manjaro --recheck

Hmm, so it is mounted and not a normal folder. Odd. Can you modify the script based on install-grub ($976) Β· Snippets Β· GitLab to be more verbose like this:

    for path in /boot /efi; do
        if [[ -e $path ]]; then
            efi_directory="$(find $path -name $efi_grub_file | awk -F '/EFI' '{print $1}')"
            echo "EFI Dir: $efi_directory"
            tree "$efi_directory"
            if [[ ! -z "$efi_directory" ]]; then
                efi_source_file="$(find $efi_directory/EFI/$bootloader_id -name $efi_grub_file)"
                efi_target_file="$(find $path -name $efi_boot_file)"
                echo "Source: $efi_source_file"
                echo "Target: $efi_target_file"
                if [[ -e "$efi_source_file" ]] && [[ -e "$efi_target_file" ]]; then
                    echo "Execute cmp"
                    cmp -s "$efi_source_file" "$efi_target_file" && fallback_is_same=true
                fi
                break
            fi
        fi
    done

Some is there with mounting the ESP somehow. cmp has an error with it and more or less we have -e vs -f:

  • -e FILE - True if the FILE exists and is a file, regardless of type (node, directory, socket, etc.).
  • -f FILE - True if the FILE exists and is a regular file (not a directory or device).

The cmp error indicates some spaces in the path, which I don’t see here: Passing filenames with spaces into linux functions using variables in bash script | Linux Sheet

Modified snippet with the above returns this;

$ sudo install-grub4
EFI Dir: 
/usr/bin/install-grub4: line 90: tree: command not found
EFI Dir: /efi
/efi
/usr/bin/install-grub4: line 90: tree: command not found
Source: /efi/EFI/Manjaro/grubx64.efi
/efi/EFI/OLDGRUB/grubx64.efi
/efi/EFI/Manjaro/grubx64.efi
Target: /efi/EFI/Boot/bootx64.efi
WARNING: Grub is not properly installed, system may not be bootable or other bootloader is used

I did not have tree installed.

I went ahead and added it, which resulted in

$ sudo install-grub4
EFI Dir: 
  [error opening dir]

0 directories, 0 files
EFI Dir: /efi
/efi
/efi\012/efi  [error opening dir]

0 directories, 0 files
Source: /efi/EFI/Manjaro/grubx64.efi
/efi/EFI/OLDGRUB/grubx64.efi
/efi/EFI/Manjaro/grubx64.efi
Target: /efi/EFI/Boot/bootx64.efi
WARNING: Grub is not properly installed, system may not be bootable or other bootloader is used

… I then realized that maybe the OLDGRUB directory (temporary and from an accidental install command earlier)

So I removed it.

et voila.

$ sudo install-grub4
EFI Dir: 
  [error opening dir]

0 directories, 0 files
EFI Dir: /efi
/efi
β”œβ”€β”€ $RECYCLE.BIN
β”‚   └── desktop.ini
β”œβ”€β”€ BOOT
β”‚   └── BOOT.SDI
β”œβ”€β”€ EFI
β”‚   β”œβ”€β”€ Boot
β”‚   β”‚   └── bootx64.efi
β”‚   β”œβ”€β”€ Insyde
β”‚   β”œβ”€β”€ Manjaro
β”‚   β”‚   └── grubx64.efi
β”‚   └── Microsoft
β”‚       β”œβ”€β”€ Boot
β”‚       β”‚   β”œβ”€β”€ BCD
β”‚       β”‚   β”œβ”€β”€ BCD.LOG
β”‚       β”‚   β”œβ”€β”€ BCD.LOG1
β”‚       β”‚   β”œβ”€β”€ BCD.LOG2
β”‚       β”‚   β”œβ”€β”€ bg-BG
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   └── bootmgr.efi.mui
β”‚       β”‚   β”œβ”€β”€ bootmgfw.efi
β”‚       β”‚   β”œβ”€β”€ bootmgr.efi
β”‚       β”‚   β”œβ”€β”€ BOOTSTAT.DAT
β”‚       β”‚   β”œβ”€β”€ boot.stl
β”‚       β”‚   β”œβ”€β”€ CIPolicies
β”‚       β”‚   β”‚   └── Active
β”‚       β”‚   β”‚       β”œβ”€β”€ {U-U-I-D}.cip
β”‚       β”‚   β”‚       β”œβ”€β”€ {U-U-I-D}.cip
β”‚       β”‚   β”‚       └── {U-U-I-D}.cip
β”‚       β”‚   β”œβ”€β”€ cs-CZ
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ da-DK
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ de-DE
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ el-GR
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ en-GB
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   └── bootmgr.efi.mui
β”‚       β”‚   β”œβ”€β”€ en-US
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ es-ES
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ es-MX
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   └── bootmgr.efi.mui
β”‚       β”‚   β”œβ”€β”€ et-EE
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   └── bootmgr.efi.mui
β”‚       β”‚   β”œβ”€β”€ fi-FI
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ Fonts
β”‚       β”‚   β”‚   β”œβ”€β”€ chs_boot.ttf
β”‚       β”‚   β”‚   β”œβ”€β”€ cht_boot.ttf
β”‚       β”‚   β”‚   β”œβ”€β”€ jpn_boot.ttf
β”‚       β”‚   β”‚   β”œβ”€β”€ kor_boot.ttf
β”‚       β”‚   β”‚   β”œβ”€β”€ malgun_boot.ttf
β”‚       β”‚   β”‚   β”œβ”€β”€ malgunn_boot.ttf
β”‚       β”‚   β”‚   β”œβ”€β”€ meiryo_boot.ttf
β”‚       β”‚   β”‚   β”œβ”€β”€ meiryon_boot.ttf
β”‚       β”‚   β”‚   β”œβ”€β”€ msjh_boot.ttf
β”‚       β”‚   β”‚   β”œβ”€β”€ msjhn_boot.ttf
β”‚       β”‚   β”‚   β”œβ”€β”€ msyh_boot.ttf
β”‚       β”‚   β”‚   β”œβ”€β”€ msyhn_boot.ttf
β”‚       β”‚   β”‚   β”œβ”€β”€ segmono_boot.ttf
β”‚       β”‚   β”‚   β”œβ”€β”€ segoen_slboot.ttf
β”‚       β”‚   β”‚   β”œβ”€β”€ segoe_slboot.ttf
β”‚       β”‚   β”‚   └── wgl4_boot.ttf
β”‚       β”‚   β”œβ”€β”€ fr-CA
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   └── bootmgr.efi.mui
β”‚       β”‚   β”œβ”€β”€ fr-FR
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ FveTcg_0.log
β”‚       β”‚   β”œβ”€β”€ FveTcg_1.log
β”‚       β”‚   β”œβ”€β”€ FveTcg_2.log
β”‚       β”‚   β”œβ”€β”€ hr-HR
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   └── bootmgr.efi.mui
β”‚       β”‚   β”œβ”€β”€ hu-HU
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ it-IT
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ ja-JP
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ kd_02_10df.dll
β”‚       β”‚   β”œβ”€β”€ kd_02_10ec.dll
β”‚       β”‚   β”œβ”€β”€ kd_02_1137.dll
β”‚       β”‚   β”œβ”€β”€ kd_02_14e4.dll
β”‚       β”‚   β”œβ”€β”€ kd_02_15b3.dll
β”‚       β”‚   β”œβ”€β”€ kd_02_1969.dll
β”‚       β”‚   β”œβ”€β”€ kd_02_19a2.dll
β”‚       β”‚   β”œβ”€β”€ kd_02_1af4.dll
β”‚       β”‚   β”œβ”€β”€ kd_02_8086.dll
β”‚       β”‚   β”œβ”€β”€ kd_07_1415.dll
β”‚       β”‚   β”œβ”€β”€ kd_0C_8086.dll
β”‚       β”‚   β”œβ”€β”€ kdnet_uart16550.dll
β”‚       β”‚   β”œβ”€β”€ kdstub.dll
β”‚       β”‚   β”œβ”€β”€ ko-KR
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ lt-LT
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   └── bootmgr.efi.mui
β”‚       β”‚   β”œβ”€β”€ lv-LV
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   └── bootmgr.efi.mui
β”‚       β”‚   β”œβ”€β”€ memtest.efi
β”‚       β”‚   β”œβ”€β”€ nb-NO
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ nl-NL
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ pl-PL
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ pt-BR
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ pt-PT
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ qps-ploc
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ Resources
β”‚       β”‚   β”‚   β”œβ”€β”€ bootres.dll
β”‚       β”‚   β”‚   └── en-US
β”‚       β”‚   β”‚       └── bootres.dll.mui
β”‚       β”‚   β”œβ”€β”€ ro-RO
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   └── bootmgr.efi.mui
β”‚       β”‚   β”œβ”€β”€ ru-RU
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ sk-SK
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   └── bootmgr.efi.mui
β”‚       β”‚   β”œβ”€β”€ sl-SI
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   └── bootmgr.efi.mui
β”‚       β”‚   β”œβ”€β”€ sr-Latn-RS
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   └── bootmgr.efi.mui
β”‚       β”‚   β”œβ”€β”€ sv-SE
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ tr-TR
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   β”œβ”€β”€ uk-UA
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   └── bootmgr.efi.mui
β”‚       β”‚   β”œβ”€β”€ winsipolicy.p7b
β”‚       β”‚   β”œβ”€β”€ zh-CN
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚   β”‚   β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚   β”‚   └── memtest.efi.mui
β”‚       β”‚   └── zh-TW
β”‚       β”‚       β”œβ”€β”€ bootmgfw.efi.mui
β”‚       β”‚       β”œβ”€β”€ bootmgr.efi.mui
β”‚       β”‚       └── memtest.efi.mui
β”‚       └── Recovery
β”‚           β”œβ”€β”€ BCD
β”‚           β”œβ”€β”€ BCD.LOG
β”‚           β”œβ”€β”€ BCD.LOG1
β”‚           └── BCD.LOG2
└── System Volume Information
    β”œβ”€β”€ IndexerVolumeGuid
    └── WPSettings.dat

52 directories, 150 files
Source: /efi/EFI/Manjaro/grubx64.efi
Target: /efi/EFI/Boot/bootx64.efi
Execute cmp
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-linux-amd-znver3
Found initrd image: /boot/amd-ucode.img /boot/initramfs-linux-amd-znver3.img
Found initrd fallback image: /boot/initramfs-linux-amd-znver3-fallback.img
Found linux image: /boot/vmlinuz-6.1-x86_64
Found initrd image: /boot/amd-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 ...
Found memtest86+ EFI image: /boot/memtest86+/memtest.efi
/usr/bin/grub-probe: warning: unknown device type nvme0n1.
Adding reboot option.
Adding poweroff option.
done

Now we get somewhere. Let me try some. Seems you have more than one grubx64.efi file. So we have to find the proper one.

Sorry, I added a bit.

Can you check if this fixes it:

    for path in /boot /efi; do
        if [[ -e $path ]]; then
            efi_directory="$(find $path -name $efi_grub_file | awk -F '/EFI' '{print $1}')"
            if [[ ! -z "$efi_directory" ]]; then
                efi_source_file="$efi_directory/EFI/$bootloader_id/$efi_grub_file"
                efi_target_file="$(find $path -name $efi_boot_file)"
                if [[ -e "$efi_source_file" ]] && [[ -e "$efi_target_file" ]]; then
                    cmp -s "$efi_source_file" "$efi_target_file" && fallback_is_same=true
                fi
                break
            fi
        fi
    done

We need to make the efi_grub_file specific but still search for the backup file

Looks promising then

$ sudo install-grub4
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-linux-amd-znver3
Found initrd image: /boot/amd-ucode.img /boot/initramfs-linux-amd-znver3.img
Found initrd fallback image: /boot/initramfs-linux-amd-znver3-fallback.img
Found linux image: /boot/vmlinuz-6.1-x86_64
Found initrd image: /boot/amd-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 ...
Found memtest86+ EFI image: /boot/memtest86+/memtest.efi
/usr/bin/grub-probe: warning: unknown device type nvme0n1.
Adding reboot option.
Adding poweroff option.
done

I just created an OLDGRUB folder with some grub file in it and failed. Have to debug more.

it will find both files and errors out. We need to specify the folder of the wanted only:

sudo sh ./install-grub
EFI_DIR: !/boot/efi/EFI/Manjaro/grubx64.efi
/boot/efi/EFI/OLDGRUB/grubx64.efi!
Source: !/boot/efi/EFI/Manjaro/grubx64.efi
/boot/efi/EFI/OLDGRUB/grubx64.efi/EFI/Manjaro/grubx64.efi!
Target: !/boot/efi/EFI/boot/bootx64.efi!
WARNING: Grub is not properly installed, system may not be bootable or other bootloader is used

Hmm, seems this warning has something to do with adding the memtest option to the grub menu and it is fine to ignore. Can be ignored or β€œsolved” by uninstalling memtest packages or getting rid of /etc/grub.d/60_memtest86+.

If I read those checks properly, this only results in a warning, and proceeds to overwrite an existing boot file in the fallback location, regardless. It’s something, I suppose; and I appreciate the complication involved in trying to achieve much more than that.

Perhaps something could be added to the relevant Wiki pages for the sake of those who actually read them. For those who don’t, the forthcoming BSOD might be a consideration. Only half-joking.

With respect rEFInd, reinstalling usually resolves the scenario previously mentioned. Even if it has been previously relocated to the fallback location, rEFInd successfully checks for, and remedies the situation by replacing the fallback Grub boot file.

No it doesn’t. We have this check in place now:

            efi_source_file="$efi_directory/EFI/$bootloader_id/$efi_grub_file"
            efi_target_file="$(find $path -name $efi_boot_file)"
            if [[ -e "$efi_source_file" ]] && [[ -e "$efi_target_file" ]]; then
                cmp -s "$efi_source_file" "$efi_target_file" && fallback_is_same=true
            fi

And it only overwrites when conditions are made:

if [[ "$grub_type" == "EFI" ]] && [[ -e "$efi_source_file" ]] && [[ -e "$efi_target_file" ]] \
     && [[ "$fallback_is_same" == "true" ]] && [[ "$failed_update" == "false" ]]; then
    echo "Update UEFI Fallback file: $efi_source_file"
    cp "$efi_source_file" "$efi_target_file"
fi
1 Like

I stand corrected. Looks good.

Its only an informational warning, many users with similar setups have been observing and ignoring that output for some years or so.

I dont have the non-efi version of memtest installed, only memtest86+-efi.

Though you do remind me maybe I will replace the provided file with one that works a bit better and add a line to NoExtract.

Is memtest86-efi from the AUR the one you would use?

No, I meant writing my own file instead of 60_memtest86+ provided by the memtest86+-efi package (while still using that package).

1 Like

What if the user accidently formated the boot partition (or accidently removed the files somehow, it’s known to happen) and want to reinstall.

Would that work then?

What if you also check the fstab where the mount target is supposed to be?

I do not think the purpose of this project should be to cover all scenarios, including a very broken system without ESP, kernel, and so on. It should be a hook at grub update, then assuming a working system detecting where the bootloader is and updating it or throwing an error as is now.

1 Like

I thought that was exactly what it was supposed to be, because experienced users knows where the stuff is anyway and most likely wont use this.
If not, you are correct.

Since it involves other distros in the checking, I would assume it could be a great feature if it also checks fstab.

How will it handle a live environment?
If you chroot, and the boot is for some reason not getting mounted correctly/not there, what would happen?
A fstab check would fix that, at least the path. Assuming the fstab is not the REASON for the fail, but then find might figure it out instead.
IDK, I feel like it could be done if done cleverly.

cat /etc/fstab | grep 'boot' | awk '{print $2}'

Edit
Wait, that won’t work with cscs setup, hmmm.
But then again the find would fix it in that case…
I feel the idea is there, execution, not so much. :slight_smile:

I feel this is a better option: