You are not logged in.

#1 2026-03-26 03:18:41

PurpleAce
Member
Registered: 2023-11-06
Posts: 39
Website

[SOLVED]Booting into GRUB shell after modifying core image.

I am following this guide to load dvorak as my keyboard layout at early boot, so I can use my dvorak to enter the password to decrypt my drive. My early-grub.cfg looks like this:

set root=(memdisk)
set prefix=($root)/

terminal_input at_keyboard
keymap /dvorak.gkb

cryptomount -u 74a667d5-8d13-4ef9-bf54-c1541d137946
set root='lvmid/udGQS-Ls5p-544Q-afig-v5GO-h3fk-X88YYd/pdzUUH-Y24U-JZ9k-rNGp-T94z-xE2e-J4eHK9'
set prefix=($root)/grub

configfile grub.cfg

My command for compiling my core image looks like this:

grub-mkimage -c early-grub.cfg -o grubx64.efi -O x86_64-efi -m memdisk.tar part_gpt cryptodisk luks gcry_rijndael gcry_sha256 lvm ext2 memdisk tar at_keyboard keylayouts configfile

memdisk.tar contains dvorak.gkb which was converted from the X11 format by grub-kbdcomp.

On boot I'm given the normal decryption prompt, and the keymap is loaded correctly, I input my password, it successfully decrypts my drive, and then I get put into a grub shell. According to this that probably means early-grub.cfg isn't calling grub.cfg correctly, but I've tried reformatting it and editing it to work properly, with no luck.

Last edited by PurpleAce (2026-03-28 17:40:46)


"The worst argument is an argument of authority, according to Aristotle"-St. Thomas Aquinas

Offline

#2 2026-03-26 08:24:59

-thc
Member
Registered: 2017-03-15
Posts: 1,118

Re: [SOLVED]Booting into GRUB shell after modifying core image.

PurpleAce wrote:
cryptomount -u 74a667d5-8d13-4ef9-bf54-c1541d137946
set root='lvmid/udGQS-Ls5p-544Q-afig-v5GO-h3fk-X88YYd/pdzUUH-Y24U-JZ9k-rNGp-T94z-xE2e-J4eHK9'

Is this a "LUKS on LVM" or "LVM on LUKS" scenario? And if yes - do those command match those in your grub.cfg?

Offline

#3 2026-03-26 09:41:11

frostschutz
Member
Registered: 2013-11-15
Posts: 1,638

Re: [SOLVED]Booting into GRUB shell after modifying core image.

In the Grub shell, what does 'ls' show? Do you see your drives and files? Can you load your grub.cfg manually?

You could also try debugging... it's a ton of output but sometimes it helps understand what Grub is doing and where things go wrong.

set debug=all
set pager=1

A completely different approach would be to add the same passphrase twice... change your keyboard layout while you cryptsetup luksAddKey, so LUKS accepts the same key sequence in both Dvorak and US layouts. Then you don't even need a custom config. It would take longer to unlock if it tries the wrong keyslot first, though.

That or find a passphrase that works for either layout anyway. Of course it's harder than just avoiding Y/Z for qwerty/qwertz layouts. Digits, A, M, what else is there?

Last edited by frostschutz (2026-03-26 10:23:10)

Offline

#4 2026-03-26 13:29:49

PurpleAce
Member
Registered: 2023-11-06
Posts: 39
Website

Re: [SOLVED]Booting into GRUB shell after modifying core image.

-thc wrote:

Is this a "LUKS on LVM" or "LVM on LUKS" scenario? And if yes - do those command match those in your grub.cfg?

LVM on LUKS, I have root and swap on the same encrypted /dev/sda2. They do match, I copied them directly from my grub.cfg.


"The worst argument is an argument of authority, according to Aristotle"-St. Thomas Aquinas

Offline

#5 2026-03-26 14:07:22

PurpleAce
Member
Registered: 2023-11-06
Posts: 39
Website

Re: [SOLVED]Booting into GRUB shell after modifying core image.

frostschutz wrote:

In the Grub shell, what does 'ls' show? Do you see your drives and files?

Yes, I have memdisk, both my logical volumes, both my partitions, crypto0 and proc.

frostschutz wrote:

Can you load your grub.cfg manually?

Yes, but nothing happens? When I run boot it still tells me I need to load the kernel first, but the kernel should be loaded in grub.cfg, correct?
Trying to load the kernel manually it always fails to find the linux command. Granted I don't know a lot about kernel loading so I may be doing it wrong. My guess is then that both grub.cfg and early-grub.cfg must be setting root at the wrong location?

frostschutz wrote:

A completely different approach would be to add the same passphrase twice...

I mean yeah, I could just change the password, but having a properly loaded layout is handy when things like this happen and I have to work in a grub terminal.


"The worst argument is an argument of authority, according to Aristotle"-St. Thomas Aquinas

Offline

#6 2026-03-26 14:19:18

frostschutz
Member
Registered: 2013-11-15
Posts: 1,638

Re: [SOLVED]Booting into GRUB shell after modifying core image.

Do you have menuentries in grub.cfg? If you add echo blah blah blah in your grub.cfg (and another string in early cfg), does it get echoed?

Does anything change if you use 'normal' instead of 'configfile grub.cfg'? (Normal mode should load it automagically)

Otherwise try the debugging if you see anything obviously wrong. Not sure what it could be; maybe someone else can chip in.

Offline

#7 2026-03-26 15:12:08

PurpleAce
Member
Registered: 2023-11-06
Posts: 39
Website

Re: [SOLVED]Booting into GRUB shell after modifying core image.

Yes, I haven't tampered with my grub.cfg at all, it has the menuentries, and it was working fine before I started all this. The echo in early-grub.cfg was called(I actually forgot to load echo so it returned "can't find command 'echo'), but the one in grub.cfg wasn't.

Normal instead of configfile still fails to boot. I get a lot of messages saying:

Read out of range: sector 0x0 (attempt to read or write outside of disk 'proc'

I don't know if that has anything to do with it. Otherwise it appears to be running something at least? It's accessing my root partition properly, and I don't see any errors, it just doesn't boot or load the kernel.

Is it possible to decompile grubx64.efi? I think looking at the early-grub.cfg generated by grub-install might help.


"The worst argument is an argument of authority, according to Aristotle"-St. Thomas Aquinas

Offline

#8 2026-03-26 15:39:12

frostschutz
Member
Registered: 2013-11-15
Posts: 1,638

Re: [SOLVED]Booting into GRUB shell after modifying core image.

grub-install puts a copy of its early as "load.cfg" in /boot/grub/........

perhaps something about setting root and prefix is wrong, what happens if you set prefix only?

but, it shouldn't be wrong

as for decompiling, no idea but if you just want to look at the config embedded, its in there as plain text, just use 'strings file.efi | grep -C 20 cryptomount' or something like that

Offline

#9 2026-03-26 18:04:50

PurpleAce
Member
Registered: 2023-11-06
Posts: 39
Website

Re: [SOLVED]Booting into GRUB shell after modifying core image.

grub-install's load.cfc just has "cryptomount -u 74a667d5-8d13-4ef9-bf54-c1541d137946" I tried removing everything after that from mine, still didn't boot.

Setting my prefix only would set it as memdisk/grub. I don't think I even need to try it to assume that it won't work, considering memdisk only contains dvorak.gkb.


"The worst argument is an argument of authority, according to Aristotle"-St. Thomas Aquinas

Offline

#10 2026-03-27 08:03:07

-thc
Member
Registered: 2017-03-15
Posts: 1,118

Re: [SOLVED]Booting into GRUB shell after modifying core image.

You could try a more analytical approach.

Dropped to the GRUB shell, try

ls

This should list all available devices/partitions. Then do

ls (hd0,msdos2)

with every found partition ("(hd0,msdos2)" just as an example). GRUB should say if it's able to determine the file system. And finally do

ls (hd0,msdos2)/

to test the file system contents.

Offline

#11 2026-03-28 17:32:05

PurpleAce
Member
Registered: 2023-11-06
Posts: 39
Website

Re: [SOLVED]Booting into GRUB shell after modifying core image.

The device with the filesystem I want is (lvm/strongbox-root) strongbox being the name of my LUKS container.

ls (lvm/strongbox-root)/ 

shows me my root filesystem as expected. Running

ls (lvm/strongbox-root)/boot/grub/

confirms that my grub.cfg is in the right place.

Otherwise, (hd0,gpt1) and (hd0,gpt2) are unknown filesystems.


"The worst argument is an argument of authority, according to Aristotle"-St. Thomas Aquinas

Offline

#12 2026-03-28 17:39:53

PurpleAce
Member
Registered: 2023-11-06
Posts: 39
Website

Re: [SOLVED]Booting into GRUB shell after modifying core image.

And that's my solution! Using

set root='(lvm/strongbox-root)'
set prefix=($root)/boot/grub
normal

boots successfully.

Marking as solved

Last edited by PurpleAce (2026-03-28 17:40:21)


"The worst argument is an argument of authority, according to Aristotle"-St. Thomas Aquinas

Offline

Board footer

Powered by FluxBB