#[Solved]Broken GRUB - Can i repair it from WSL?

11 messages · Page 1 of 1 (latest)

ruby jacinth
#

Hi, I am running Arch linux on disk A and Windows on disk B.
I have(had?) GRUB setup on disk A. I used to selected linux or windows from GRUB. After a windows install I automatically booted into windows. UEFI tells me theres two entries, one on each disks but both are called windows something. If I tried booting into the right disk into the windows something it just started a windows recovery tool saying I'm missing some files (duh, theres no windows there...).
I don't have a usb drive with me. I mean I have but its only 4gb and I tried running ubuntu 16. but it froze instantly and I couldnt run anything. So Im trying to fix it from WSL. But Im having trouble with grub-install. Please help.

ruby jacinth
#

Broken GRUB - Can i repair it from WSL?

#

szade@DESKTOP-4SBRCC0:/$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 389.8M 1 disk sdb 8:16 0 2G 0 disk [SWAP] sdc 8:32 0 1T 0 disk /snap /mnt/wslg/distro / sdd 8:48 0 238.5G 0 disk ├─sdd1 8:49 0 350M 0 part ├─sdd2 8:50 0 222.1G 0 part └─sdd3 8:51 0 16G 0 part

#

szade@DESKTOP-4SBRCC0:/$ sudo mount /dev/sdd2 /mnt szade@DESKTOP-4SBRCC0:/$ sudo mount /dev/sdd1 /mnt/boot szade@DESKTOP-4SBRCC0:/$ sudo mount --bind /dev /mnt/dev szade@DESKTOP-4SBRCC0:/$ sudo mount --bind /proc /mnt/proc szade@DESKTOP-4SBRCC0:/$ sudo mount --bind /sys /mnt/sys szade@DESKTOP-4SBRCC0:/$ sudo arch-chroot /mnt sudo: arch-chroot: command not found szade@DESKTOP-4SBRCC0:/$ sudo chroot /mnt [root@DESKTOP-4SBRCC0 /]# grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub --recheck Installing for x86_64-efi platform. EFI variables are not supported on this system. EFI variables are not supported on this system. grub-install: error: efibootmgr failed to register the boot entry: No such file or directory.

#

What am I doing wrong??

#

[root@DESKTOP-4SBRCC0 /]# grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi --no-nvram --removable Installing for x86_64-efi platform. Installation finished. No error reported.
This seem to have worked. I will check now.

#

Unfortunately it didn't. Still not other entries then the two windows ones. What now?

random bramble
#

4 gigs would be enough to install reinstall arch linux.

random bramble
ruby jacinth
#

I did not want to reinstall whole system just because of a deleted GRUB.
I finnaly was able to run a modern os on a 4GB pendrive - I used Debian as it was just over 3,5GB. With old ubuntus I wasnt even able to mount the drive for some reason.
I mounted directories and the efi variables thingie and then chrooted and was finnaly able to install grub correctly. The issue might have been the lack of efi variables from the start and possibly would have worked from WSL. After installing it started working just fine and even the configuration was kept (with thingies like grub theme).

#

In short: if you're looking for a live usb under 4GB use debian - it's small enough but have modern packages. Chroot remembering to mount the efi variables and then you should be fine to run grub-install.