Welcome!
Important information
-- Spectre and Meltdown vulnerabilities
-- Change in MX sources

News
-- MX Linux on social media: here
-- Mepis support still here

Current releases
-- MX-17.1 Final release info here
-- antiX-17 release info here

New users
-- Please read this first, and don't forget to add system and hardware information to posts!
-- Here are the Forum Rules

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

Topics relating to MX Docs and MX Videos
Post Reply
Message
Author
User avatar
asinoro
Forum Regular
Forum Regular
Posts: 494
Joined: Mon Feb 22, 2016 12:26 pm

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

#1 Post by asinoro » Sun Mar 27, 2016 5:35 pm

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.
Last edited by asinoro on Sat Oct 28, 2017 2:00 am, edited 40 times in total.
If your case is solved edit [Solved] to your initial post title to help other users.
Don’t forget to Backup your system
Fix your Grub

User avatar
Jerry3904
Forum Veteran
Forum Veteran
Posts: 22653
Joined: Wed Jul 19, 2006 6:13 am

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

#2 Post by Jerry3904 » Sun Mar 27, 2016 6:03 pm

That's great, thanks. I hope someone will run it through so we can verify it.
Production: 4.15.0-1-amd64, MX-17.1, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 8 GB, Kingston SSD 120 GB and WesternDigital 1TB
Testing: AAO 722: 4.15.0-1-386. MX-17.1, AMD C-60 APU, 4 GB

User avatar
kmathern
Forum Veteran
Forum Veteran
Posts: 9353
Joined: Wed Jul 12, 2006 2:26 pm

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

#3 Post by kmathern » Sun Mar 27, 2016 6:17 pm

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

User avatar
asinoro
Forum Regular
Forum Regular
Posts: 494
Joined: Mon Feb 22, 2016 12:26 pm

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

#4 Post by asinoro » Sat Dec 17, 2016 3:55 am

This tutorial has been updated and includes how to fix grub from live DVD, USB.
Last edited by asinoro on Tue Sep 19, 2017 1:30 am, edited 1 time in total.
If your case is solved edit [Solved] to your initial post title to help other users.
Don’t forget to Backup your system
Fix your Grub

Post Reply

Return to “Documentation and videos”