Menu Close

Manjaro broken grub fix

I purchased a new SSD to install a new Linux distro that wouldn’t interfere with my existing luks installation (a window manager software dev setup designed for efficiency with no local media/games etc. for distraction. Once I boot in all I have is Coding resources).
I ran through the Manjaro setup on the new disk, when reaching the partitioning section it never mentioned the grub installation and I stupidly assumed it was going to be smart about things. Or more accurately I didn’t give it much thought at all since Disk A needed to run its luks decryption at some point and I didn’t know how that would interact with grub being potentially installed on Disk E..would Disk A keep priority, would Disk E get priority and be unable to prompt for Disk A luks etc.

The new installation completed, containing it’s own grub install.
Upon restart the new grub menu appeared without decrypt prompts, the list contained only the new OS, luks installation and Windows were missing.

My current setup for this issue:
Disk A – luks full disk encrypted Linux installation
Disk B – Windows 10 installation
Disk C – ntfs general media Storage
Disk D – 50/50 shared Game storage split between ext4/ntfs
-Provisionally Disk E – Linux installation without luks

Prior to Disk E installation the boot process was:
PC powers up
Mobo UEFI splash screen
Disk decryption password prompt
Grub menu upon success, menu contains Linux, Windows, Options such as advanced.

I rebooted and entered the UEFI boot menu, selecting the Disk B caused Windows to boot normally, selecting Disk A resulted in a decrypt prompt that forced the PC to reboot to the UEFI main menu upon entering the decrypt key (“slot X opened” no longer appearing).

Unable to get any access to Disk A, I booted to a Manjaro LiveUSB and started the process of getting chroot access and reinstalling/updating grub.
My first time dealing with chrooting into an encrypted disk so I had to figure out how to access those partitions.

Fix attempt 1:
With Disk A having 3 partitions boot/uefi, encrypted root partition, encrypted swap partition:

[STEP 1]
#decrypting root and swap partitions
cryptsetup luksOpen /dev/mapper/ssd ssd
:enter decryption key
cryptsetup luksOpen /dev/sda3 swap
:enter decryption key

#mounting the partitions
sudo mount /dev/mapper/ssd /mnt
sudo mount /dev/sda1 /mnt/boot/efi

#using manjaro-chroot instead of vanilla chroot since it automatically mounts /proc /sys /dev etc.
sudo manjaro-chroot /mnt
#now sitting at the new prompt if successful

After the successful chroot I had a quick look around to see that everything was intact, it was.

[STEP 2]
#reinstalling grub on Disk A and updating to pick up the other OSs
sudo grub-install
sudo update-grub

Assuming no errors occured, exit chroot and restart.

After completing this, I restarted (stupidly since I still had the conflicting grub install on Disk E).
I was met with the usual failed to boot “grub>” prompt.

At this point I opted to nuke and pave the Disk E installation and reinstall the new OS minus grub, it was a blank install so I was losing nothing but a few minutes.

Fix attempt 2:

I wiped Disk E with gparted and ran the OS installation again, this time I left out the boot partition leaving:
ext 4 – taking up all space minus the required swap space (mounted to / with no flags set)
swap – remaining 16Gb
#Upon hitting next there is a warning that no uefi setup is present and the OS might fail to boot, alone it would but grub on Disk A is going to handle things.

Installation completed and I restarted.

I booted back into the LiveUSB and ran through STEP 1 and STEP 2 again to reinstall/update grub to pick up the new OS.

At this point I should really have ran the –recheck option with grub-install to see if it all went well but I’d seen the OSs get picked up when I ran update-grub and had time to spare if I needed to re-do anything.
#It might have saved me some potential issues as shown below but my use case means this is an extremely minor issue

I exited the chroot and restarted the PC, this time I was greeted with the decrypt prompt for Disk A. After successfully entering the key the working grub menu appeared.

After the fix my boot process is:

PC powers up
Mobo UEFI splash screen
Disk decryption password prompt
Grub menu upon success, menu contains Linux A/alternative kernel, Linux B/alternative kernel, Options such as advanced.

No Windows installation is listed!.

Regarding Windows on grub:
I could go through the process of manually adding Windows to grub but for my use case I don’t think it’s worth the time. I have the Windows installation purely to play the occasional game that won’t run on Linux, this is a rarity and it doesn’t get booted very often so I’m fine with it not being a grub option. I can still access Windows from the UEFI boot menu and it works fine.