You are not logged in.

#1 2023-06-27 08:27:49

qherring
Member
Registered: 2023-05-05
Posts: 87

Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

I was trying to add an allow-discards parameter to the kernel command and I completely broke Grub.  I cannot boot up nor can I boot into any of my snapper snapshots.  I have a fully encrypted btrfs disk.  Here is what I did to cause this:

I added a line in /etc/default/grub:

cryptsetup refresh —allow-discards cryptlvm

Then in a terminal I did sudo grub-mkconfig -o /boot/grub/grub.cfg

I then rebooted and now I am stuck.  Each time I try to boot up it says:

ERROR: device 'UUID-df9abdc3-3c8a-4908-b91d-250cdddd73fe' not found.  Skipping fsck.  mount:/new_root:can't find UUID=df9abdc3-3c8a-4908-b91d-250cdddd73fe.  ERROR: Failed to mount 'UUID = df9abdc3-3c8a-4908-b91d-250cdddd73fe' on real root You are now being dropped into an emergency shell.  sh: can't access tty: job control turned off [rootfs]#

Please help me rectify this.  I am devastated.  What a bad day…

Last edited by qherring (2023-06-27 19:20:57)

Offline

#2 2023-06-27 08:30:56

jl2
Member
From: 47° 18' N 8° 34' E
Registered: 2022-06-01
Posts: 1,250

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

This isn't grub. you're already booting the kernel.
Did you change anything with your disk layout (remove partitions?)?
I get identical errors when I add/remove partitions and forget to edit fstab (don't, I don't know how it works with encryptions).

Last edited by jl2 (2023-06-27 08:34:07)


Why I run Arch? To "BTW I run Arch" the guy one grade younger.
And to let my siblings and cousins laugh at Arsch Linux...

Upload longer text output like this

Offline

#3 2023-06-27 08:36:36

qherring
Member
Registered: 2023-05-05
Posts: 87

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

No the only thing I changed is the what is written above.  I booted fine 1 minute before I ran sudo grub-mkconfig -o /boot/grub/grub.cfg

Offline

#4 2023-06-27 08:43:21

jl2
Member
From: 47° 18' N 8° 34' E
Registered: 2022-06-01
Posts: 1,250

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]


Why I run Arch? To "BTW I run Arch" the guy one grade younger.
And to let my siblings and cousins laugh at Arsch Linux...

Upload longer text output like this

Offline

#5 2023-06-27 08:44:54

qherring
Member
Registered: 2023-05-05
Posts: 87

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

I have another arch install up and running on a different SSD on the same computer.  Is there a way I can mount the drive and amend from there?

Offline

#6 2023-06-27 08:45:10

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,344

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

Boot a live system, post the output of "lsblk -f"
Mount the root and post /mnt/etc/fstab, see whether there's anything in /mnt/boot
Mount your /boot partition to /mnt/boot, post /mnt/boot/grub/grub.cfg

Edit: https://wiki.archlinux.org/title/Chroot

Last edited by seth (2023-06-27 08:51:06)

Offline

#7 2023-06-27 08:46:30

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 714

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

qherring wrote:

UUID-df9abdc3-3c8a-4908-b91d-250cdddd73fe

qherring wrote:

UUID=df9abdc3-3c8a-4988-b91d-250cdddd73fe

qherring wrote:

UUID = df9abdc3-3c8a-4908-b91d-250cdddd73fe

These shouldn't differ.
I'm guessing you made some typo when editing /etc/default/grub.

Also I don't think you need to add "allow-discards" to the kernel command line if the option is set in the LUKS2 header.

Offline

#8 2023-06-27 08:47:03

jl2
Member
From: 47° 18' N 8° 34' E
Registered: 2022-06-01
Posts: 1,250

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

you can just install it from there without chrooting.
grub-install --target=x86_64-efi --efi-directory=esp --bootloader-id=GRUB
use the esp of your other install.
EDIT: you  do have to arch-chroot  for grub-mkconfig
mount root /mnt
mount esp /mnt/boot
arch-chroot /mnt
EDIT2: nvm - i think that isn't the problem

Last edited by jl2 (2023-06-27 08:51:38)


Why I run Arch? To "BTW I run Arch" the guy one grade younger.
And to let my siblings and cousins laugh at Arsch Linux...

Upload longer text output like this

Offline

#9 2023-06-27 08:56:50

qherring
Member
Registered: 2023-05-05
Posts: 87

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

nl6720 wrote:
qherring wrote:

UUID-df9abdc3-3c8a-4908-b91d-250cdddd73fe

qherring wrote:

UUID=df9abdc3-3c8a-4988-b91d-250cdddd73fe

qherring wrote:

UUID = df9abdc3-3c8a-4908-b91d-250cdddd73fe

These shouldn't differ.
I'm guessing you made some typo when editing /etc/default/grub.

I made a typo when bringing from the terminal to this forum. they are all the same

Last edited by qherring (2023-06-27 08:57:02)

Offline

#10 2023-06-27 08:58:28

qherring
Member
Registered: 2023-05-05
Posts: 87

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

seth wrote:

Boot a live system, post the output of "lsblk -f"
Mount the root and post /mnt/etc/fstab, see whether there's anything in /mnt/boot
Mount your /boot partition to /mnt/boot, post /mnt/boot/grub/grub.cfg

Edit: https://wiki.archlinux.org/title/Chroot

This is the lsblk -f for the drive Im trying to fix:

nvme1n1                                                                                                                       
├─nvme1n1p1                                   vfat        FAT32          8F49-4391                                             
└─nvme1n1p2                                   crypto_LUKS 2              b7b560e0-b889-4f66-a24e-90280eb81b2a                 
  └─luks-b7b560e0-b889-4f66-a24e-90280eb81b2a btrfs                      df9abdc3-3c8a-4908-b91d-250cdddd73fe      3.6T     0% /run/media/qherring/df9abdc3-3c8a-4908-b91d-250cdddd73fe

Last edited by qherring (2023-06-27 09:11:50)

Offline

#11 2023-06-27 09:00:47

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,344

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

Don't transcribe that (and the other things) manually!
See the 1st link below.

Offline

#12 2023-06-27 09:03:54

qherring
Member
Registered: 2023-05-05
Posts: 87

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

seth wrote:

Mount the root and post /mnt/etc/fstab, see whether there's anything in /mnt/boot

when I try:

sudo mount /dev/mapper/cryptlvm -o subvolid=5 /mnt

I get:

mount: /mnt: special device /dev/mapper/cryptlvm does not exist.
       dmesg(1) may have more information after failed mount system call.

Offline

#13 2023-06-27 09:10:04

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,344

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

You'll first have to "cryptsetup open" it?
https://wiki.archlinux.org/title/Dm-cry … encryption

Offline

#14 2023-06-27 09:15:10

qherring
Member
Registered: 2023-05-05
Posts: 87

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

Here is /etc/fstab

# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/mapper/ainstnvme1n1p2
UUID=df9abdc3-3c8a-4908-b91d-250cdddd73fe    /             btrfs         rw,noatime,compress=zstd,subvol=/@    0 0

# /dev/mapper/ainstnvme1n1p2
UUID=df9abdc3-3c8a-4908-b91d-250cdddd73fe    /.snapshots    btrfs         rw,noatime,compress=zstd,subvol=/@snapshots    0 0

# /dev/nvme1n1p1
UUID=8F49-4391          /boot         vfat          rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro    0 2

# /dev/mapper/ainstnvme1n1p2
UUID=df9abdc3-3c8a-4908-b91d-250cdddd73fe    /home         btrfs         rw,noatime,compress=zstd,subvol=/@home    0 0

# /dev/mapper/ainstnvme1n1p2
UUID=df9abdc3-3c8a-4908-b91d-250cdddd73fe    /var/log      btrfs         rw,noatime,compress=zstd,subvol=/@var_log    0 0

Offline

#15 2023-06-27 09:17:56

qherring
Member
Registered: 2023-05-05
Posts: 87

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

I was able to mount in on the GUI

/boot is empty on that disk

Offline

#16 2023-06-27 09:32:23

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,344

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

We're still missing the grub.cfg (being the most relevant part here) - it's on nvme1n1p1

Offline

#17 2023-06-27 09:36:12

qherring
Member
Registered: 2023-05-05
Posts: 87

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

seth wrote:

We're still missing the grub.cfg (being the most relevant part here) - it's on nvme1n1p1

There is nothing in the /boot , so nothing to share

Offline

#18 2023-06-27 09:50:59

qherring
Member
Registered: 2023-05-05
Posts: 87

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

I just cant seem to figure out how to mount this in the terminal.  I can mount it in the GUI but there is nothing in my home, boot, or .snapshots directories.  So I am assuming it is only mounting the /root subvolume...

When I was doing a snapper rollback earlier today I was mounting this disk using: sudo mount /dev/mapper/cryptlvm -o subvolid=5 /mnt
however when I try than now it says: "mount: /dev/mapper/cryptlvm: can't find in /etc/fstab."


I am lost.  I gave btrfs a try and im getting burned.  I guess i should start over fresh.

Last edited by qherring (2023-06-27 09:58:08)

Offline

#19 2023-06-27 09:57:15

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,344

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

nvme1n1p1 isn't btrfs but vfat, just mount it into /mnt/boot (or /boot from the chroot)

Offline

#20 2023-06-27 10:03:44

qherring
Member
Registered: 2023-05-05
Posts: 87

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

seth wrote:

nvme1n1p1 isn't btrfs but vfat, just mount it into /mnt/boot (or /boot from the chroot)

I really appreciate your patience.

here is the grub.cfg from nvme1n1p1

https://pastebin.com/Hzj7vg6Y

Last edited by qherring (2023-06-27 10:05:00)

Offline

#21 2023-06-27 14:26:32

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,344

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod cryptodisk
insmod luks2
insmod gcry_rijndael
insmod gcry_rijndael
insmod gcry_sha256
insmod btrfs
cryptomount -u b7b560e0-b889-4f66-a24e-90280eb81b2a
set root='cryptouuid/b7b560e0b8894f66a24e90280eb81b2a'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint='cryptouuid/b7b560e0b8894f66a24e90280eb81b2a'  df9abdc3-3c8a-4908-b91d-250cdddd73fe
else
  search --no-floppy --fs-uuid --set=root df9abdc3-3c8a-4908-b91d-250cdddd73fe
fi
    font="/@/usr/share/grub/unicode.pf2"
fi

This looks odd - not only is the indentation wrong but also the decryption is conditioned on the font.
Did you edit that file somehow?

Offline

#22 2023-06-27 15:09:43

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 714

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

With /boot being the ESP and thus not encrypted, you don't need to enable GRUB_ENABLE_CRYPTODISK.

https://pastebin.com/Hzj7vg6Y wrote:
	linux	/vmlinuz-linux root=UUID=df9abdc3-3c8a-4908-b91d-250cdddd73fe rw rootflags=subvol=@ cryptsetup refresh --allow-discards cryptlvm loglevel=3 quiet nvidia_drm.modeset=1

cryptsetup is a command you run, not a kernel parameter.

Post your /etc/default/grub.

Offline

#23 2023-06-27 15:53:46

qherring
Member
Registered: 2023-05-05
Posts: 87

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

seth wrote:

This looks odd - not only is the indentation wrong but also the decryption is conditioned on the font.
Did you edit that file somehow?

No, I only modified /etc/default/grub directly.  Afterwards when I did sudo grub-mkconfig -o /boot/grub/grub.cfg it would have imported the changes I made.

Last edited by qherring (2023-06-27 15:54:26)

Offline

#24 2023-06-27 16:12:51

qherring
Member
Registered: 2023-05-05
Posts: 87

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

nl6720 wrote:

Post your /etc/default/grub.

https://pastebin.com/TBZ8xz9U

Offline

#25 2023-06-27 16:19:04

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 714

Re: Cannot boot, I broke grub by editing /etc/default/grub [SOLVED]

https://pastebin.com/TBZ8xz9U wrote:
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet nvidia_drm.modeset=1"
GRUB_CMDLINE_LINUX="cryptdevice=UUID=b7b560e0-b889-4f66-a24e-90280eb81b2a:cryptlvm rootfstype=btrfs"
GRUB_CMDLINE_LINUX="cryptsetup refresh —allow-discards cryptlvm"

The second GRUB_CMDLINE_LINUX overrides the first one. And as I said previously,

nl6720 wrote:

cryptsetup is a command you run, not a kernel parameter.

https://pastebin.com/TBZ8xz9U wrote:
# Uncomment to enable booting from LUKS encrypted devices
GRUB_ENABLE_CRYPTODISK=y

You don't need this since your kernel+initramfs is in an unencrypted partition (the ESP, which you mount at /boot). Comment out the GRUB_ENABLE_CRYPTODISK line.

Following https://wiki.archlinux.org/title/dm-cry … ives_(SSD) , you just needed to set GRUB_CMDLINE_LINUX to:

GRUB_CMDLINE_LINUX="cryptdevice=UUID=b7b560e0-b889-4f66-a24e-90280eb81b2a:cryptlvm:allow-discards"

Offline

Board footer

Powered by FluxBB