You are not logged in.

#1 2020-09-02 12:50:42

micha3lbrown
Member
Registered: 2020-09-02
Posts: 7

[Solved] Grub not autoloading config file

I just completed a fresh Arch install but need some help configuring Grub.

Upon reboot I get

grub> 
grub> echo $root
(hd0,1)

I can rescue this by manually loading the config file...

grub> configfile(hd4,gpt2)/grub/grub.cfg

I have tried a few different variations of this...

grub-install --target=x86_64-efi --efi-directory=/boot/efi /dev/sde
grub-mkconfig -o /boot/grub/grub.cfg

Here is the drive layout

sde              8:64   0 447.1G  0 disk  
├─sde1           8:65   0   100M  0 part  /boot/efi
├─sde2           8:66   0   250M  0 part  /boot
└─sde3           8:67   0 446.8G  0 part  
  └─luks       254:0    0 446.8G  0 crypt 
    ├─vg0-swap 254:1    0     8G  0 lvm   [SWAP]
    └─vg0-root 254:2    0 438.8G  0 lvm   /

The last bit... I have separate drive that has windows and it's bootloader installed. If I `exit` grub> that proceeds to boot into windows just fine. Any thoughts or ideas would be greatly appreciated!

Last edited by micha3lbrown (2020-09-05 17:02:22)

Offline

#2 2020-09-03 13:43:46

Wild Penguin
Member
Registered: 2015-03-19
Posts: 319

Re: [Solved] Grub not autoloading config file

Are you sure you have booted Grub via EFI (and not Legacy boot)?

After you have booted, try:

ls /sys/firmware/efi/efivars

What is the output?

You may think you have booted Grub2 in UEFI mode but are actually booting (some old installation of Grub) in Legacy mode - and that installation is looking for the grub configuration in a totally wrong place. But trying to install grub in UEFI mode when you have actually not booted via UEFI should spit out clear errors.

Another alternative is you have generated the configuration file in the wrong place.

I've noticed you have stacked a separate boot partition (sde2 at /boot) and EFI partition (sde1 at /boot/efi). This is not necessary, and I'm not sure where grub is looking for the configuration file in this setup, but should still be a possible way to configure it. Obviously, in your case it is not loading the correct configuration file.

In any case, it should look in the directory it creates when you install grub. I.e.; remove (or, rather move away somewhere safe so you can recover more easily) all "grub" directories (look inside all of: /boot, /boot/efi, and /boot/efi/EFI!), and re-run your grub installation command. Now look for the grub installation directory (should contain subfolders like themes, locale, fonts etc.) and possibly a sample grub.cfg. Now generate your own configuration file in it's place.

Last edited by Wild Penguin (2020-09-03 13:44:28)

Offline

#3 2020-09-03 16:38:58

micha3lbrown
Member
Registered: 2020-09-02
Posts: 7

Re: [Solved] Grub not autoloading config file

Thanks for the response @Wild Penguin ...

I've configured to only look for UEFI boot options, with Legacy boot options disabled... no real change there. 

$ ls /sys/firmware/efi/efivars 
AMITCGPPIVAR-a8a2093b-fefa-43c1-8e62-ce526847265e
AMITSESetup-c811fa38-42c8-4579-a9bb-60e94eddfb34
ApServiceAuthority-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9
ApServiceData-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9
Boot0000-8be4df61-93ca-11d2-aa0d-00e098032b8c
Boot0001-8be4df61-93ca-11d2-aa0d-00e098032b8c
Boot0004-8be4df61-93ca-11d2-aa0d-00e098032b8c
BootCurrent-8be4df61-93ca-11d2-aa0d-00e098032b8c
BootOptionSupport-8be4df61-93ca-11d2-aa0d-00e098032b8c
BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c
BRDS-42780dd5-9a7d-404c-80e4-7f7094360394
BugCheckCode-ba57e015-65b3-4c3c-b274-659192f699e3
BugCheckParameter1-ba57e015-65b3-4c3c-b274-659192f699e3
BugCheckProgress-ba57e015-65b3-4c3c-b274-659192f699e3
CACHE-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9
ConIn-8be4df61-93ca-11d2-aa0d-00e098032b8c
ConInDev-8be4df61-93ca-11d2-aa0d-00e098032b8c
ConOut-8be4df61-93ca-11d2-aa0d-00e098032b8c
ConOutDev-8be4df61-93ca-11d2-aa0d-00e098032b8c
CpuSetupVolatileData-b08f97ff-e6e8-4193-a997-5e9e9b0adb32
CpuSmm-90d93e09-4e91-4b3d-8c77-c82ff10e3c81
CurrentPolicy-77fa9abd-0359-4d32-bd60-28f4e78f784b
dbDefault-8be4df61-93ca-11d2-aa0d-00e098032b8c
dbxDefault-8be4df61-93ca-11d2-aa0d-00e098032b8c
DefaultBootOrder-45cf35f6-0d6e-4d04-856a-0370a5b16f53
DefaultLegacyDevOrder-3c4ead08-45ae-4315-8d15-a60eaa8caf69
DeploymentModeNv-97e8965f-c761-4f48-b6e4-9ffa9cb2a2d6
DmiArray-4b3082a3-80c6-4d7e-9cd0-583917265df1
DmiVar0100010400-4b3082a3-80c6-4d7e-9cd0-583917265df1
DmiVar0100010500-4b3082a3-80c6-4d7e-9cd0-583917265df1
DmiVar0100010700-4b3082a3-80c6-4d7e-9cd0-583917265df1
DmiVar0100010800-4b3082a3-80c6-4d7e-9cd0-583917265df1
DmiVar0200020400-4b3082a3-80c6-4d7e-9cd0-583917265df1
DmiVar0200020500-4b3082a3-80c6-4d7e-9cd0-583917265df1
DmiVar0200020600-4b3082a3-80c6-4d7e-9cd0-583917265df1
DmiVar0200020700-4b3082a3-80c6-4d7e-9cd0-583917265df1
DmiVar0200020800-4b3082a3-80c6-4d7e-9cd0-583917265df1
DmiVar0300030400-4b3082a3-80c6-4d7e-9cd0-583917265df1
DmiVar0300030700-4b3082a3-80c6-4d7e-9cd0-583917265df1
EnterMFlashMode-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9
Ep-73dad563-8f27-42af-918f-8651eb0a93ef
EPCBIOS-c60aa7f6-e8d6-4956-8ba1-fe26298f5e87
ErrOut-8be4df61-93ca-11d2-aa0d-00e098032b8c
ErrOutDev-8be4df61-93ca-11d2-aa0d-00e098032b8c
EWRD-92daaf2f-c02b-455b-b2ec-f5a3594f4aea
FBSelect-3fae9ba1-a3f1-42eb-b6f2-b616ea57db9d
FixedBoot-de8ab926-efda-4c23-bbc4-98fd29aa0069
FPDT_Volatile-01368881-c4ad-4b1d-b631-d57a8ec8db6b
GPC-42780dd5-9a7d-404c-80e4-7f7094360394
GPC-92daaf2f-c02b-455b-b2ec-f5a3594f4aea
GSEHWInfo-8a989680-e651-4c51-a2af-3cdb1a4ab5b0
HiiDB-1b838190-4625-4ead-abc9-cd5e6af18fe0
IccAdvancedSetupDataVar-64192dca-d034-49d2-a6de-65a829eb4c74
KEKDefault-8be4df61-93ca-11d2-aa0d-00e098032b8c
Lang-8be4df61-93ca-11d2-aa0d-00e098032b8c
LangCodes-8be4df61-93ca-11d2-aa0d-00e098032b8c
LegacyDevOrder-a56074db-65fe-45f7-bd21-2d2bdd8e9652
M2DeviceData-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9
M2GenieStatus-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9
MaximumTableSize-4b3082a3-80c6-4d7e-9cd0-583917265df1
MemoryOverwriteRequestControl-e20939be-32d4-41be-a150-897f85d49829
MemoryOverwriteRequestControlLock-bb983ccf-151d-40e1-a07b-4a17be168292
MeSetupStorage-5432122d-d034-49d2-a6de-65a829eb4c74
MfgDefaults-4599d26f-1a11-49b8-b91f-858745cff824
MFlashVersionVariable-fd6b0489-d401-40c2-98b1-b1300b048711
MonotonicCounter-01368881-c4ad-4b1d-b631-d57a8ec8db6b
msiDispatcherImageList-26817ae9-ca17-80d5-ab93-2f682e69efa9
MsiOcCpuMemInfo-4ba187df-3bad-41b2-b73b-3d3dc1cc6387
MsiOcDataInNVRAM-7c405766-3e31-41cc-24e1-ee63e27d9912
MsiOcMemPatchID-78876464-9753-a77a-7607-652533891231
MsiOcMemSpdCheckSum-78876464-9753-a77a-7607-652533891231
MsiOcMemSpdData-78876464-9753-a77a-7607-652533891231
MsiOcMemSpdXMPInfo-78876464-9753-a77a-7607-652533891231
msiOcProFileStringCount-857fbb9e-8a3b-97ce-ae58-2515e09922bb
NetworkStackVar-d1405d16-7afc-4695-bb12-41459d3695a2
OA3MSDMvariable-01368881-c4ad-4b1d-b631-d57a8ec8db6b
OcInfoPassToSetup-6c3c33b6-2e40-42bc-84e6-8c510e7e9ebf
OEMDATA-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9
OfflineUniqueIDRandomSeedCRC-eaec226f-c9a3-477a-a826-ddc716cdc0e3
OfflineUniqueIDRandomSeed-eaec226f-c9a3-477a-a826-ddc716cdc0e3
OldLegacyDevOrder-a56074db-65fe-45f7-bd21-2d2bdd8e9652
OsIndicationsSupported-8be4df61-93ca-11d2-aa0d-00e098032b8c
PcieSataModVar-5e9a565f-cdc0-413b-ad13-1fe8713ffdcd
PCIM2Data-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9
PKDefault-8be4df61-93ca-11d2-aa0d-00e098032b8c
PlatformData-b39af7e9-e484-4260-8165-07399f924ddc
PlatformLang-8be4df61-93ca-11d2-aa0d-00e098032b8c
PlatformLangCodes-8be4df61-93ca-11d2-aa0d-00e098032b8c
PlatformVga-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9
PNP0303_0_NV-560bf58a-1e0d-4d7e-953f-2980a261e031
PNP0501_0_NV-560bf58a-1e0d-4d7e-953f-2980a261e031
PNP0F03_0_NV-560bf58a-1e0d-4d7e-953f-2980a261e031
ProFileAutoSaveInfo-515b6cdf-bbe7-4509-83cc-d725903d522a
PS2DETECT-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9
RhOffsetVar-7c196186-edff-42f0-8ea3-3234c9847190
RstOptaneConfig-4da4f952-2516-4d06-8975-65036403a8c7
SADS-42780dd5-9a7d-404c-80e4-7f7094360394
SADS-92daaf2f-c02b-455b-b2ec-f5a3594f4aea
SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c
SecureBootSetup-7b59104a-c00d-4158-87ff-f04d6396a915
Setup-80e1202e-2697-4264-9cc9-80762c3e5863
SetupCpuFeatures-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9
SetUpdateCountVar-81c76078-bfde-4368-9790-570914c01a65
Setup-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9
SetupMode-8be4df61-93ca-11d2-aa0d-00e098032b8c
SignatureSupport-8be4df61-93ca-11d2-aa0d-00e098032b8c
SliderDlgNod2Fun-4c5fe008-9f33-4e30-a075-5b5c84deb9f8
SmbiosEntryPointTable-4b3082a3-80c6-4d7e-9cd0-583917265df1
SmbiosEntryPointTableF000-4b3082a3-80c6-4d7e-9cd0-583917265df1
SmbiosScratchBuffer-4b3082a3-80c6-4d7e-9cd0-583917265df1
SOFTWAREGUARDSTATUS-9cb2e73f-7325-40f4-a484-659bb344c3cd
SPLC-92daaf2f-c02b-455b-b2ec-f5a3594f4aea
StdDefaults-4599d26f-1a11-49b8-b91f-858745cff824
TbtSetupVolatileData-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9
Timeout-8be4df61-93ca-11d2-aa0d-00e098032b8c
TPMPERBIOSFLAGS-7d3dceee-cbce-4ea7-8709-6e552f1edbde
TpmServFlags-7d3dceee-cbce-4ea7-8709-6e552f1edbde
UnlockIDCopy-eaec226f-c9a3-477a-a826-ddc716cdc0e3
UsbSupport-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9
VendorKeys-8be4df61-93ca-11d2-aa0d-00e098032b8c
WAND-92daaf2f-c02b-455b-b2ec-f5a3594f4aea
WGDS-92daaf2f-c02b-455b-b2ec-f5a3594f4aea
WMIAcpiMemAddr-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9
WRDD-92daaf2f-c02b-455b-b2ec-f5a3594f4aea
WRDS-92daaf2f-c02b-455b-b2ec-f5a3594f4aea
WriteOnceStatus-4b3082a3-80c6-4d7e-9cd0-583917265df1

I also followed your advice and moved / regenerated grub things

$ sudo mv grub grub-backup
$ sudo grub-install
Installing for x86_64-efi platform.
Installation finished. No error reported.
$ ls -lah | grep grub
drwxr-xr-x  6 root root 1.0K Sep  3 12:32 grub
drwxr-xr-x  6 root root 1.0K Sep  2 23:33 grub-backup

Rebooting now...

Offline

#4 2020-09-03 16:42:03

micha3lbrown
Member
Registered: 2020-09-02
Posts: 7

Re: [Solved] Grub not autoloading config file

Same grub wall. :grimacing:

Offline

#5 2020-09-03 17:00:32

Wild Penguin
Member
Registered: 2015-03-19
Posts: 319

Re: [Solved] Grub not autoloading config file

I can not find a reason to why grub does not find it's configuration file.

It *could* be limited in that it will look in the same partition the grub image is installed if installed in UEFI mode, however, I would be surprised if it was (as even in Legacy mode, the grub configuration file location is written in the ... hmm was it called stage2 loader of grub?).

Anyways, that is the only difference I can spot with your installation vs mine (i.e. I don't have separate boot+EFI partitions; just EFI mounted directly in /boot). Some buggy UEFI implementations don't like what I have, hence it is sometimes indeed recommended to do it your way (IIRC)...

Last edited by Wild Penguin (2020-09-03 17:01:19)

Offline

#6 2020-09-03 17:37:50

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

Re: [Solved] Grub not autoloading config file

micha3lbrown wrote:

Upon reboot I get

grub> 
grub> echo $root
(hd0,1)

I can rescue this by manually loading the config file...

grub> configfile(hd4,gpt2)/grub/grub.cfg

Check the output of the set command to see the values of all the parameters.

Also check which GRUB loader is being run at boot:

efibootmgr -v

And just FYI:

micha3lbrown wrote:

I have tried a few different variations of this...

grub-install --target=x86_64-efi --efi-directory=/boot/efi /dev/sde
grub-mkconfig -o /boot/grub/grub.cfg

The UEFI grub-install command will ignore any appended block devices.

Offline

#7 2020-09-04 02:12:49

micha3lbrown
Member
Registered: 2020-09-02
Posts: 7

Re: [Solved] Grub not autoloading config file

@Head_On_A_Stick Thanks! I feel like I'm getting closer... `efibootmgr` seems to indicate no matter what I do it wants to use hard disk 1.

$ efibootmgr -v             
BootCurrent: 0002
Timeout: 1 seconds
BootOrder: 0003,0002,0000
Boot0000* Windows Boot Manager	HD(1,GPT,9dd94c05-664d-11ea-ab73-806e6f6e6963,0x800,0x12bfff)/File(\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...a................
Boot0002* ubuntu	HD(1,GPT,9dd94c05-664d-11ea-ab73-806e6f6e6963,0x800,0x12bfff)/File(\EFI\UBUNTU\SHIMX64.EFI)..BO
Boot0003* Arch	HD(1,GPT,9dd94c05-664d-11ea-ab73-806e6f6e6963,0x800,0x12bfff)/File(\EFI\Grub\grubx64.efi)

Going to grab those vars from Grub here in a second.

Just also want to confirm that everything in `/boot` is in the proper place.

22:10:49 in /boot  
$ tree
.
├── efi
│   └── EFI
│       └── arch
│           └── grubx64.efi

22:11:49 in /boot  
$ ll
total 70391
drwxr-xr-x  5 root root     1024 Sep  3 12:52 .
drwxr-xr-x 18 root root     4096 Sep  2 23:29 ..
drwxr-xr-x  3 root root      512 Dec 31  1969 efi
drwxr-xr-x  6 root root     1024 Sep  3 12:54 grub
-rw-r--r--  1 root root 42398569 Sep  3 12:52 initramfs-linux-fallback.img
-rw-r--r--  1 root root 22119195 Sep  3 12:52 initramfs-linux.img
drwx------  2 root root    12288 Sep  3 12:46 lost+found
-rw-r--r--  1 root root  7541920 Sep  3 12:51 vmlinuz-linux

Offline

#8 2020-09-04 02:20:41

micha3lbrown
Member
Registered: 2020-09-02
Posts: 7

Re: [Solved] Grub not autoloading config file

Additionally

grub> set
cmdpath=(hd0,gpt1)/EFI/UBUNTU
...
prefix_version=2.04-1ubuntu26.2
prefix=(hd0,gpt1)/boot/grub
root=hd0,gpt1

Quite a few problems there... I no longer have an active Ubuntu installation. I ripped that out for Arch. :sweat-smile:

Offline

#9 2020-09-04 06:54:41

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,425

Re: [Solved] Grub not autoloading config file

Yes, if you have a broken EFI implementation it can't handle multiple ESP partitions. Install Arch's grub into the ESP where your Windows/Ubuntu partition used to live. GRUB can still load config/kernels from the actual Arch partition.

Also seeing that shim... Is secureboot enabled? That would additionally explain why it refuses to boot Arch's GRUB

Last edited by V1del (2020-09-04 06:55:48)

Offline

#10 2020-09-04 12:48:28

micha3lbrown
Member
Registered: 2020-09-02
Posts: 7

Re: [Solved] Grub not autoloading config file

Thanks everyone for helping me realize my own errors. Turns out, I was not booting the grub I thought I was. With an installation at `/dev/sde` and `/dev/sda` I believe I was only ever booting `/dev/sda`'s grub. Additionally I found the source of the `efibootmgr` entries I was unable to delete.

$ mount /dev/sda1 /mnt

08:38:26 in /mnt/EFI  
$ ll    
total 6
drwxr-xr-x 6 root root 1024 Sep  4 08:25 .
drwxr-xr-x 3 root root 1024 Dec 31  1969 ..
drwxr-xr-x 2 root root 1024 Sep  4 08:26 arch
drwxr-xr-x 2 root root 1024 Aug 24 20:24 Boot
drwxr-xr-x 4 root root 1024 Jul  3  2016 Microsoft
drwxr-xr-x 2 root root 1024 Aug 24 20:24 ubuntu

I ran `grub-isntall` and `grub-mkconfig` creating a new `arch` directory in the correct grub partition. Grub.cfg has the needed `hd(4,gpt2)` stuff. I'm still not 100% sure which grub is being loaded.  The directory structure doesn't exactly match what I expect.

08:41:30 in /mnt/EFI  
$ ls Boot
bootx64.efi  fbx64.efi  mmx64.efi

08:41:37 in /mnt/EFI  
$ ls ubuntu 
BOOTX64.CSV  grub.cfg  grubx64.efi  mmx64.efi  shimx64.efi

Seems that ubuntu grub is the only other grub installed...

$ rg --files | rg "grubx64.efi$"
EFI/arch/grubx64.efi
EFI/ubuntu/grubx64.efi

Going for reboot.

Offline

#11 2020-09-05 13:20:27

micha3lbrown
Member
Registered: 2020-09-02
Posts: 7

Re: [Solved] Grub not autoloading config file

Thanks everyone for your help... I believe I've resolved my issue. My confusion was that despite multiple `grub-install` to a wiped SSD and attempts to boot really just resulted in me booting a grub on a different device. Previous Linux installs certainly added to the confusion. In the end `efibootmgr -v` helped me figure out which grub was actually booting. After finding that I was in grub on `/dev/sda` and not `/dev/sde` my life got a lot easier. `/dev/sda` had a few EFI directories, one for a previous Ubuntu install but no grub directory. Mounting `/dev/sda1 /mnt` allowed me to create the `/boot/grub/grub.cfg` file that finally allowed me to boot the system as expected.

Offline

#12 2020-09-05 14:15:54

2ManyDogs
Forum Moderator
Registered: 2012-01-15
Posts: 4,645

Re: [Solved] Grub not autoloading config file

Please remember to mark your thread [SOLVED] (edit the title of your first post).


How to post. A sincere effort to use modest and proper language and grammar is a sign of respect toward the community.

Offline

Board footer

Powered by FluxBB