Page 1 of 1

MX-15/16 Tutorial Restore grub in EFI or Legacy mode

Posted: Sun Mar 27, 2016 5:35 pm
by asinoro
Fast Fix MX Grub From MX
If you want to have the MX Grub, then from MX for Legacy Mode:
Boot repair from MX Tools,

Or open the terminal:

Code: Select all

sudo su

Then:

Code: Select all

grub-install /dev/sda ; update-grub


For Uefi Mode

Find first your Uefi partition to mount.

Code: Select all

sudo su

Code: Select all

parted -l

Where sdaX your EFI partition and run the command.

Code: Select all

mount /dev/sdaX /boot/efi ; grub-install /dev/sda ; update-grub


If for some reasons it doesn’t work follow steps 1.7 to 1.10. for Uefi or Legacy.


Method Reinstall broken Grub
Reinstall broken Grub from Live Medium, DVD, USB
When you run the MX Live Medium, DVD, USB, open the terminal.

Step1

1.1. Run the command,

Code: Select all

sudo su


1.2. Then the command, to see which partition has your OS.

Code: Select all

lsblk -f


1.3. After the command, where X is your OS partition.

Code: Select all

mount /dev/sdaX /mnt


1.4. Now you have to mount, bind and chroot mnt, with the follow command,

Code: Select all

mount --bind /dev /mnt/dev && mount --bind /sys /mnt/sys && mount --bind /proc /mnt/proc && chroot /mnt


1.5. To verify that you are in the right partition run the command.

Code: Select all

lsb_release -a


1.6. If for any reason something went wrong run exit command to execute again the procedure.

Code: Select all

exit


Fix Grub on Uefi mode

1.7. Reinstall grub-efi it will ask you to remove grub-pc and mx-bootrepair you will say yes because both are for legacy mode and you don't need them.

Code: Select all

apt-get install --reinstall grub-efi


1.8. Next is to find where is the EFI partition, run the command:

Code: Select all

parted -l

It would look like:
2 1050MB 1322MB 273MB fat32 EFI system partition boot, hidden, esp

1.9. Replace the command sdaX with yours and run.

Code: Select all

mount /dev/sdaX /boot/efi ; apt-get install --reinstall grub-efi-amd64 ; grub-install /dev/sda ; update-grub


Fix Grub on legacy mode

1.10. The most pc, laptop have the grub installed on sda where Windows are, and it is the correct way if you are dual boot with Windows. Enter the following command.

Code: Select all

apt-get install --reinstall grub ; grub-install /dev/sda ; update-grub

If you run from live medium you can restart to find again you OS.


If you like to remember your grub the last operating system you have used then:

1.11.

Code: Select all

sudo leafpad /etc/default/grub


Modify or add the missing commands:

Code: Select all

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true


Save and Close the document and next:

Code: Select all

sudo update-grub


Next time your PC or laptop will start with last OS you used.

Enjoy MX Linux.

Re: MX-15 Linux Tutorial Restore grub into EFI or Legacy mod

Posted: Sun Mar 27, 2016 6:03 pm
by Jerry3904
That's great, thanks. I hope someone will run it through so we can verify it.

Re: MX-15 Linux Tutorial Restore grub into EFI or Legacy mod

Posted: Sun Mar 27, 2016 6:17 pm
by kmathern
I don't see a reason for downloading Super Grub2 Disk, I think you can pretty much do the same from the MX-15 LiveUSB/LiveDVD. That would eliminate steps 1 thru 3.

And in step 6.2 you can run the partition-info command to show which one is the EFI System Partition (ESP)

Code: Select all

sudo partition-info all

Re: MX-15/16 Tutorial Restore grub in EFI or Legacy mode

Posted: Sat Dec 17, 2016 3:55 am
by asinoro
This tutorial has been updated and includes how to fix grub from live DVD, USB.