You are not logged in.

#1 2022-11-26 18:36:47

morningzebra
Member
Registered: 2022-11-26
Posts: 6

GRUB boot/reinstallation issues [SOLVED]

Well it makes me feel a bit of a fool but I fear I've made a bit of a mess with my GRUB after attempting to edit parameters to enable AppArmor

I originally tried following the arch wiki's instructions but for all it's worth, I still find some of it a little "fill in the blanks" as a less experienced user and so I made the mistake of following a third party guide for assistance (https://unixcop.com/basic-setup-of-appa … rch-linux/)

However after reboot grub would give a quick hello message and fail and load into BIOS.

Being a mess maker and not wanting to ask for help before trying solutions mentioned in other threads, I mounted the non-encrypted partition to /mnt (the boot partition I assume) (worth mentioning I used the built in archinstall script to set up a default btrfs layout) and tried using a text editor to remove the apparmor parameters that I now found in the /mnt/grub/grub.cfg but that didn't have any effect.

So I made the possibly ill advised attempt to reinstall grub to that partition, however I can't figure out how to successfully arch-chroot so that I can use grub-mkconfig as I see in other solutions.

I found a flag in some other threads allowing --root-directory= to not need chroot for grub-install, but trying to arch-chroot into the partition results in a "failed to run command ~/bin/bash: no such file or directory"

And although it may have been not recommended, I read some info about essentially treating this step similarly to an arch installation progress, and so I tried to pacstrap bash to the partition, but even though it seems to have somewhat worked it gives me warnings about not being able to create '/mnt/use/bin/sh' and not being able to make links from various /usr/lib/ files

Ive tried using the seemingly successfully reinstalled grub with no config to boot into my arch partition but there doesn't seem to be an initrd file to load as according to other sources

Apologies if this isn't the right category, but I'd really appreciate some insight on this!

Last edited by morningzebra (2022-11-27 04:45:56)

Offline

#2 2022-11-26 23:16:53

jonno2002
Member
Registered: 2016-11-21
Posts: 688

Re: GRUB boot/reinstallation issues [SOLVED]

this may help: https://bbs.archlinux.org/viewtopic.php … 9#p2057879
i dont know your specific setup but im sure you can fill in the gaps

EDIT: obviously ignore the first part in the quote bubble as its not relevant to you, just the instructions below it

EDIT: actually thats too dangerous without knowing your partition layout, boot up off the arch iso and post output of:

lsblk -f
fdisk -l

if you have encrypted drives be sure to decrypt them before running those commands so we can get an idea of how your system is setup.

Last edited by jonno2002 (2022-11-26 23:27:54)

Offline

#3 2022-11-27 00:00:32

morningzebra
Member
Registered: 2022-11-26
Posts: 6

Re: GRUB boot/reinstallation issues [SOLVED]

Okay, I booted back into the arch iso and used cryptsetup to open my drive, I know it's really not ideal but I'm not prepared for more than these quick photos

https://ibb.co/x2Cf5td
https://ibb.co/1X1kFYT

Offline

#4 2022-11-27 00:11:44

jonno2002
Member
Registered: 2016-11-21
Posts: 688

Re: GRUB boot/reinstallation issues [SOLVED]

ok so my previous linked instructions should work then, ill paste them here:

-boot from arch iso or similar
-decrypt your root partition (btrfs partition) then mount it to /mnt
-mount your efi partition (fat32 partition) to /mnt/boot
-run "arch-chroot /mnt"
-run "grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB" (EDIT: fixed this line so this mistake doesnt happen again)
-run "grub-mkconfig -o /boot/grub/grub.cfg"
-run "mkinitcpio -p linux"
-reboot and everything SHOULD work

Last edited by jonno2002 (2022-11-27 23:44:36)

Offline

#5 2022-11-27 01:07:05

morningzebra
Member
Registered: 2022-11-26
Posts: 6

Re: GRUB boot/reinstallation issues [SOLVED]

Hmm, I was able to get all that done with no errors (also tried again after removing the older grub.cfg), but rebooting leads directly to the grub command line, and attempting to use instructions from various other sources to set root directory and load the kernel leaves me with a booting in blind mode message

Edit: I'm not sure if it would be interfering, but I noticed while running grub-mkconfig that the output mentions selecting a theme which I remember being from this script i used to cosmetically customize my grub screen before this all happened (from https://github.com/vinceliuice/grub2-themes), so I'm not sure what to make of that

Last edited by morningzebra (2022-11-27 01:13:43)

Offline

#6 2022-11-27 02:46:20

jonno2002
Member
Registered: 2016-11-21
Posts: 688

Re: GRUB boot/reinstallation issues [SOLVED]

ok try the same steps again but try updating the system as well:

-boot from arch iso or similar
-make sure you have a working internet connection
-decrypt your root partition (btrfs partition) then mount it to /mnt
-mount your efi partition (fat32 partition) to /mnt/boot
-run "arch-chroot /mnt"
-run "pacman -Syu"
-run "grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB" (EDIT: fixed this line so this mistake doesnt happen again)
-run "grub-mkconfig -o /boot/grub/grub.cfg"
-run "mkinitcpio -p linux"
-reboot and everything SHOULD work

ive never used grub themes so cant comment on that sorry

EDIT: dont know how i missed this but make sure to remove the entries you added to /etc/default/grub reguarding apparmor, do this step after "arch-chroot"

Last edited by jonno2002 (2022-11-27 23:44:49)

Offline

#7 2022-11-27 03:44:32

morningzebra
Member
Registered: 2022-11-26
Posts: 6

Re: GRUB boot/reinstallation issues [SOLVED]

This is bizarre, none of these steps result in errors and it all does seem like it should be working at this point...

Worst part is only now that you mention the /etc/default/grub do I remember that I initially made a backup to swap to in case this happened, but I had forgotten and skipped straight to reinstallation, which seems where I probably went wrong somehow.

I can confirm the system is up to date and I've not only tried once simply restoring the back up but also removing/moving it entirely before a fresh installation and config update

I'll keep reading the wiki for now out of sheer curiosity, but I'm beginning to think I should prepare to just backup and restore my home folder and configs (important data is already backed up) and reinstall at some point.

Last edited by morningzebra (2022-11-27 03:45:13)

Offline

#8 2022-11-27 03:48:49

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,144

Re: GRUB boot/reinstallation issues [SOLVED]

jonno2002 wrote:

mount your efi partition (fat32 partition) to /mnt/boot

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

One or other of these is wrong. The first assumes you mount your ESP to /boot; the second assumes you use /boot/EFI.

Please post the contents of your /etc/fstab or, if you are not chrooted, mount the decrypted system and post the content of /mnt/etc/fstab.

You can post test to a pastebin service by following the instructions in the link below.

Please note the use of [ code ] [ /code ] tags (without the spaces) for posting code.

morningzebra wrote:

I'll keep reading the wiki for now out of sheer curiosity, but I'm beginning to think I should prepare to just backup and restore my home folder and configs (important data is already backed up) and reinstall at some point.

At some point, you will find you need to do something like this again. There is zero reason to think you have messed up anything except the contents of your ESP and, possibly, the nvram entries. Those are both easy to fix from the live environment. Unless you did something you did not describe involving your main system, reinstalling the entire OS is entirely unnecessary.

Last edited by cfr (2022-11-27 03:53:43)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#9 2022-11-27 04:13:35

morningzebra
Member
Registered: 2022-11-26
Posts: 6

Re: GRUB boot/reinstallation issues [SOLVED]

Good points, and thank you for the posting advice

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/mapper/ainstloop
UUID=9203923f-da43-4206-9c4b-37bcceed800b	/         	btrfs     	rw,relatime,ssd,space_cache=v2,subvolid=5,subvol=/	0 0

# /dev/sda1
UUID=1642-8A98      	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors

Contents of /etc/fstab

Last edited by morningzebra (2022-11-27 04:14:10)

Offline

#10 2022-11-27 04:35:38

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,144

Re: GRUB boot/reinstallation issues [SOLVED]

OK, so mount the EFI partition at /mnt/boot as you did before (after mounting your decrypted root) and arch-chroot into the system.

pacman -S linux
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

The above assumes you're using the current standard kernel. If not, substitute whichever kernel package you use for 'linux'. Reinstalling the kernel may not be necessary, but it can't hurt and it should correct various kinds of screw up. I'm not sure what happened when you tried to install bash to your EFI partition, for example, but in case the kernel or initramfs has got messed up, this should fix it.
Hopefully, that will work. It is possible you might need to reinstall microcode, too. If you know which package to install, you can add it to the pacman line but try without otherwise and post your grub.cfg if you still have problems.

Do NOT add any other options to the pacman line. The command I've given you will reinstall the kernel, but won't update anything. If you want to update

pacman -Syu linux

would also be safe.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#11 2022-11-27 04:45:20

morningzebra
Member
Registered: 2022-11-26
Posts: 6

Re: GRUB boot/reinstallation issues [SOLVED]

Reinstalling 'linux' worked, thank you!

Will mark as solved.

Please let me know if there's anything else besides the microcode I should double check, otherwise thanks again!

Offline

#12 2022-11-27 23:40:01

jonno2002
Member
Registered: 2016-11-21
Posts: 688

Re: GRUB boot/reinstallation issues [SOLVED]

sorry for the error, if you read the page i linked to originally my next post points out the error and corrects it, dammit i didnt read before copy pasting my old post, very sorry !

Offline

Board footer

Powered by FluxBB