You are not logged in.

#1 2019-11-30 00:18:22

Xhendos
Member
Registered: 2017-08-30
Posts: 3

Reinstall GRUB bootloader after total disaster

I wanted to boot my laptop until I was shocked to find that no boot partition was found and was asked by UEFI to set up a boot partition or turn off the laptop.
After charging my laptop and try again there was still no success. For some magical reason GRUB bootloader is corrupt I guess.
I immediately set up a live USB to set up GRUB again.

lsblk prints the following.

NAME        MAJ:MIN          RM       SIZE       RO       TYPE   MOUNTPOINT
loop0         7:0            0       520.9M      1         loop
sda           8:0            0       931.5G      0         disk
|_sda1        8:1            0        600M       0         part     /boot
|_sda2        8:2            0        8G         0          part
|_sda3        8:3            0        922.9G     0          part    /
sdb           8:16           1        58G        0          disk
|_ sdb1       8:17           1        635M       0          part
|_ sdb2       8:18           1        64M        0          part

fdisk -l tells the following about the hard drive

Device       Start          End         Sectors    Size          Type     
/dev/sda1     2048        1230874        1228800   600M       EFI System
/dev/sda2     1230848     18008063       16777216   8G        Linux swap
/dev/sda3     18008064    1953525134    1935517071  922.9G   Linux filesystem

Device    Boot   Start    End    Sectors      Size     Id    Type
/dev/sdb1   *      0    1300479    1300480      635M    0   Empty
/dev/sdb2          164    131235   131072       64M    ef   EFI (FAT-12/16/32)

So far so good.
I use the following commands to mount the drives, chroot in the drive and create a GRUB config file.

mount /dev/sda3 /mnt
mount /dev/sda1 /mnt/boot
arch-chroot /mnt
cd boot/grub
grub-mkconfig > grub.cfg

Everything works except the last command, which outputs the following.

Generating grub configuration file ...
Found linux image /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
grub-probe: error: cannot find a GRUB drive for /dev/sdb1.   Check your device.map.
done

Why is it trying to find a GRUB drive for /dev/sdb1? This is my live USB. It should make a config for /dev/sda1 which is my boot partition of my hard drive.
Is it because fdisk -l prints an asterik in the boot column? If so, how would I change this so that /dev/sda1 is the boot?

Offline

#2 2019-11-30 01:48:33

ivo-a22
Member
Registered: 2018-11-26
Posts: 6

Re: Reinstall GRUB bootloader after total disaster

Why you are using grub > grub.cfg instead of  grub-mkconfig -o /boot/grub/grub.cfg ? Are you sure you ve been correctly chrrooted ?

Offline

#3 2019-11-30 02:37:15

Zod
Member
From: Hoosiertucky
Registered: 2019-03-10
Posts: 636

Re: Reinstall GRUB bootloader after total disaster

I don't see anything in your post that leads me to believe that you actually re/installed grub?

In other words, if grub is corrupted as you say, wouldn't doing grub-mkconfig without there being an installed grub be pointless?

Last edited by Zod (2019-11-30 02:39:03)

Offline

Board footer

Powered by FluxBB