[SOLVED] Grub not working after installation (previously ubuntu partition)

sudo efibootmgr -c  -L "Windows Boot Manager" -l "\EFI\Microsoft\Boot\bootmgfw.efi" -d /dev/sdx -p y

You have to check if the Microsoft directory exists on your efi system partition (or esp), maybe /boot/efi, and you need to replace sdx and y with your settings respectively, from your lsblk it may be sda and 1.

3 Likes

I can’t find any Microsoft directory in my system.

$ ls /boot
grub                          initramfs-linux.img  vmlinuz-linux
initramfs-linux-fallback.img  intel-ucode.img

Also I searched for “windows” of “microsoft” files and can’t find any.
Is it possible is using legacy BIOS? I’m not sure how to check from linux, since I can’t boot into windows.

Please post the output of lsblk.

you dont find it on “boot”. you will find it in EFI or efi normally. but if you mounted your ESP partition as /boot then then a different story.

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 111,8G  0 disk 
├─sda1   8:1    0   512M  0 part 
└─sda2   8:2    0 111,3G  0 part /
sdb      8:16   0 931,5G  0 disk 
├─sdb1   8:17   0 831,5M  0 part 
├─sdb2   8:18   0 926,6G  0 part 
└─sdb3   8:19   0   4,1G  0 part 
sr0     11:0    1  1024M  0 rom

windows is installed onto sdb

Following the arch wiki I created /efi directory and mounted ESP to /efi.

According to this there is no esp. At least not mounted.

I know it has been a while, but I haven’t been able to restore my Windows partition yet. Would you be willing to help me out here?
I believe windows is installed (because it worked fine before the grub disaster), but not mounted (as you mentioned already). How should I proceed now? Thanks

$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 111,8G  0 disk 
├─sda1   8:1    0   512M  0 part 
└─sda2   8:2    0 111,3G  0 part /
sdb      8:16   0 931,5G  0 disk 
├─sdb1   8:17   0 831,5M  0 part 
├─sdb2   8:18   0 926,6G  0 part 
└─sdb3   8:19   0   4,1G  0 part 
sr0     11:0    1  1024M  0 rom  

and

$ efibootmgr 
BootCurrent: 0001
Timeout: 1 seconds
BootOrder: 0001,0004,0009
Boot0001* EndeavourOS-grub
Boot0004* UEFI OS
Boot0009  CD/DVD Drive 
Boot000A* Hard Drive 
Boot000B* USB Storage

Not to state the obvious, but have you installed and tried running os-prober?

  1. sudo pacman -S os-prober --needed
  2. sudo os-prober
  3. sudo grub-mkconfig -o /boot/grub/grub.cfg

You may have messed up the Windows boot record when installing Linux. See the ArchWiki on how to fix this.

1 Like

I didn’t know of os-prober. Also I have looked for it but there doesn’t seem to be a grub.cgf file anywhere.

$ sudo grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found theme: /boot/grub/themes/EndeavourOS/theme.txt
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/intel-ucode.img /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
done

Sorry, I forgot - you’ll have to mount your Windows partition before running os-prober.

See here and here for mounting instructions.

To temporarily mount /dev/sdb2 to /mnt, try …
sudo mount /dev/sdb2 /mnt or alternatively sudo ntfs-3g /dev/sdb2 /mnt before running os-prober.

[Edit] You may also have to mount /dev/sdb1

1 Like

grub.cfg should reside in /boot/grub/

You just successfully generated/updated grub.cfg :wink:

yes :smiley: but unfortunately without the windows partition…
i’m trying to figure out where to mount the /dev/sdb2. why did you say temporarily to /mnt ? should I change it afterwards?
this is sdb (where Windows is)
image

We just need os-prober to see it once and create a boot entry.

If /dev/sdb2 doesn’t work, you should try mounting /dev/sdb1 too.

Try this

  1. sudo mkdir /mnt/winboot
  2. sudo mkdir /mnt/win
  3. sudo mount /dev/sdb2 /mnt/win
  4. sudo mount /dev/sdb1 /mnt/winboot
  5. sudo pacman -S os-prober --needed
  6. sudo os-prober
  7. sudo grub-mkconfig -o /boot/grub/grub.cfg
  8. Reboot (and hope for the best)
  9. You can delete /mnt/winboot and mnt/win afterwards

Like i said before, if this doesn’t work you’ll probably have to rebuild the windows boot record frst.

It looks as if your Windows is installed in Legacy mode. There is no EFI system partition on your Windows’ disk. If so, and if EOS is installed in UEFI, then os-prober cannot see it.

1 Like

@gccallie I’m afraid pebcak is right. Sorry, I didn’t look closely enough at your partition info.

A quick solution could be using rEFInd as your boot loader. See this Wiki article on how to set it up.

Note: Don’t be put off by its default look - rEFInd can be themed to look absolutely beautiful.

2 Likes

OK, thank you. Do you have any idea on how to add a windows entry then?

Thank you for your suggestion. I tried installing and running rEFInd but it doesn’t seem to find Windows either. I tried mounting Windows as you suggested but now I’m stuck at this error.

sudo mount /dev/sdb2 /mnt/win
Windows is hibernated, refused to mount.
The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
Falling back to read-only mount because the NTFS partition is in an
unsafe state. Please resume and shutdown Windows fully (no hibernation
or fast restarting.)

I have never used rEFInd so I don’t know if it is capable of booting both legacy and UEFI at the same time. So perhaps @2000 can help you better with that.

My suggestion at this point is to check if your Windows is still functional/bootable. You can see if you bring up bios boot menu and boot into Windows.

edit: It seems that rEFInd supports legacy boot as well but there is a bit more involved: https://rodsbooks.com/refind/using.html#boot_options