How to fix corrupted grub?

 


For some reason sometimes grub can get corrupted.
If the grub is corrupted, you will not be able to login to the system.
You will see the screen shown in the picture above.
But this problem is not a serious problem in linux environment, it can be fixed easily.

If you encounter a screen like the one in the picture, let's start solving it.
We can do this in two sessions.
We can solve it with it, whether from any system written to USB or if you have another system installed.
The procedure we will do is the same in both, there is no difference.
When you switch from USB to live session or other installed system, open the terminal and start executing the commands below in order.
With this command we get root right.

sudo -i


This command gives an output similar to the one below. Here we specify the partition we want to recover. It may be different for you, for example: /dev/sda2
sudo blkid




Separate partition with this command.
You write which partition you want to recover instead of XX at the bottom. It may be different for you, for example: /dev/sda2
Then paste them all into the terminal.

mount /dev/sdXX /mnt &&
mount --bind /dev /mnt/dev &&
mount --bind /dev/pts /mnt/dev/pts &&
mount --bind /proc /mnt/proc &&
mount --bind /sys /mnt/sys


With this command, we enter the system we want to recover.
chroot /mnt


Now that we have entered the system, we can edit the group.
If your system is old grub (bios mbr), let's set up the group with the command below.
apt install grub-common grub-pc grub-pc-bin grub2-common -y && update-grub


If your system is new efi (UEFI) and 64bit, let's set up the group with the command below.
apt-get install --reinstall grub-efi-amd64 -y && update-grub


If you have done it properly so far, let's exit the system by entering all of the commands below to the terminal.
exit &&
umount /mnt/sys &&
umount /mnt/proc &&
umount /mnt/dev/pts &&
umount /mnt/dev &&
umount /mnt


After the last operation, restart the system with the command below and then remove the USB.
systemctl reboot


After this simple process, the corrupted grub will be fixed and you will be logged into the system.


No comments:

Post a Comment

Besgnulinux live login password

Normally, a password is not required, but it is needed in virtual machines or when switching from a session to the login screen.

Name: besgnulinux

Password: live

Last Comments

Categories

Blog Archive

BesGnuLinux

BesGnuLinux

Announcement

The latest versions will be shared on the Sourceforge site where we share the Besgnulinux distribution. Older versions have been removed due to lack of storage space.