Lost grub thanks to windows

If you are new to Linux or new to Sabayon Linux and just not sure where to post, here ya go. Post without fear of being told to RTFM :)

Moderator: Moderators

Post Reply
hydran
Young Hen
Posts: 20
Joined: Sat Sep 01, 2018 4:50

Lost grub thanks to windows

Post by hydran » Tue May 12, 2020 6:00

Hey. I had to reinstall windows for one game that I can't get stable with proton. I installed it not only to a separate partition, but to an entirely physically separate hard drive from my Sabayon installation or anything related to Sabayon. It was just spare space on an old drive I used for media backup. Because windows is what it is and doesn't care about anything but itself it still managed to wipe out grub or otherwise completely take over boot. How can I get grub back? My root, boot, and home partitions should be fine right? I just can't boot to them currently.
I try to fix issues myself before bugging anyone on forums so I came by this possibility: bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi but it is specifically for Ubuntu. I installed an EXT4 driver for windows 10 and found \boot\grub\x86_64-efi\grub.efi. I definitely remember setting things up to use uefi and it being a GPT partition but /boot/efi is empty fwiw. Can I edit the above windows command to use that path? Is there another better solution?

manifesto
Growing Hen
Posts: 192
Joined: Mon Jul 19, 2010 22:21

Re: Lost grub thanks to windows

Post by manifesto » Tue May 12, 2020 9:35

Hi
You can probably do this from booting with a usb key, like the one you use to install sabayon.
Then you need to do some chroot and install grub again
There are various help on that, a quick search gave me this page which is more or less what you should do :
https://howtoubuntu.org/how-to-repair-r ... tu-live-cd

The only thing is that you are using EFI so the grub-install should say it with something like :

Code: Select all

grub2-install --efi-directory /boot/efi /dev/XXX 
Where XXX is your device not a partition.
Like /dev/sda, you can find out the device with a command like lsblk.]
On my laptop I have

Code: Select all

Sabayon ~ # lsblk 
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
nvme0n1     259:0    0   477G  0 disk 
├─nvme0n1p1 259:1    0   780M  0 part /boot/efi
├─nvme0n1p2 259:2    0     5G  0 part 
├─nvme0n1p3 259:3    0  14.9G  0 part [SWAP]
├─nvme0n1p4 259:4    0  23.3G  0 part 
├─nvme0n1p5 259:5    0  19.5G  0 part 
├─nvme0n1p6 259:6    0  29.3G  0 part /
It is nvme so name is nvme0n1, for standard drive it will be sda/sdb
On grub-install you need to use this sda NOT sda1 or whatever.

You dont need to run update grub, just grub2-install to change the boot loader.
The /boot/efi should be a partition on you linux disk.

/boot/efi must be a partition which is actually mounted on your /boot/efi linux partition

Code: Select all

Sabayon boot # findmnt /boot/efi
TARGET    SOURCE         FSTYPE OPTIONS
/boot/efi /dev/nvme0n1p1 vfat   rw,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro
Also depending on your HW if windows did not break the linux disk you may be able to change to efi device you boot from.
Check it out.

Hope this help.

hydran
Young Hen
Posts: 20
Joined: Sat Sep 01, 2018 4:50

Re: Lost grub thanks to windows

Post by hydran » Tue May 12, 2020 13:20

Thank you very much. I don't have time to try it right now but I appreciate your help.

dave_64
Advanced Hen
Posts: 235
Joined: Sun Feb 22, 2009 20:33

Re: Lost grub thanks to windows

Post by dave_64 » Sat May 16, 2020 4:10

I had something like that happen to me, and, if I remember correctly, I turned off the computer, unplugged the windows drive, and when I rebooted, Sabayon booted normally. It's not a permanent fix, but, it works until you have more time to try a different solution. I keep a bootable dvd (or thumbdrive) of SuperGrub 2, and that usually works for situations like yours. With SuperGrub 2 live dvd, you would not have to open up the case to unplug the windows drive.

User avatar
sabayonino
Sagely Hen
Posts: 3559
Joined: Sun Sep 21, 2008 1:12
Location: Italy
Contact:

Re: Lost grub thanks to windows

Post by sabayonino » Sat May 16, 2020 11:19

A quick search in the forum you 'll get your answer
See this
viewtopic.php?f=86&t=35790

Mount all Windows partitions manually (or using file-manager) and update grub config file

hydran
Young Hen
Posts: 20
Joined: Sat Sep 01, 2018 4:50

Re: Lost grub thanks to windows

Post by hydran » Thu May 28, 2020 17:54

sabayonino wrote:
Sat May 16, 2020 11:19
A quick search in the forum you 'll get your answer
See this
viewtopic.php?f=86&t=35790

Mount all Windows partitions manually (or using file-manager) and update grub config file
Thanks. I looked at that but I don't know how it helps me since I can't boot to Sabayon. If I select the drive that Grub is on it just flashes text for a second and then goes back to BIOS. Am I supposed to execute those instructions from the livedisk?

User avatar
sabayonino
Sagely Hen
Posts: 3559
Joined: Sun Sep 21, 2008 1:12
Location: Italy
Contact:

Re: Lost grub thanks to windows

Post by sabayonino » Thu May 28, 2020 20:00

Have you tried to select Sabayon harddrive to start from bios or press F8 (usually to select the boot option, depends on the bios manufactured)

Post Reply