GRUB/Restore_the_GRUB_Bootloader procedure concerns

Hallo all,

I did needed this procedure again :

Story :
Laptop : Dell 5480
OS : Linux Manjaro Cinnamon multiboot with windows 11 pro.
Problem : Bootloader gone
Cause : updating an application in windows. Which crashed itselves.
Action : Start from USB Live Manjaro Cinnamon, following the steps in the wiki page above.

Final result :
Booting takes a long time. No bootloader shows up. Manjaro Linux starts ! It works.
windows option to boot comes not available.

Using F12 for the one-time boot menu, to select what to boot : manjaro of EUFI.
Choosing EUFI : windows boots !
Choosing manjaro : Manjaro boots after a long time. I do believe it is the time specified by myself in /etc/default/grub : 580 seconds. But it boots properly !
So : No multiboot loader list showing up

Because you all want to know my logging info during proceure execution Here is it :
Somewhere the commands do not match my reality. I think I am rather good in terminal work.
So …

What went wrong ? Some if then else steps missing in the procedure ?

How to fix my boot loader ?

Thanks in advance from Hans in the Netherlands

Identify the type of system you are attempted to resque as the commands involved are slightly different.

BIOS/MBR/GPT system
EFI/GPT system

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
Load Manjaro Installation Media

Default Username	Default Password
manjaro	manjaro
root	manjaro

Make internet connection
My SSIDGuest
SSIDGuestPW

My own website manual :
www.linuxzob.nl
https://www.linuxzob.nl/wiki/doku.php?id=start
https://www.linuxzob.nl/wiki/doku.php?id=linux_manjaro:manjaro_info#manjaro_-_bootloader_repair_na_windows_upgrade

https://wiki.manjaro.org/index.php?title=GRUB/Restore_the_GRUB_Bootloader

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
Identify partitions

[manjaro@manjaro-cinnamon ~]$ lsblk -o PATH,PTTYPE,PARTTYPE,FSTYPE,PARTTYPENAME
PATH       PTTYPE PARTTYPE                             FSTYPE PARTTYPENAME
/dev/loop0                                             squash 
/dev/loop1                                             squash 
/dev/loop2                                             squash 
/dev/loop3                                             squash 
/dev/sda   gpt                                                
/dev/sda1  gpt    c12a7328-f81f-11d2-ba4b-00a0c93ec93b vfat   EFI System
/dev/sda2  gpt    e3c9e316-0b5c-4db8-817d-f92df00215ae        Microsoft reserved
/dev/sda3  gpt    ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 ntfs   Microsoft basic data
/dev/sda4  gpt    de94bba4-06d1-4d40-a16a-bfd50179d6ac ntfs   Windows recovery environment
/dev/sda5  gpt    0fc63daf-8483-4772-8e79-3d69d8477de4 ext4   Linux filesystem
/dev/sdb   dos                                         iso966 
/dev/sdb1  dos    0x0                                  iso966 Empty
/dev/sdb2  dos    0xef                                 vfat   EFI (FAT-12/16/32)



[manjaro@manjaro-cinnamon ~]$ sudo fdisk -l /dev/sda
Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: WD Blue SA510 M.
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 6442800E-EC5D-46D2-9B9F-C26A29BF8C65

Device          Start        End    Sectors   Size Type
/dev/sda1        2048     206847     204800   100M EFI System
/dev/sda2      206848     239615      32768    16M Microsoft reserved
/dev/sda3      239616 1147188131 1146948516 546.9G Microsoft basic data
/dev/sda4  1952284672 1953521663    1236992   604M Windows recovery environment
/dev/sda5  1147188133 1952284671  805096539 383.9G Linux filesystem

Partition table entries are not in disk order.


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
Identify system partitions

From the above we assume you have identified the relevant partitions on your system and this document will refer the partitions as follows. Partitions not needed for this kind of maintenance has intentionally been left out (e.g. home, swap).

Partition	Usage	Comment
/dev/sda1	EFI system	Required for EFI system and mounted on /boot/efi
/dev/sd ??	boot	Optional but mounted on /boot The primary use is when GRUB cannot write to / (eg. f2fs)
/dev/sda5	root	Required and for the root filesystem and mounted on / - usually formatted using ext4

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
[manjaro@manjaro-cinnamon ~]$ su



# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
pamac install manjaro-tools-base

[manjaro-cinnamon manjaro]# pamac install manjaro-tools-base
Synchronizing package databases...
Refreshing core.db...                                                           
Refreshing extra.db...                                                          
Refreshing multilib.db...                                                       
Preparing...                                                                    
Synchronizing package databases...
Resolving dependencies...
Checking inter-conflicts...

To upgrade (1):
  manjaro-tools-base-git  r3071.5c97abe-1  (r3045.7e49d96-1)  extra  24.5 kB

Total download size: 24.5 kB
Total installed size: 433 bytes

Apply transaction ? [y/N] Y
Waiting for another package manager to quit...
[manjaro-cinnamon manjaro]# 

[manjaro-cinnamon manjaro]# which manjaro-tools-base
which: no manjaro-tools-base in (/home/manjaro/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
[manjaro-cinnamon manjaro]# pamac install manjaro-tools-base
Preparing...
Synchronizing package databases...
Resolving dependencies...
Checking inter-conflicts...

To upgrade (1):
  manjaro-tools-base-git  r3071.5c97abe-1  (r3045.7e49d96-1)  extra  24.5 kB

Total download size: 24.5 kB
Total installed size: 433 bytes

Apply transaction ? [y/N] Y
Download of manjaro-tools-base-git (r3071.5c97abe-1) started                    
Download of manjaro-tools-base-git (r3071.5c97abe-1) finished                   
Checking keyring...                                                        [1/1]
Checking integrity...                                                      [1/1]
Loading packages files...                                                  [1/1]
Checking file conflicts...                                                 [1/1]
Checking available disk space...                                           [1/1]
Upgrading manjaro-tools-base-git (r3045.7e49d96-1 -> r3071.5c97abe-1)...   [1/1]
Transaction successfully finished.




# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 



[manjaro-cinnamon ~]# mount | grep boot
/dev/sdb on /run/miso/bootmnt type iso9660 (ro,relatime,nojoliet,check=s,map=n,blocksize=2048,iocharset=utf8)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

[manjaro-cinnamon ~]# which lsb-release
which: no lsb-release in (/root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)


[manjaro-cinnamon ~]# pamac install lsb-release
Synchronizing package databases...
Refreshing core.db...                                                                                                                             
Refreshing extra.db...                                                                                                                            
Refreshing multilib.db...                                                                                                                         
Preparing...                                                                                                                                      
Warning: lsb-release-2.0.r55.a25a4fc-1 is up to date -- skipping
Nothing to do.
Transaction successfully finished.

[manjaro-cinnamon manjaro]# pamac install lsb-release
Preparing...
Warning: lsb-release-2.0.r55.a25a4fc-1 is up to date -- skipping
Nothing to do.
Transaction successfully finished.
[manjaro-cinnamon manjaro]# 


[manjaro-cinnamon ~]# which manjaro-chroot
/usr/bin/manjaro-chroot


[manjaro-cinnamon ~]# manjaro-chroot
==> ERROR: Can't create chroot on non-directory 

[manjaro-cinnamon manjaro]# manjaro-chroot -a
grub-probe: error: cannot find a GRUB drive for /dev/sdb1.  Check your device.map.
grub-probe: error: cannot find a GRUB drive for /dev/sdb1.  Check your device.map.
==> Mounting (ManjaroLinux) [/dev/sda5]
 --> mount: [/mnt]
 --> mount: [/mnt/boot/efi]
[manjaro-cinnamon /]# 


[manjaro-cinnamon /]# mount | grep mnt
[manjaro-cinnamon /]# 


pacman -Syu grub
[manjaro-cinnamon /]# pacman -Syu grub
error: GPGME error: No data
error: GPGME error: No data
error: GPGME error: No data
:: Synchronizing package databases...
 core                                            150.7 KiB  90.4 KiB/s 00:02 [###########################################] 100%
 extra                                             9.1 MiB  3.08 MiB/s 00:03 [###########################################] 100%
 multilib                                         93.9 KiB  59.7 KiB/s 00:02 [###########################################] 100%
error: GPGME error: No data
error: GPGME error: No data
error: GPGME error: No data
error: failed to synchronize all databases (invalid or corrupted database (PGP signature))

Lees de website. Ik ga door !

Reinstall grub

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck

[manjaro-cinnamon /]# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck
Installing for x86_64-efi platform.
Installation finished. No error reported.
[manjaro-cinnamon /]# 

Update the grub configuration

grub-mkconfig -o /boot/grub/grub.cfg

[manjaro-cinnamon /]# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.12-x86_64
Found initrd image: /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs-6.12-x86_64.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.
ERROR: mkdir /var/lock/dmraid
grub-probe: error: cannot find a GRUB drive for /dev/sdb1.  Check your device.map.
grub-probe: error: cannot find a GRUB drive for /dev/sdb1.  Check your device.map.
Adding boot menu entry for UEFI Firmware Settings ...
Found memtest86+ image: /boot/memtest86+/memtest.bin
Found memtest86+ EFI image: /boot/memtest86+/memtest.efi
done
[manjaro-cinnamon /]# 

Verify the existance of an EFI system partition

lsblk -o PATH,PTTYPE,PARTTYPE,FSTYPE,PARTTYPENAME

[manjaro-cinnamon /]# lsblk -o PATH,PTTYPE,PARTTYPE,FSTYPE,PARTTYPENAME
PATH       PTTYPE PARTTYPE                             FSTYPE PARTTYPENAME
/dev/loop0                                                    
/dev/loop1                                                    
/dev/loop2                                                    
/dev/loop3                                                    
/dev/sda                                                      
/dev/sda1                                                     
/dev/sda2                                                     
/dev/sda3                                                     
/dev/sda4                                                     
/dev/sda5                                                     
/dev/sdb                                                      
/dev/sdb1                                                     
/dev/sdb2                                                     
/dev/sdc                                                      
[manjaro-cinnamon /]# 

Verify the efi filesystem is loaded

ls /sys/firmware/efi
ls -l /sys/firmware/efi

[manjaro-cinnamon /]# ls /sys/firmware/efi
config_table  efivars  esrt  fw_platform_size  fw_vendor  runtime  runtime-map  systab
[manjaro-cinnamon /]# ls -l /sys/firmware/efi
total 0
-r--r--r--  1 root root 4096 Oct 13 15:57 config_table
drwxr-xr-x  2 root root    0 Oct 13 15:34 efivars
drwxr-xr-x  3 root root    0 Oct 13 15:57 esrt
-r--r--r--  1 root root 4096 Oct 13 15:57 fw_platform_size
-r--r--r--  1 root root 4096 Oct 13 15:57 fw_vendor
-r--r--r--  1 root root 4096 Oct 13 15:57 runtime
drwxr-xr-x 13 root root    0 Oct 13 15:57 runtime-map
-r--------  1 root root 4096 Oct 13 15:57 systab


Exit chroot (en kom terug in de standaard root terminal #)
exit

Try loading the efi filesystem

[manjaro-cinnamon manjaro]# modprobe efivarfs
[manjaro-cinnamon manjaro]# 

Re-enter chroot
manjaro-chroot /mnt /bin/bash

[manjaro-cinnamon manjaro]# manjaro-chroot /mnt /bin/bash
mount: /mnt/proc: mount point does not exist.
       dmesg(1) may have more information after failed mount system call.
==> ERROR: failed to setup API filesystems in chroot /mnt
[manjaro-cinnamon manjaro]# 

Then mount the efi filesystem
mount -t efivarfs efivarfs /sys/firmware/efi/efivars

[manjaro-cinnamon manjaro]# mount -t efivarfs efivarfs /sys/firmware/efi/efivars
[manjaro-cinnamon manjaro]# 

Verify the efi filesystem is loaded
ls /sys/firmware/efi
ls -l /sys/firmware/efi

[manjaro-cinnamon manjaro]# mount -t efivarfs efivarfs /sys/firmware/efi/efivars
[manjaro-cinnamon manjaro]# ls /sys/firmware/efi
ls -l /sys/firmware/efi
config_table  efivars  esrt  fw_platform_size  fw_vendor  runtime  runtime-map  systab
total 0
-r--r--r--  1 root root 4096 Oct 13 12:57 config_table
drwxr-xr-x  2 root root    0 Oct 13 12:34 efivars
drwxr-xr-x  3 root root    0 Oct 13 12:57 esrt
-r--r--r--  1 root root 4096 Oct 13 12:57 fw_platform_size
-r--r--r--  1 root root 4096 Oct 13 12:57 fw_vendor
-r--r--r--  1 root root 4096 Oct 13 12:57 runtime
drwxr-xr-x 13 root root    0 Oct 13 12:57 runtime-map
-r--------  1 root root 4096 Oct 13 12:57 systab
[manjaro-cinnamon manjaro]# 

Deze opdracht begrijp ik niet ... ik sla m over ...
If successfull re-run above installation commands

# update grub
pacman -Syu install-grub

[manjaro-cinnamon manjaro]# pacman -Syu install-grub
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 multilib is up to date
:: Starting full system upgrade...
:: Replace gvfs-google with extra/gvfs? [Y/n] 
:: Replace libappindicator-gtk3 with extra/libappindicator? [Y/n] 
:: Replace vi with extra/ex-vi-compat? [Y/n] 
resolving dependencies...
looking for conflicting packages...
error: failed to prepare transaction (could not satisfy dependencies)
:: installing libcap (2.78-1) breaks dependency 'libcap=2.76' required by lib32-libcap
[manjaro-cinnamon manjaro]# 

Run install-grub
 install-grub

[manjaro-cinnamon manjaro]# install-grub
WARNING: Grub is not properly installed, system may not be bootable or other bootloader is used

het lijkt dat het hier niet meer goed gaat. Ik stop er toch mee.

Stick eruit. Laptop restart

Het duurt lang, maar dan  geen bootloader, en Linux Manjaro start op.

When windows crashed, you rebooted with the power button, did you? I am afraid that damaged the filesystems. The bootloader that was gone was the damage on the ESP partition.

I do not quite get it how the root of manjaro was damaged if it was not mounted? But you get errors like no gpg signatures, error updating other stuff… how else will this occur…? Missing files can explain the slow boot, if you look at the journal with journalctl -b -p3 --no-pager you will probably find a lot of errors.
Maybe i have some mistake in my hypothesis, let us wait someone else too. Check the journal in the meantime.

p.s. is OS-Prober enabled?

Theo, thank you

I am not sure about rebooting with the power button. It showed up in a black screen with some text in white. And there I do must have used the power button. Did not made a picture of the text. Since it is a touch screen, pictures making also doesn’t work well.

I have to learn using " journalctl -b -p3 --no-pager". Will give it a try soon

OS-Prober enabled ? I dont know. Sounds great. How to check ? How to do ? How to use ?

Thanks in advance from Hans in the Netherlands

Osprober is a setting in /etc/default/grub which has to be turned on in order windows to be detected and added to the boot menu of manjaro. To fix that is no problem at all, but in your log there are other things i cannot explain myself and make me think something else is at play here and causing the other problem. In theory it can be errors in the disk, or the filesystem and damaged files. Or it can be something else completely :man_shrugging:

You set GRUB_TIMEOUT to 580s (9m 36s)? Seems like massive overkill. :man_shrugging:

os-prober presumably ran (unless the mkdir /var/lock/dmraid error stopped it) but it didn’t detect Windows.

If no other OS is detected then the menu will be hidden unless you specify GRUB_TIMEOUT_STYLE=menu in /etc/default/grub. It can be unhidden with Esc (if I remember correctly, if not then try Shift or Ctrl).

I’d try running it again from the running Manjaro system, after checking Windows is properly shutdown. You might also want to check the EFI partition isn’t corrupted.

It doesn’t appear later (for the command that gave the error below), so I’m not sure this is necessary.

sudo pacman -Rns lib32-libcap

As @Teo says, there may be other damage but it’s difficult to tell with that list of commands and output.

Two settings in /etc/default/grub probably explain both symptoms. The long wait with no menu fits the 580 second timeout you mentioned, so set GRUB_TIMEOUT=5 and GRUB_TIMEOUT_STYLE=menu. The missing Windows entry usually means os-prober isn’t running, because recent GRUB versions disable it by default. Make sure it’s installed with sudo pacman -S os-prober, add or uncomment GRUB_DISABLE_OS_PROBER=false in the same file, then run sudo update-grub. The output should include a line like Found Windows Boot Manager on /dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi, and after a reboot the menu should list both systems.

As I said, it’s not disabled.

Read:

  • In a fresh installation of Manjaro, the default state of os-prober typically is enabled; GRUB_DISABLE_OS_PROBER=false is uncommented in /etc/default/grub.

Hi All, thanks so far for all response and knowledge and advises. 2 windows programs continues removing the bootloader, or by updates, or by running one of those programs, which normally operates well. But if unattended for a longer time, I do find the computer back with a black screen and a text telling me to press any button to reboot. I don’t have that any button. Could not find any key which results in progress. So I press the power button to turn off the computer. Then run the repair procedure for EFI, choose all the default settings. Reboot the computer, which starts in … Manjaro. Then I do su - root. update-grub. reboot. And the bootloader is back. This procedure is fully reproducible since I now did it 4 or 5 times. I will complain at the windows software support company’s. I will come soon with some textual improvement proposals for GRUB/Restore the GRUB Bootloader - Manjaro. To far. See you soon !

I wonder which programs in windows can affect the bootloaders and efi, besides windows update and bios update? Some disk imaging software, or partitioning software, or motherboard or overclocking tool?

The problem with windows taking over the boot is solved with making dedicated ESP partition for linux and let windows do what it wants with the original one. Is not a 100% guarantee, but at least windows update won’t be a problem anymore. A bios update will still mess the efi variables.

I wouldn’t do that as it’s too easy to forget to log out of the root account (at least it was in my case when I wanted to perform a number of operations without it timing out; a bad practice I abandoned pretty quickly).

I’d just use sudo update-grub; this is the standard procedure. :wink:

Not ideal.

The better way is to install each OS on a separate disk (not partition) – this is arguably the safest approach.

For those who have no choice – they only have one disk – then it becomes more complicated, but still manageable;

  • Install Windows first (to an empty disk)
  • During WindowsSetup, change the size of the $esp to 300 MiB (same as the Manjaro default) – or whatever size is preferred.
  • While in Windows, shrink the main partition (the new free space is where Manjaro will be installed).
  • Shutdown the computer, then boot with the Manjaro installer USB (or Ventoy) and install Manjaro using the manual partitioning method – choose the free space to install Manjaro.
    :point_right: Important: Re-use the existing $esp – make sure to assign the /boot/efi mountpoint as per convention, but do not format the $esp – otherwise the Windows bootloader will be lost.
  • From this point, os-prober should detect Windows on the same $esp. With advance knowledge, it is also possible to have the Windows bootloader display Manjaro as a boot option, but its unlikely many would actually want that.

Dell Latitude 5480 owner’s manual.pdf - Storage specifications

Feature Specification
HDD Up to 1 TB
SSD M.2 SATA /PCIe Up to 512 GB

Installing optional M.2 SSD

@BG405
Wrt using “su - root” Good warning for most. I do have a drivers license for su - root. Which I do use in the gnome terminal profile manager, having a root dedicated terminal with black text on the yellow background. This color setting is available by default. And available because of the UNIX convention by IBM and HP since the 90’s !?! For myself I have a Hans profile with nice light blue background. Use root rights with care. With or without sudo. Yes.

@nikgnomic
What is your message you want to tell ? Do I have an SSD to big for this laptop ?


In the meantime, my Dell 5480 lost it bootloader somehow again. When the pc boots, windows 11 shows up. Will have to fix it using the procedure on GRUB/Restore the GRUB Bootloader - Manjaro

The Manual chroot is not clear to me.
please advise me the commands for EFI system, boot and root

Also the bootloader of my Manjaro running Lenovo IdeaPad L340 Gaming crashed.
I will make a new post for it :
“Manjaro update on Lenovo IdeaPad L340 Gaming results in bootloader crash”.

So now I’m wondering if there is a Manjaro issue causing my bootloader repair challenges.
I already managed to 2x backup my thunderbird mail data on two external hard disks.

Wrt my textual improvement proposals on GRUB/Restore the GRUB Bootloader - Manjaro,
I will launch a new post for it soon.

Modedit: merged 3 consecutive posts
Mod Edit: Added missing @mentions

Dell Latitude 5480 owner’s manual shows that this laptop can have 2 storage drives:

Using 2 storage drives is the optimal way to run a dual boot system. Updates on a Windows OS are highly unlikely to affect a Linux OS bootloader if it is installed to a different drive

Thanks for your knowledege. I did replace the small one the the one TB one. I like to keep it that way.