You are not logged in.

#1 2023-01-08 12:39:47

kayegui
Member
Registered: 2022-12-20
Posts: 17

Could not prepare Boot variable?

Hello Friends!

I'm following the steps in:

https://wiki.archlinux.org/title/installation_guide

and I'm stuck in section 3.8 Boot loader

[root@archiso /]# grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
Installing for x86_64-efi platform.
Could not prepare Boot variable: No space left on device
grub-install: error: efibootmgr failed to register the boot entry: Input/output error.
[root@archiso /]#

1. I did NOT manually create a folder named "GRUB" before executing the command above. Should I have created it first?

2. The laptop is currently dual booting two linux distros already. I want to add archlinux and make it a triple boot.  The hard drive already has an EFI partition, but after failing to install archlinux repeatedly, I proceeded to make the EFI partition a 300MB partition as archwiki recommends, and wiped the partition completely and formatted it as fat32.
Apparently this still did not fix the problem.

Thank you for your time!

Offline

#2 2023-01-08 12:57:38

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 18,288

Re: Could not prepare Boot variable?

This is failure to add nvram entries to your mainboard not inherently related to diskspace.

This can be normal if your nvram entry space is limited and you'd either need to remove an existing one or just use a grub of one of your existing systems to boot Arch. Which is what I would do in that case

Offline

#3 2023-01-08 13:36:11

kayegui
Member
Registered: 2022-12-20
Posts: 17

Re: Could not prepare Boot variable?

V1del wrote:

This is failure to add nvram entries to your mainboard not inherently related to diskspace.

This can be normal if your nvram entry space is limited and you'd either need to remove an existing one or just use a grub of one of your existing systems to boot Arch. Which is what I would do in that case

But just for the sake of education, what if I decide to use Arch as my only linux distro? Or I really want to use the GRUB that I installed while installing Arch, instead of using the GRUB of one of my existing systems.  Is the nvram thing too difficult to do?

Offline

#4 2023-01-08 13:53:12

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 6,873
Website

Re: Could not prepare Boot variable?

kayegui wrote:

Is the nvram thing too difficult to do?

No.

Offline

#5 2023-01-08 14:57:23

kayegui
Member
Registered: 2022-12-20
Posts: 17

Re: Could not prepare Boot variable?

Head_on_a_Stick wrote:
kayegui wrote:

Is the nvram thing too difficult to do?

No.

When  I ran efibootmgr, there was only one entry, looked like something to do with Windows.

So I did the ff

efibootmgr -b 0 -B

When I ran efibootmgr again, the entry was gone, but i still get the same error when i tried to install grub:

Could not prepare Boot variable: No space left on device
grub-install: error: efibootmgr failed to register the boot entry: Input/output error.

Offline

#6 2023-01-08 15:47:44

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 6,873
Website

Offline

#7 2023-01-08 19:37:59

kayegui
Member
Registered: 2022-12-20
Posts: 17

Re: Could not prepare Boot variable?

Hey, this seemed to work:

grub-install --target=x86_64-efi --efi-directory=/boot --removable

It said it finished without errors.

However, when I tried to boot, I get a grub command prompt.

I don't know what it means; I was expecting a normal grub menu where I can see the Archlinux entry and I can select it and hit Enter and I would be able to log into Archlinux.

I wonder if the solution can be found here:

https://bbs.archlinux.org/viewtopic.php?id=276759

Offline

#8 2023-01-08 19:43:36

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 6,873
Website

Re: Could not prepare Boot variable?

If you see the 'grub>' prompt then that means that either GRUB cannot find grub.cfg or that grub.cfg has no menuentries. Use the 'set' command from the 'grub>' prompt to see where it is looking for grub.cfg.

EDIT: also double-check with the efibootmgr command to make sure no menuentries are active in the bootorder. Some UEFI firmwares can re-create old NVRAM entries. My ThinkPad P14s does this and it is infuriating sometimes.

Last edited by Head_on_a_Stick (2023-01-08 19:44:54)

Offline

#9 2023-01-09 08:55:13

kayegui
Member
Registered: 2022-12-20
Posts: 17

Re: Could not prepare Boot variable?

Head_on_a_Stick wrote:

If you see the 'grub>' prompt then that means that either GRUB cannot find grub.cfg or that grub.cfg has no menuentries. Use the 'set' command from the 'grub>' prompt to see where it is looking for grub.cfg.

EDIT: also double-check with the efibootmgr command to make sure no menuentries are active in the bootorder. Some UEFI firmwares can re-create old NVRAM entries. My ThinkPad P14s does this and it is infuriating sometimes.


I logged into my other linux system, used terminal to navigate to the root of the intended archlinux system (mine is /media/archlinux), and did this:

sudo find . -type f -iname "*grub.cfg*"

Nothing.

I browsed thru a GUI file manager and found no grub.cfg either.

So I booted the archlinux live usb, mounted the intended archlinux partition onto /mnt, and also mounted the efi partition onto /mnt/boot, then did this:

arch-chroot /mnt

then tried this again:

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

but same result as before.

I boot my other existing linux distro and saw that the /boot directory of the archlinux partition is still empty.

Also, when I try boot the archlinux that is supposed to be in the hard drive already, at the grub prompt I run "set".  It was a long list and I don't know how to pause it so I had to video it with my phone and pause it. 

The first two lines are:

grub> set
?='0'
cmdpath='(hd0,gpt3)/EFI/BOOT'

There is no /EFI/BOOT directory in my archlinux partition.

Thank you

Offline

#10 2023-01-09 13:50:17

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 18,288

Re: Could not prepare Boot variable?

You need to generate your config with

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

after having mounted the / and /boot parititons and chrooting in. Note that if your setup indeed does not allow you to add NVRAM entries and none of your other distributions did so, you will have now overwritten the bootloader of whatever other distribution you last had on there.

If this is your modus operandi, you probably should pick one GRUB and use that to generate the bootable entries for all others.


Some other notes that you seem to be confused about that are important to understand how mounting works:

The /boot directory of your Archlinux partition is expected to be empty, as you never write anything there if you mount your ESP to /boot all things that are written there will land on the root of your ESP partition. If you mount a partition somewhere the path you mounted it under of your "host" file system is expected to be empty. All of this is completely normal. The hd0,gpt3 you see in the prompt you screenshotted is simply that, harddisk 0 partition 3 - which is your ESP - and on that you are booting the fallback path of /BOOT/EFI/BOOTx64.efi

Last edited by V1del (2023-01-09 13:56:51)

Offline

#11 2023-01-10 13:58:50

kayegui
Member
Registered: 2022-12-20
Posts: 17

Re: Could not prepare Boot variable?

V1del wrote:

The /boot directory of your Archlinux partition is expected to be empty, as you never write anything there if you mount your ESP to /boot all things that are written there will land on the root of your ESP partition. If you mount a partition somewhere the path you mounted it under of your "host" file system is expected to be empty. All of this is completely normal. The hd0,gpt3 you see in the prompt you screenshotted is simply that, harddisk 0 partition 3 - which is your ESP - and on that you are booting the fallback path of /BOOT/EFI/BOOTx64.efi

Much appreciated.  Let me take a few steps back.

I messed up my ESP so I repaired it with another distro's live usb.  I now have a fresh, working ESP.

At the root of this ESP is only one folder named EFI.

Inside this EFI folder, there are 3 subfolders:

Let's call the first folder linuxdistro_01
Let's call the second folder linuxdistro_02
The third folder is actually named BOOT, in which there is only one file named BOOTX64.EFI

Given the above, as well as the following guidelines:

In https://wiki.archlinux.org/title/GRUB , the "esp" in the grub-install command is supposed to be the mount point.
In https://wiki.archlinux.org/title/EFI_sy … _partition , "/boot" is the most straightforward method of mounting the ESP.

My question now is, Do I still use this to install GRUB for my archlinux system? (Assuming I want my archlinux grub to overwrite (if that's possible) the other grub that's currently working.)

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

Or do I use this:

grub-install --target=x86_64-efi --efi-directory=/boot --removable

Side note: I wonder if archlinux has any installation issues with old laptops.  I found out that my laptop can't handle any Windows version later than Windows 7.  I cannot install Windows 8 and above in this 13 year old laptop.  I learned that it is a hardware issue.  Other people have pointed this out to me.

Offline

#12 2023-01-10 14:18:47

d.ALT
Member
Registered: 2019-05-10
Posts: 577

Re: Could not prepare Boot variable?

kayegui wrote:

13 year old laptop.  I learned that it is a hardware issue.  Other people have pointed this out to me.

From all of your posts, seems the UEFI's Firmware is successfully loading GRUB's .efi executable.
But... Are we absolutely sure you're booting the machine in UEFI mode?
Please boot the ArchISO and post here outputs from the Live environment (NO chroot):

# ls -la /sys/firmware/efi/efivars

and

# efibootmgr -v

Also, have you enabled some sort of CSM options in your Firmware's Settings?


<49,17,III,I>    Fama di loro il mondo esser non lassa;
<50,17,III,I>    misericordia e giustizia li sdegna:
<51,17,III,I>    non ragioniam di lor, ma guarda e passa.

Offline

#13 2023-01-11 14:32:20

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 18,288

Re: Could not prepare Boot variable?

kayegui wrote:

Given the above, as well as the following guidelines:

In https://wiki.archlinux.org/title/GRUB , the "esp" in the grub-install command is supposed to be the mount point.
In https://wiki.archlinux.org/title/EFI_sy … _partition , "/boot" is the most straightforward method of mounting the ESP.

My question now is, Do I still use this to install GRUB for my archlinux system? (Assuming I want my archlinux grub to overwrite (if that's possible) the other grub that's currently working.)

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

Or do I use this:

grub-install --target=x86_64-efi --efi-directory=/boot --removable

Side note: I wonder if archlinux has any installation issues with old laptops.  I found out that my laptop can't handle any Windows version later than Windows 7.  I cannot install Windows 8 and above in this 13 year old laptop.  I learned that it is a hardware issue.  Other people have pointed this out to me.

The first variant will setup an NVRAM entry in your mainboards firmware named GRUB and install GRUB under esp/${bootloader-id}/grubx64.efi

The second variant will not create a NVRAM entry and instead put the bootloader to esp/BOOT/BOOTX64.EFI (overwriting whatever's been there previously) which is the fallback path that every EFI firmware must be able to boot no matter how broken their EFI implementation is otherwise.

How well the first approach works can be very dependant on your mainboard/lapto/firmware so if you have a laptop that doesn't implement EFI properly (... to the point of not being able to installl the EFI only Windows versions) then chances that there are issues with the first approach are high and it might just have very preliminary UEFI support that at least manages to boot the fallback path... or as theorized by d.ALT you might not even be booting in EFI mode in which case the entire discussion would be moot anyway (but seeing as you did get to a prompt that seemed to be loading from there I'd say it might still be possible.

Last edited by V1del (2023-01-11 14:34:09)

Offline

#14 2023-01-14 06:49:34

kayegui
Member
Registered: 2022-12-20
Posts: 17

Re: Could not prepare Boot variable?

d.ALT wrote:

Are we absolutely sure you're booting the machine in UEFI mode?
Please boot the ArchISO and post here outputs from the Live environment (NO chroot):

# ls -la /sys/firmware/efi/efivars

and

# efibootmgr -v

Also, have you enabled some sort of CSM options in your Firmware's Settings?

Hello! Sorry I was busy.

These are some of the settings in my BIOS, including their description.

Legacy OS Boot
Enabled or Disabled.
Select Enabled to attempt Legacy OS Boot only.
Select Disabled to attempt EFI Boot first, Legacy OS Boot Second.

This was Disabled when I booted the archlinux live USB.


Legacy USB Support
Enabled or Disabled.
Enable support for Legacy Universal Serial Bus

This was Enabled when I booted the archlinux live USB.


Large Disk Access Mode
DOS or Other
UNIX, Novell NetWare, or other operating systems, select 'Other'.  If you are installing new software and the drive fails, change this selection and try again. Different operating systems require different representations of drive geometries.

'Other' was selected when I booted the archlinux live USB.

So to answer your question, I think(?) I'm booting the machine in UEFI mode.
And I don't think I have enabled some sort of CSM options.

I will post later the outputs from
ls -la /sys/firmware/efi/efivars
and
efibootmgr -v

Offline

#15 2023-01-14 15:29:26

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 6,873
Website

Re: Could not prepare Boot variable?

We don't need to see the content of /sys/firmware/efi/efivars — the mere existence of /sys/firmware/efi/ indicates that the system is booted in UEFI mode.

Offline

#16 2023-01-16 00:20:06

kayegui
Member
Registered: 2022-12-20
Posts: 17

Re: Could not prepare Boot variable?

Noted. Here's the output anyway.

This is when I boot the archlinux live USB in UEFI mode.

For the "ls -la /sys/firmware/efi/efivars" , I got

AcpiGlobalVariable-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ConInDev-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ConOutDev-xxxxxxxxxxxxxxxxxxxxxxxxxxxx
DXELISTs-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ErrOutDev-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
LangCodes-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Lang-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
MSRVariable-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
PBRDevicePath-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
PchInit-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
PsmAcpi-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SmmS3NvsData-xxxxxxxxxxxxxxxxxxxxxxxxxx
Timeout-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
UnlockIDCopy-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

The x's are just a bunch of letters and numbers.

Output of "efibootmgr -v" :

Timeout: 10 seconds
No BootOrder is set; firmware will attempt recovery


This is when I boot the archlinux live USB in "Legacy OS Boot" mode.

Output of "ls -la /sys/firmware/efi/efivars"

ls: cannot access '/sys/firmware/efi/efivars': No such file or directory

Output of "efibootmgr -v" :

EFI variables are not supported on this system.
error trace:

I'm starting to think this could be a hardware issue. But anyway,

1. I wonder if the archlinux live USB should've been created with GPT partition, as the target hard drive is also GPT.  Does it matter? The live USB currently has MBR (msdos) partition scheme.

2. I'm going to find some newer desktop computers with GPT hard drives and try my luck there.

3. By the way, this laptop that I'm having issues with, it's EFI, not UEFI.  I know there's a difference.  I don't see the word "UEFI" anywhere in bios, just EFI.  I wonder if that's a problem.

Thank you for your time.

Last edited by kayegui (2023-01-16 00:28:26)

Offline

#17 2023-01-16 07:29:38

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 6,873
Website

Re: Could not prepare Boot variable?

kayegui wrote:

Output of "efibootmgr -v" :

Timeout: 10 seconds
No BootOrder is set; firmware will attempt recovery

No NVRAM boot entries at all?

Try https://wiki.archlinux.org/title/GRUB#D … _boot_path, that should get Arch booting without needing any boot entries.

kayegui wrote:

This is when I boot the archlinux live USB in "Legacy OS Boot" mode.

Output of "ls -la /sys/firmware/efi/efivars"

ls: cannot access '/sys/firmware/efi/efivars': No such file or directory

Output of "efibootmgr -v" :

EFI variables are not supported on this system.
error trace:

I'm starting to think this could be a hardware issue. But anyway,

That is entirely expected.

kayegui wrote:

1. I wonder if the archlinux live USB should've been created with GPT partition, as the target hard drive is also GPT.  Does it matter? The live USB currently has MBR (msdos) partition scheme.

The Arch live ISO uses a "hybrid" partition table, it is not MS-DOS. You cannot change the partition table on the ISO, nor should you attempt to.

Reference: https://unix.stackexchange.com/question … -iso-image

kayegui wrote:

3. By the way, this laptop that I'm having issues with, it's EFI, not UEFI.  I know there's a difference.  I don't see the word "UEFI" anywhere in bios, just EFI.  I wonder if that's a problem.

Both terms mean the same thing.

Offline

#18 2023-01-18 19:24:24

kayegui
Member
Registered: 2022-12-20
Posts: 17

Re: Could not prepare Boot variable?

Head_on_a_Stick wrote:
kayegui wrote:

Output of "efibootmgr -v" :

Timeout: 10 seconds
No BootOrder is set; firmware will attempt recovery

No NVRAM boot entries at all?

Try https://wiki.archlinux.org/title/GRUB#D … _boot_path, that should get Arch booting without needing any boot entries.

Thank you but I think I've already tried that. Please see post #7.

I looked like it worked, but I just got the GRUB prompt when booting.

Or am I doing it wrong?

This was my actual syntax:

grub-install --target=x86_64-efi --efi-directory=/boot --removable

Offline

#19 2023-01-18 19:43:57

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 18,288

Re: Could not prepare Boot variable?

Did you generate the config with

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

after, as mentioned in post #10?

Offline

Board footer

Powered by FluxBB