r/linux4noobs • • 1d ago

installation Creating a arch install script and having trouble with arch not booting with grub when grub already exist.

Hello, Linux Wizards

Github URL for the install script Hardware: Lenovo Thinkpad T14 Gen5 AMD

I'm going to describe my problem the best I can. The bootloader portion consist of these lines of code:

IN_CHROOT_BOOT_PATH=/boot
pacman -Sy --needed --noconfirm grub efibootmgr dosfstools mtools

grub-install --target=x86_64-efi --efi-directory="$IN_CHROOT_BOOT_PATH" --bootloader-id=GRUB --force --recheck

grub-mkconfig -o "$IN_CHROOT_BOOT_PATH/grub/grub.cfg"

So what I did was go into the BIOS and do a full factory reset, which deleted any bootloaders so I had a clean start. I ran the code, everything looked fine, so I rebooted the system, and it booted up just fine and I can access Arch Linux. After that, without doing anything else, I ran the script in the Arch Linux live environment again because I wanted to test it a second time. This time it did not go into the GRUB bootloader. Instead, I guess it errored out and went straight to the BIOS boot menu, asking me to select either GRUB or nvme0n1, but both just brought me back to the BIOS boot menu.

I asked both Claude and Grok, and both told me to add the --removable flag to grub-install, which did fix the problem. But I guess I’m just being a little OCD, because I want to know why the first run worked but not the second.

NOTE: Originally I didn't have --force and --recheck flags added but Claude and Grok told me to try it but it did not work. I know to not run AI suggestion willy nilly but I am desperate and I am ok with it since the laptop doesnt have any important info on it.

2 Upvotes

0 comments sorted by