Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] Destroyed my GRUB setup (Read 2413 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: Destroyed my GRUB setup

Reply #15
Please post the efibootmgr output.

I think that the /dev/sda1 is the image booting device and not the NVME which is the root of your system.
Thus I may have erred on that part. The entries should show something like this using your last output as the source:
Code: [Select]
Generating grub configuration file ...
Found theme: /usr/share/grub/themes/artix/theme.txt
Found linux image: /boot/vmlinuz-linux-zen
Found initrd image: {/boot/intel-ucode.img or /boot/amd-ucode.img} /boot/initramfs-linux-zen.img
Found fallback initrd image(s) in /boot:  intel-ucode.img amd-ucode.img initramfs-linux-zen-fallback.img
Found linux image: /boot/vmlinuz-linux
Found initrd image: {/boot/intel-ucode.img or /boot/amd-ucode.img} /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot:  intel-ucode.img amd-ucode.img initramfs-linux-fallback.img
Warning: os-prober will be executed to detect other bootable partitions.
Everything after os-prober line should not affect the boot process for the main OS.
The last line should state "done".

Re: Destroyed my GRUB setup

Reply #16
Sure, sorry for the delay, but here it is
Timeout: 1 seconds
BootOrder: 0001,0007,0008,0006,0000
Boot0000* Windows Boot Manager   VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000000000100000010000000040000007fff0400
Boot0001* grub   HD(1,GPT,eafbd316-af50-ba45-a13a-afc5b222e99c,0x1000,0x96000)/File(\EFI\grub\grubx64.efi)
Boot0006* UEFI OS   HD(1,GPT,eafbd316-af50-ba45-a13a-afc5b222e99c,0x1000,0x96000)/File(\EFI\BOOT\BOOTX64.EFI)0000424f
Boot0007* UEFI: USB   PciRoot(0x0)/Pci(0x8,0x1)/Pci(0x0,0x4)/USB(5,0)/CDROM(1,0x26c8e4,0x8000)0000424f
Boot0008* UEFI: USB, Partition 2   PciRoot(0x0)/Pci(0x8,0x1)/Pci(0x0,0x4)/USB(5,0)/HD(2,MBR,0x0,0x26c8e4,0x2000)0000424f

The line with Boot00001 now has grubx64.efi as the efi file, whereas before it had the bootx64.efi file.

Re: Destroyed my GRUB setup

Reply #17
Code: [Select]
BootOrder: 0001,0007,0008,0006,0000
Boot0001* grub   HD(1,GPT,eafbd316-af50-ba45-a13a-afc5b222e99c,0x1000,0x96000)/File(\EFI\grub\grubx64.efi)
It looks good. Grub should be present in the boot menu and work all things being equal.
Check the /boot/grub/grub.cfg file for all of your kernels. Look after "### BEGIN /etc/grub.d/10_linux ###" in the grub.cfg file. If they do not run the grub-mkconfig again and check. Once the entries are good then it is time to reboot.
Here is an example from my grub.cfg:
Code: [Select]
menuentry 'Artix Linux' --class artix --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-6418ae6c-0cc0-452f-9c3c-68ba19f02bb3' {
savedefault
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root 6418ae6c-0cc0-452f-9c3c-68ba19f02bb3
echo 'Loading Linux linux-zen ...'
linux /boot/vmlinuz-linux-zen root=UUID=6418ae6c-0cc0-452f-9c3c-68ba19f02bb3 rw  loglevel=3 quiet
echo 'Loading initial ramdisk ...'
initrd /boot/amd-ucode.img /boot/initramfs-linux-zen.img

Re: Destroyed my GRUB setup

Reply #18
Well, I'm writing to you now from the repaired system :). There is only one thing that I had to do, and that was adding the boot option from the BIOS options. I was under the impression that GRUB would do this automatically. Was I wrong to suppose that or not? It worries me that I might be one update from doing this all again (but at least I know exactly what to do to fix it now).

Both kernels (stock linux and linux-zen) are working fine now.

Besides that, I have no words to thank you enough for your help @jspaces , you rock. I will also study the  software @gripped mentioned, it might come handy in the future.

PS: I have not seen an option to add code blocks as you did in your replies, how can I post like that?

Re: Destroyed my GRUB setup

Reply #19
As far as I know grub-install always will install the EFI as "grubx64.efi".
Quote
The line with Boot00001 now has grubx64.efi as the efi file, whereas before it had the bootx64.efi file.
Normally the name does not matter. This should only be an issue if you have some motherboard with UEFI problems. It was one way to get some poorly configured UEFI motherboards to work to that only recognized certain words to function. One would copy the grubx64.efi to the default UEFI boot location (check manufacturer's documentation) of the motherboard as bootx64.efi. It is also a way to provide another bootable EFI file that should work in case the original grubx64.efi has issues than the motherboard's UEFI boot should be able to see. I have done this on my system as a backup method.
For most motherboard UEFI:
(this location is not written in stone anywhere as far as I know)
Code: [Select]
cp /boot/efi/EFI/grub/grubx64.efi /boot/efi/EFI/boot/bootx64.efi
or to the root of the "ESP's EFI" folder
cp /boot/efi/EFI/grub/grubx64.efi /boot/efi/EFI/bootx64.efi
In general though the EFI name should not matter as long as the executable is valid and points to a location in the ESP that grub or what ever boot loader is used can read their files. If grubx64.efi is loaded by the UEFI of the motherboard menu but cannot read the grub folders and files in the ESP then the dreaded grub rescue mode appears. Though the steps to fix that are same; that is chroot, re-install grub and re-configure grub. I make my ESP to be quite large (500 MB) so that I will have no issues with space for stuff. The FAT formatted ESP is not the greatest to keep files in good working order. And for solid state devices one of the worse formats in existence since trim does not exist in it's specification. If not for Microsoft the standard would have been EXT2 which is extremely stable and would prevented many heartaches IMHO.

Re: Destroyed my GRUB setup

Reply #20
Since your question was to fix GRUB I did not go now this path regarding rEFInd (refind). I actually use rEFInd as my main boot loader. It is an excellent way to go very similar to how a Mac boots up. It does have some configuration steps but once it is done updates will not affect it like grub. Or at least I have not experienced any. Earlier in it's existence when EFI standards were not quite set, rEFInd failed me and I could not get it going due to rEFInd itself needed to updated to the new standard. The main trick with rEFInd is to make sure of your folder slashes in certain parts for the initramfs are DOS or Windows formatted.
Here is an example of my /boot/efi/EFI/refind/refind.cfg file manual entry for linux-zen kernel:
Code: [Select]
menuentry "Artix Linux-Zen" {
    icon /EFI/refind/icons/os_artix.png
    volume 5a71beee-b8c9-cb4d-bbde-dc1ca16a2ed6
    loader /boot/vmlinuz-linux-zen
initrd /boot/initramfs-linux-zen.img
    options "root=PARTUUID=5a71beee-b8c9-cb4d-bbde-dc1ca16a2ed6 rw rootfstype=ext4 add_efi_memmap initrd=boot\amd-ucode.img net.ifnames=0 quiet"
    submenuentry "Boot using fallback initramfs" {
initrd boot\initramfs-linux-ryzen-fallback.img
    }
submenuentry "Boot to terminal." {
add_options "single"
}
}
Please note the use of the back slash for the initramfs parts. It is very important for stuff to work.
I actually have both grub and rEFInd both installed and functioning since shit can happen and it is not very nice when the computer just blinks at you.

Re: Destroyed my GRUB setup

Reply #21
Oh yes, please edit your original post and the mark this thread as being [Solved] in the subject line.
In the future others may experience something similar and may help them get stuff working again with a working solution.
Take care and have fun. Life is too short after all.

Re: Destroyed my GRUB setup

Reply #22
https://archlinux.org/news/grub-bootloader-upgrade-and-configuration-incompatibilities/
I think all the current Artix install iso's have the "old" grub in them. So if you install with UEFI then it all works fine, you update, still fine. But then if you do "update-grub" without also re-installing Grub then the bootloader stops working, at least that is what I found recently with the Mate openrc iso. The Artix iso on a USB allowed me to boot other partitions that were on the drive and set them as default in the BIOS but it wouldn't boot Artix, you have to chroot in and fix it first because of the version mismatch.

Re: Destroyed my GRUB setup

Reply #23
Quote
But then if you do "update-grub" without also re-installing Grub then the bootloader stops working...
That is why I recommend saving the grub-install line used on a system with the correct info, saved to /usr/local/bin/efi-grub-install.sh then run that script every time grub gets updated then do the grub-mkconfig line. It is not the first time a grub update has made a system no longer bootable. Thus it also pays to have a plan B boot method to get back in without chroot repair process. A few times over the years, I have forgotten to run grub-install or ran it incorrectly with a syntax error or bootloader Id change at my own chagrin. Upgrading grub has always given me a moment pause due to remembering those few occasions. Thus one learns methods that minimize the risk of failure trying to make stuff more reliable. By installing grub every and each time it is updated then run the grub-mkconfig is the only way to get through the update with as little pain as possible in my experience.

 

Re: Destroyed my GRUB setup

Reply #24
Amazing contributions everybody - yeah, I will keep an eye out for future grub updates and will take into account  the last two posts just to be safe. I think I'll spend some time tomorrow (if I have the time) really studying all the things you have mentioned.

Again, thanks everybody,  you saved my life.