You are not logged in.

#1 2022-09-24 11:52:08

quietcornerlinux
Member
Registered: 2022-06-08
Posts: 22

Fixing grub bootloader [SOLVED]

My grub installation is broken. I watched the following video and somehow things went sour. I am using the latest arch iso on a USB stick.

https://youtu.be/JL13boN-wSw

https://wiki.archlinux.org/title/GRUB#Installation

$ lsblk

$ mount /dev/nvme0n1p2 /mnt
$ mount /dev/nvme0n1p1 /mnt/boot
$ arch-chroot /mnt
$ pacman -S grub
$ grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB --boot-directory=/mnt/boot
EFI variables are not supported on this system.
EFI variables are not supported on this system.
grub-install: error: efibootmgr failed to register the boot entry: no such file or directory.

Any ideas? Any help would be appreciated.

Last edited by quietcornerlinux (2022-10-14 13:26:23)

Offline

#2 2022-09-24 11:57:42

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,792

Re: Fixing grub bootloader [SOLVED]

1. Forget about videos
2. You didn't boot this system with UEFI
3. You chrooted, so /mnt/boot is obviously incorrect for --boot-directory

Last edited by Scimmia (2022-09-24 11:58:19)

Offline

#3 2022-09-24 12:01:44

quietcornerlinux
Member
Registered: 2022-06-08
Posts: 22

Re: Fixing grub bootloader [SOLVED]

Scimmia wrote:

1. Forget about videos
2. You didn't boot this system with UEFI
3. You chrooted, so /mnt/boot is obviously incorrect for --boot-directory

Your comment is rude and provides no path towards a solution.

Offline

#4 2022-09-24 12:09:01

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,792

Re: Fixing grub bootloader [SOLVED]

Then you didn't bother reading it.

Offline

#5 2022-09-24 15:03:42

Lone_Wolf
Forum Moderator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,363

Re: Fixing grub bootloader [SOLVED]

Scimmia's point #2 and #3 describe exactly why your grub-install command failed.

I suggest you don't use 3rd party videos/tutorials/blogs etc to install archlinux but follow https://wiki.archlinux.org/title/Installation_guide instead.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building to complicated ?
Try clean chroot manager by graysky

Online

#6 2022-09-25 07:49:34

VoDo
Member
From: Europe
Registered: 2020-06-04
Posts: 122

Re: Fixing grub bootloader [SOLVED]

Try this
1. Load Arch ISO
2. mount /dev/sda2 /mnt (sda2 is where I have root)
3. mount /dev/sda1 /mnt/boot (I do not use /mnt/boot/efi)
4. arch-chroot /mnt
5. pacman -S grub efibootmgr os-prober (you do not need os-prober if you do not have dualboot)
6. grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub
7. grub-mkconfig -o /boot/grub/grub.cfg
8. reboot


Archi3

Offline

#7 2022-09-25 09:09:00

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,861
Website

Re: Fixing grub bootloader [SOLVED]

VoDo wrote:

3. mount /dev/sda1 /mnt/boot (I do not use /mnt/boot/efi)
[...]
6. grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub

If you "do not use /mnt/boot/efi" then why do you suggest providing GRUB with an incorrect path to the ESP? hmm

This is why spoon-feeding can be a bad idea...


Juri divino omnia sunt communia

Offline

#8 2022-09-28 00:35:10

Sharfus
Member
Registered: 2020-05-26
Posts: 1

Re: Fixing grub bootloader [SOLVED]

This whole series of questions and answers shows the different understandings and MISunderstandings of what chroot does.  Once you chroot into the system /mnt becomes the new / (root directory) of the system being installed and IS NO LONGER USED in the paths for software installation commands.  What would be /mnt/boot/efi as a path in the host system is now /boot/efi in the chrooted sub system.  And THAT is why the command failed and why the commands posted by VoDo and the others were correct. 
Pre-chroot
   /mnt/path-desired
   chroot
Post-chroot
   /path-desired

Sharfus

Offline

#9 2022-10-02 00:33:03

blackfootsec
Member
Registered: 2022-09-27
Posts: 1

Re: Fixing grub bootloader [SOLVED]

I tried
https://wiki.archlinux.org/title/installation_guide
then
https://itsfoss.com/install-arch-linux/

Building ARCH exactly as both pages instructed, and neither boots to UEFI. The Arch Wiki had me mount the SDA1 UEFI partition to /mnt/boot and FOSS instructed to mount the partition at /boot/efi and neither method install the boot loader. Whats more, the Arch Wiki never has you install GRUB. I can boot into my USB and switch to arch-chroot /mnt and see all the files I installed, using VIM and other CLI tools successfully with no joy on the boot. I'm at a loss, what am I doing wrong?

Offline

#10 2022-10-02 02:03:50

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,003

Re: Fixing grub bootloader [SOLVED]

blackfootsec wrote:

I tried
https://wiki.archlinux.org/title/installation_guide
then
https://itsfoss.com/install-arch-linux/

Building ARCH exactly as both pages instructed, and neither boots to UEFI. The Arch Wiki had me mount the SDA1 UEFI partition to /mnt/boot and FOSS instructed to mount the partition at /boot/efi

Really? Where?

and neither method install the boot loader.

Could not care less what itsfoss may or may not have to say

Whats more, the Arch Wiki never has you install GRUB.

That's good, I don't use GRUB -- or any other bootloader  I use EFISTUB, why would I want GRUB?  Good thing the installation guide refers you to an article on boot loaders, eh?

Last edited by ewaller (2022-10-02 02:04:47)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#11 2022-10-14 06:12:13

quietcornerlinux
Member
Registered: 2022-06-08
Posts: 22

Re: Fixing grub bootloader [SOLVED]

I purchased the arch iso on a USB stick from a store online. It did not include UEFI support. I am assuming it was not the official arch iso. I fired up my iMac and burned the official iso. Entries for USB and USB UEFI appeared within the motherboard firmware. I then had the issue of my nvme disk not being recognized. Previously, this would happen randomly. A reboot would resolve it, all but this time. Poor timing. I removed the disk and reinserted it. It seems to be recognized every time now. With those two issues out of the way, I plugged away at my boot loader issue.

$ lsblk

$ mount /dev/nvme0n1p2 /mnt
$ mount /dev/nvme0n1p1 /mnt/boot
$ arch-chroot /mnt
$ pacman -S grub
$ grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB --boot-directory=/mnt/boot /dev/nvme0n1
Installing for x86_64-efi platform.
Installation finished. No error reported.
$ grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be executed to detect bootable binaries on them and create new boot entries.
grub-probe: error: cannot find a GRUB drive for /dev/sdc1. Check your device.map.
Adding boot menu entry for UEFI Firmware Settings ...
done

This would still yield entry to the Grub Rescue Menu. I could not find where or why it was looking for a GRUB drive on sdc1, or a device.map file. Uninstalling and reinstalling grub did not yield any change. I decided to switch to systemd-boot.

$ bootctl install
$ nano /boot/loader/loader.conf
timeout 3
default arch
console-mode max
editor no
$ nano /boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
echo "options root=PARTUUID=$(blkid -s PARTUUID -o value /dev/nvme0n1p2) rw" >>/boot/loader/entries/arch.conf

Booting into Linux Boot Manager just reboots to firmware.

$ bootctl status
Status System:
Firmware: n/a (n/a)
Secure Boot: disabled (setup)
TPMZ Support: yes
Boot into FW: supported

Current Boot Loader:
Product: n/a
Features:
  Boot counting
  Menu timeout control
  One-shot menu timeout control
  Default entry control
  One-shot entry control
  Support for XBOOTLDR partition
  Support for passing random seed to Os
  Load drop-in drivers
  Bootloader sets ESP information
ESP: n/a
File: n/a

Random Seed:
Passed to OS: no
System Token: set
Exists: yes

Available Boot Loaders on ESP:
ESP: /boot (/dev/disk/by-partuu id/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
File: ”EFI/systend/systend-bootx64.efi (systend-boot 251.4-1-arch)
File: EFI/BOOT/bootx64.efi (systend-boot 251.4-1-arch)

Boot Loaders Listed in EFI Variables:
Title: Linux Boot Manager
ID: 0x0001
Status: active, boot-order
Partition: /dev/disk/by-partuuid/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
File: L/EFI/SYSTEMD SYSTEMD-BOOTX64.EFI

Title: GRUB
ID: 0x0000 Status: active, boot-order
Partition: /dev/disk/by-partuuid/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
File: /EFI/GRUB/GRUBX64.EFI

Title: UEFI OS
ID: 0x0005 Status: active, boot-order
Partition: /dev/disk/by-partuuid/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
File: /EFI/BOOT/BOOTX64.EFI

Boot Loader Entries:
$BOOT: boot (/dev/disk/by-partuuid/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)

Default Boot Loader Entry:
type: Boot Loader Specification Type #1 (.conf)
title: Arch Linux
id: arch.conf
source: /boot/loader/entries/arch.conf
linux: umlinuz-11nux (No such file or directory)
initrd: Zinitranfs-linux. Ima CNo such file or directoru)
options: root=PARTUUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx rw
WARNING: default boot entry is broken

We have a few boot loaders that we no longer need, as well as a broken systemd-boot due to missing files.

$ efibootmgr
BootCurrent: 0007
Timeout: 1 seconds
BootOrder: 0001,0000,0005,0007,0008,0006,0009,0003,0004
Boot0000* GRUB HD (1,GPT,xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,0x1000,0x96000)/File(\EFI\GRUB\GRUBX64.EFI)
Boot0001* Linux Boot Manager HD(1,GPT,xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)/File(\EFI\SYSTEMD\SYSTEMD-BOOTX64. EFI)
Boot0003 MKNSSDRE256GB BBS(HD,,0x0)0000424f
Boot0004 MKNSSDSR250GB BBS (HD,,0x0)0000424f
Boot0005* UEFI OS HD (1,GPT,xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,0x1000,0x96000)/File(\EFI\BOOT\BOOTX64.EFI)0000424f
Boot0006* CT1000P5SSDS BBS (HD,,0x0)0000424f
Boot0007* UEFI: USB PciRoot (0x0)/Pci(0x1,0x3)/Pci(0x0,0x0)/USB(2,0)/CDROM(1,0x185800,0x1e000)0000424f
Boot0008 UEFI: USB, Partition 2 PciRoot(0x0)/Pci(0x1,0x3)/Pci(0x0,0x0)/USB(2,0)/HD(2,MBR,0x801254ad,0x185800,0x7800)0000424f
Boot0009* USB BBS (HD,0x0)0000424f

I know I don't need entries for GRUB and UEFI OS.

$ efibootmgr -b 0 -B && efibootmgr -b 5 -B

Reinstalling the linux kernel resolved the missing files.

$ pacman -S linux
$ bootctl status # confirm ok

I removed GRUB.

pacman -Rcnsu grub

All is well with the cosmos. I installed systemd-boot-pacman-hook from AUR to keep systemd-boot up to date.

Last edited by quietcornerlinux (2022-10-14 13:27:56)

Offline

#12 2022-10-14 10:32:06

u666sa
Member
Registered: 2020-08-01
Posts: 69

Re: Fixing grub bootloader [SOLVED]

quietcornerlinux wrote:

```
$ lsblk

$ mount /dev/nvme0n1p2 /mnt
$ mount /dev/nvme0n1p1 /mnt/boot
$ arch-chroot /mnt
$ pacman -S grub
$ grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB --boot-directory=/mnt/boot
EFI variables are not supported on this system.
EFI variables are not supported on this system.
grub-install: error: efibootmgr failed to register the boot entry: no such file or directory.
```

First of all here is great installation video -- redacted

What you did wrong:

You mounted /dev/nvme0n1p1 onto /mnt/boot

It should be mounted onto /mnt/boot/EFI

Also your grub install should look differently and your chroot should look differently. You doing things wrong.

Again, here is a great article to make things easier -- redacted


Another thing. Who buys arch USB online? People these days often have internet and download arch ISO and burn it to a usb stick. Also, internet connection is required to install arch.

Mod note: Removed unsupported third party links -- V1del

Last edited by V1del (2022-10-14 11:44:28)

Offline

#13 2022-10-14 11:43:08

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 22,384

Re: Fixing grub bootloader [SOLVED]

u666sa please don't recommend unsupported third party sources. Your advice doesn't make much sense, you can totally  use /boot instead of /boot/EFI , the mistake quietcornerlinux made is passing a nonsensical --boot-directory path which should have just not been explicitly set or /boot as well.

The issue is technically solved so @quietcornerlinux please mark the topic as [SOLVED] by editing the title, and please wrap the command outputs in code tags

Offline

#14 2022-10-14 13:46:10

quietcornerlinux
Member
Registered: 2022-06-08
Posts: 22

Re: Fixing grub bootloader [SOLVED]

@u666sa I only have two computers: The one I am trying to fix; The iMac that takes ten minutes to boot. That is why I purchased a preloaded thumb drive online. I have internet access at home, obviously. I ran pacman -S.

@V1del GRUB Installation The wiki recommended using --boot-directory "from outside of the installed system". Perhaps I misunderstood?

Offline

#15 2022-10-14 14:20:53

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 22,384

Re: Fixing grub bootloader [SOLVED]

"from outside the installed system" would be the case if you were unable to chroot and needed to run grub-install directly from the live environment. Since you did chroot you are "technically" inside your installed system for all intents and purposes except the running kernel. If you checked you would see that /mnt/boot "didn't exist anymore" and would instead be mapped to /boot as you've chrooted to /mnt and all logical paths and mount points are now from that perspective

Last edited by V1del (2022-10-14 14:22:20)

Offline

#16 2024-03-11 01:26:35

Dazed_Angel
Member
Registered: 2024-03-11
Posts: 1

Re: Fixing grub bootloader [SOLVED]

found this in an ubuntu forum that for me atleast solved this issue:
its for ubuntu but it applies to arch as well
https://askubuntu.com/questions/88384/h … ng-windows

Last edited by Dazed_Angel (2024-03-11 01:27:15)

Offline

#17 2024-03-11 01:33:52

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,792

Re: Fixing grub bootloader [SOLVED]

Dazed_Angel wrote:

found this in an ubuntu forum that for me atleast solved this issue:
its for ubuntu but it applies to arch as well
https://askubuntu.com/questions/88384/h … ng-windows

Why go to askubuntu instead of just reading the Arch wiki, which covers grub installation just fine.

And necrobumping is against the rules here. Really doubt the OP is looking for answers a year and a half later.

Offline

#18 2024-03-11 02:39:24

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,003

Re: Fixing grub bootloader [SOLVED]

Closing this old thread


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB