How can I reinstall GRUB to the EFI partition?
I want to reinstall GRUB 2 and I found these instructions:
How to Repair, Restore, or Reinstall Grub 2 with a Ubuntu Live CD or USB.
In my case, the boot loader is installed in the EFI partition. If I use the commands provided in this guide, will GRUB be reinstalled to the EFI partition automatically, or will it be installed into the root partition where Ubuntu is installed ? Obviously, I do not want this to happen.
boot dual-boot grub2 partitioning uefi
|
show 5 more comments
I want to reinstall GRUB 2 and I found these instructions:
How to Repair, Restore, or Reinstall Grub 2 with a Ubuntu Live CD or USB.
In my case, the boot loader is installed in the EFI partition. If I use the commands provided in this guide, will GRUB be reinstalled to the EFI partition automatically, or will it be installed into the root partition where Ubuntu is installed ? Obviously, I do not want this to happen.
boot dual-boot grub2 partitioning uefi
3
The instructions in the provided link are valid for reinstalling GRUB in legacy BIOS mode only, this will not work in your case. To reinstall GRUB to an Ubuntu installation in EFI BIOS mode, please read my answer. :)
– cl-netbox
Sep 29 '16 at 16:36
Thank you very much! :) I have some questions: when I installed Ubuntu in my UEFI system, I found two entries in the bios. Is there a way to have a unic ubuntu entry? In case of MBR partition table (so no EFI or any other boot partition), can I use the same commands except for: sudo mount /dev/sd** /mnt/boot/efi ?
– Generoso
Sep 30 '16 at 10:11
You can try to remove the second Ubuntu entry with : sudo efibootmgr (lists all entries) | sudo efi bootmgr -b <entry-number> -B .... and to reinstall GRUB in legacy BIOS mode execute these commands : sudo mount /dev/sd** /mnt | sudo grub-install --boot-directory=/mnt/boot /dev/sd* (* = disk | ** = system partition) ! :)
– cl-netbox
Sep 30 '16 at 10:54
Perfect :) Anyway, having a UEFI system and so a EFI partition, is there a way to avoid getting grub overriden when I perform a new Windows installation?
– Generoso
Sep 30 '16 at 12:18
Well, Microsoft doesn't take care for anything else but their own products, so you can install Linux systems without doing any harm to Windows - unfortunately this isn't the case the other way around - so when you install Windows after you have installed Ubuntu, you have to restore the GRUB boot loader afterwards. :)
– cl-netbox
Sep 30 '16 at 13:23
|
show 5 more comments
I want to reinstall GRUB 2 and I found these instructions:
How to Repair, Restore, or Reinstall Grub 2 with a Ubuntu Live CD or USB.
In my case, the boot loader is installed in the EFI partition. If I use the commands provided in this guide, will GRUB be reinstalled to the EFI partition automatically, or will it be installed into the root partition where Ubuntu is installed ? Obviously, I do not want this to happen.
boot dual-boot grub2 partitioning uefi
I want to reinstall GRUB 2 and I found these instructions:
How to Repair, Restore, or Reinstall Grub 2 with a Ubuntu Live CD or USB.
In my case, the boot loader is installed in the EFI partition. If I use the commands provided in this guide, will GRUB be reinstalled to the EFI partition automatically, or will it be installed into the root partition where Ubuntu is installed ? Obviously, I do not want this to happen.
boot dual-boot grub2 partitioning uefi
boot dual-boot grub2 partitioning uefi
edited Mar 7 '18 at 17:19
cl-netbox
25.9k573114
25.9k573114
asked Sep 29 '16 at 14:40
GenerosoGeneroso
1691212
1691212
3
The instructions in the provided link are valid for reinstalling GRUB in legacy BIOS mode only, this will not work in your case. To reinstall GRUB to an Ubuntu installation in EFI BIOS mode, please read my answer. :)
– cl-netbox
Sep 29 '16 at 16:36
Thank you very much! :) I have some questions: when I installed Ubuntu in my UEFI system, I found two entries in the bios. Is there a way to have a unic ubuntu entry? In case of MBR partition table (so no EFI or any other boot partition), can I use the same commands except for: sudo mount /dev/sd** /mnt/boot/efi ?
– Generoso
Sep 30 '16 at 10:11
You can try to remove the second Ubuntu entry with : sudo efibootmgr (lists all entries) | sudo efi bootmgr -b <entry-number> -B .... and to reinstall GRUB in legacy BIOS mode execute these commands : sudo mount /dev/sd** /mnt | sudo grub-install --boot-directory=/mnt/boot /dev/sd* (* = disk | ** = system partition) ! :)
– cl-netbox
Sep 30 '16 at 10:54
Perfect :) Anyway, having a UEFI system and so a EFI partition, is there a way to avoid getting grub overriden when I perform a new Windows installation?
– Generoso
Sep 30 '16 at 12:18
Well, Microsoft doesn't take care for anything else but their own products, so you can install Linux systems without doing any harm to Windows - unfortunately this isn't the case the other way around - so when you install Windows after you have installed Ubuntu, you have to restore the GRUB boot loader afterwards. :)
– cl-netbox
Sep 30 '16 at 13:23
|
show 5 more comments
3
The instructions in the provided link are valid for reinstalling GRUB in legacy BIOS mode only, this will not work in your case. To reinstall GRUB to an Ubuntu installation in EFI BIOS mode, please read my answer. :)
– cl-netbox
Sep 29 '16 at 16:36
Thank you very much! :) I have some questions: when I installed Ubuntu in my UEFI system, I found two entries in the bios. Is there a way to have a unic ubuntu entry? In case of MBR partition table (so no EFI or any other boot partition), can I use the same commands except for: sudo mount /dev/sd** /mnt/boot/efi ?
– Generoso
Sep 30 '16 at 10:11
You can try to remove the second Ubuntu entry with : sudo efibootmgr (lists all entries) | sudo efi bootmgr -b <entry-number> -B .... and to reinstall GRUB in legacy BIOS mode execute these commands : sudo mount /dev/sd** /mnt | sudo grub-install --boot-directory=/mnt/boot /dev/sd* (* = disk | ** = system partition) ! :)
– cl-netbox
Sep 30 '16 at 10:54
Perfect :) Anyway, having a UEFI system and so a EFI partition, is there a way to avoid getting grub overriden when I perform a new Windows installation?
– Generoso
Sep 30 '16 at 12:18
Well, Microsoft doesn't take care for anything else but their own products, so you can install Linux systems without doing any harm to Windows - unfortunately this isn't the case the other way around - so when you install Windows after you have installed Ubuntu, you have to restore the GRUB boot loader afterwards. :)
– cl-netbox
Sep 30 '16 at 13:23
3
3
The instructions in the provided link are valid for reinstalling GRUB in legacy BIOS mode only, this will not work in your case. To reinstall GRUB to an Ubuntu installation in EFI BIOS mode, please read my answer. :)
– cl-netbox
Sep 29 '16 at 16:36
The instructions in the provided link are valid for reinstalling GRUB in legacy BIOS mode only, this will not work in your case. To reinstall GRUB to an Ubuntu installation in EFI BIOS mode, please read my answer. :)
– cl-netbox
Sep 29 '16 at 16:36
Thank you very much! :) I have some questions: when I installed Ubuntu in my UEFI system, I found two entries in the bios. Is there a way to have a unic ubuntu entry? In case of MBR partition table (so no EFI or any other boot partition), can I use the same commands except for: sudo mount /dev/sd** /mnt/boot/efi ?
– Generoso
Sep 30 '16 at 10:11
Thank you very much! :) I have some questions: when I installed Ubuntu in my UEFI system, I found two entries in the bios. Is there a way to have a unic ubuntu entry? In case of MBR partition table (so no EFI or any other boot partition), can I use the same commands except for: sudo mount /dev/sd** /mnt/boot/efi ?
– Generoso
Sep 30 '16 at 10:11
You can try to remove the second Ubuntu entry with : sudo efibootmgr (lists all entries) | sudo efi bootmgr -b <entry-number> -B .... and to reinstall GRUB in legacy BIOS mode execute these commands : sudo mount /dev/sd** /mnt | sudo grub-install --boot-directory=/mnt/boot /dev/sd* (* = disk | ** = system partition) ! :)
– cl-netbox
Sep 30 '16 at 10:54
You can try to remove the second Ubuntu entry with : sudo efibootmgr (lists all entries) | sudo efi bootmgr -b <entry-number> -B .... and to reinstall GRUB in legacy BIOS mode execute these commands : sudo mount /dev/sd** /mnt | sudo grub-install --boot-directory=/mnt/boot /dev/sd* (* = disk | ** = system partition) ! :)
– cl-netbox
Sep 30 '16 at 10:54
Perfect :) Anyway, having a UEFI system and so a EFI partition, is there a way to avoid getting grub overriden when I perform a new Windows installation?
– Generoso
Sep 30 '16 at 12:18
Perfect :) Anyway, having a UEFI system and so a EFI partition, is there a way to avoid getting grub overriden when I perform a new Windows installation?
– Generoso
Sep 30 '16 at 12:18
Well, Microsoft doesn't take care for anything else but their own products, so you can install Linux systems without doing any harm to Windows - unfortunately this isn't the case the other way around - so when you install Windows after you have installed Ubuntu, you have to restore the GRUB boot loader afterwards. :)
– cl-netbox
Sep 30 '16 at 13:23
Well, Microsoft doesn't take care for anything else but their own products, so you can install Linux systems without doing any harm to Windows - unfortunately this isn't the case the other way around - so when you install Windows after you have installed Ubuntu, you have to restore the GRUB boot loader afterwards. :)
– cl-netbox
Sep 30 '16 at 13:23
|
show 5 more comments
7 Answers
7
active
oldest
votes
Reinstall the GRUB boot loader to your Ubuntu installation in EFI mode this way ...
Boot from the Ubuntu installation medium and select 'Try Ubuntu without installing'.
(Boot your install medium in EFI mode, select the Ubuntu entry with UEFI in front.)
Once you are on the Live desktop, open a terminal and execute these commands :
sudo mount /dev/sdXXX /mnt
sudo mount /dev/sdXX /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt
grub-install /dev/sdX
update-grub
Note : sdX
= disk | sdXX
= efi partition | sdXXX
= system partition
To identify the partitions use GParted, the tool is included in the installation medium.
After having run the commands GRUB will be installed in the separate EFI partition.
+1 but why don't you install from Ubuntu itself?
– Mark Yisri
Nov 8 '16 at 13:55
1
@MarkYisri : Thank you very much ! :) Because it is the safest way to reinstall the GRUB boot loader without corrupting things and in case the system does not boot properly ... the only way to do it ! :)
– cl-netbox
Nov 8 '16 at 13:58
After exchanging an Intel NUC the new device didn't start from the old HDD. This fixed it. You made my day - thanks a lot!
– Möhre
Oct 8 '17 at 19:06
In this solution, how does 'grub-install' know it is supposed to install in EFI mode?
– user334639
Oct 12 '17 at 0:38
@user334639 This happens right because the EFI partition gets recognized automatically ... :)
– cl-netbox
Oct 12 '17 at 10:23
|
show 8 more comments
Thanks to @cl-netbox for the instructions!
After I upgraded (Linux Mint 18.2 Sonya to 18.3 Sylvia) my system wouldn't boot so I followed the instructions above but still no success. I noticed however that my machine has /boot in a separate partition (possibly because I am using LVM) so my slightly modified process was:
sudo mount /dev/sdXXX /mnt
sudo mount /dev/sdXY /mnt/boot
sudo mount /dev/sdXX /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt
grub-install /dev/sdX
update-grub
Note : sdX = disk | sdXX = efi partition | sdXY = boot partition | sdXXX = system partition
This worked for me! Thanks Rob
– GustavMahler
Jul 2 '18 at 18:01
I had a running Ubuntu Bionic system on which I accidentally did rm -Rf /boot/efi ! My system was still running, so I tried using the last two commands (grub-install /dev/mapper/ubuntu--vg-root AND update-grub). Rebooted, and everything work perfectly. Phewy and thanks :)
– Roel
Jul 29 '18 at 22:04
add a comment |
this is the only way that worked for me:
(System: sdb8, boot: sdb6, efi: sdb2)
sudo mount /dev/sdb8 /mnt
sudo mount /dev/sdb6 /mnt/boot
sudo mount /dev/sdb2 /mnt/boot/efi
sudo mount --bind /dev /mnt/dev &&
sudo mount --bind /dev/pts /mnt/dev/pts &&
sudo mount --bind /proc /mnt/proc &&
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
grub-install --target=x86_64-efi /dev/sdb
grub-install --recheck /dev/sdb
exit &&
sudo umount /mnt/sys &&
sudo umount /mnt/proc &&
sudo umount /mnt/dev/pts &&
sudo umount /mnt/dev &&
sudo umount /mnt
add a comment |
in addition to ci-netbox answer.
If your pendrive OS version does not match the one that is installed on the disk, grub-install may have difficulties to identify the right grub installation:
$ sudo chroot /mnt
# grub-install /dev/sdX
grub-install: error: /usr/lib/grub/i386-pc/modinfo.sh doesn't exist.
Please specify --target or --directory.
Try to identify manually the installation to use
# ls /usr/lib/grub/
grub-mkconfig_lib x86_64-efi x86_64-efi-signed
Then restart grub-install :
# grub-install --target=x86_64-efi /dev/sdX
Installing for x86_64-efi platform.
Installation finished. No error reported.
add a comment |
If you happen to lose the EFI partition, it's easy to get it back. You can use fdisk
or parted
to create a new GPT partition with type "EFI partition (1)" and format it with:
sudo mkfs.msdos /dev/sdX
then mount it and you can follow run:
sudo grub-install /dev/sdX
as in other solutions.
add a comment |
Also, if booting from live cd to recover it might happen that you are missing grub-efi-amd64-bin package and then line
"grub-install --target=x86_64-efi /dev/sdb"
fails with error message: "grub-install: error: /usr/lib/grub/x86_64-efi/modinfo.sh doesn't exist. Please specify --target or --directory."
In this case run this outside of chroot
sudo apt get grub-efi-amd64-bin
and then add /usr/lib/grub/x86_64-efi to chroot mounts.
BTW "/dev/sdb" param is obsolete and is being ignored.
add a comment |
so my guess is the reason for the problem is that Ubuntu installation is not mounting the efi partition if fstab. and updates grub. on update.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f831216%2fhow-can-i-reinstall-grub-to-the-efi-partition%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
7 Answers
7
active
oldest
votes
7 Answers
7
active
oldest
votes
active
oldest
votes
active
oldest
votes
Reinstall the GRUB boot loader to your Ubuntu installation in EFI mode this way ...
Boot from the Ubuntu installation medium and select 'Try Ubuntu without installing'.
(Boot your install medium in EFI mode, select the Ubuntu entry with UEFI in front.)
Once you are on the Live desktop, open a terminal and execute these commands :
sudo mount /dev/sdXXX /mnt
sudo mount /dev/sdXX /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt
grub-install /dev/sdX
update-grub
Note : sdX
= disk | sdXX
= efi partition | sdXXX
= system partition
To identify the partitions use GParted, the tool is included in the installation medium.
After having run the commands GRUB will be installed in the separate EFI partition.
+1 but why don't you install from Ubuntu itself?
– Mark Yisri
Nov 8 '16 at 13:55
1
@MarkYisri : Thank you very much ! :) Because it is the safest way to reinstall the GRUB boot loader without corrupting things and in case the system does not boot properly ... the only way to do it ! :)
– cl-netbox
Nov 8 '16 at 13:58
After exchanging an Intel NUC the new device didn't start from the old HDD. This fixed it. You made my day - thanks a lot!
– Möhre
Oct 8 '17 at 19:06
In this solution, how does 'grub-install' know it is supposed to install in EFI mode?
– user334639
Oct 12 '17 at 0:38
@user334639 This happens right because the EFI partition gets recognized automatically ... :)
– cl-netbox
Oct 12 '17 at 10:23
|
show 8 more comments
Reinstall the GRUB boot loader to your Ubuntu installation in EFI mode this way ...
Boot from the Ubuntu installation medium and select 'Try Ubuntu without installing'.
(Boot your install medium in EFI mode, select the Ubuntu entry with UEFI in front.)
Once you are on the Live desktop, open a terminal and execute these commands :
sudo mount /dev/sdXXX /mnt
sudo mount /dev/sdXX /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt
grub-install /dev/sdX
update-grub
Note : sdX
= disk | sdXX
= efi partition | sdXXX
= system partition
To identify the partitions use GParted, the tool is included in the installation medium.
After having run the commands GRUB will be installed in the separate EFI partition.
+1 but why don't you install from Ubuntu itself?
– Mark Yisri
Nov 8 '16 at 13:55
1
@MarkYisri : Thank you very much ! :) Because it is the safest way to reinstall the GRUB boot loader without corrupting things and in case the system does not boot properly ... the only way to do it ! :)
– cl-netbox
Nov 8 '16 at 13:58
After exchanging an Intel NUC the new device didn't start from the old HDD. This fixed it. You made my day - thanks a lot!
– Möhre
Oct 8 '17 at 19:06
In this solution, how does 'grub-install' know it is supposed to install in EFI mode?
– user334639
Oct 12 '17 at 0:38
@user334639 This happens right because the EFI partition gets recognized automatically ... :)
– cl-netbox
Oct 12 '17 at 10:23
|
show 8 more comments
Reinstall the GRUB boot loader to your Ubuntu installation in EFI mode this way ...
Boot from the Ubuntu installation medium and select 'Try Ubuntu without installing'.
(Boot your install medium in EFI mode, select the Ubuntu entry with UEFI in front.)
Once you are on the Live desktop, open a terminal and execute these commands :
sudo mount /dev/sdXXX /mnt
sudo mount /dev/sdXX /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt
grub-install /dev/sdX
update-grub
Note : sdX
= disk | sdXX
= efi partition | sdXXX
= system partition
To identify the partitions use GParted, the tool is included in the installation medium.
After having run the commands GRUB will be installed in the separate EFI partition.
Reinstall the GRUB boot loader to your Ubuntu installation in EFI mode this way ...
Boot from the Ubuntu installation medium and select 'Try Ubuntu without installing'.
(Boot your install medium in EFI mode, select the Ubuntu entry with UEFI in front.)
Once you are on the Live desktop, open a terminal and execute these commands :
sudo mount /dev/sdXXX /mnt
sudo mount /dev/sdXX /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt
grub-install /dev/sdX
update-grub
Note : sdX
= disk | sdXX
= efi partition | sdXXX
= system partition
To identify the partitions use GParted, the tool is included in the installation medium.
After having run the commands GRUB will be installed in the separate EFI partition.
edited Mar 7 '18 at 16:48
answered Sep 29 '16 at 15:51
cl-netboxcl-netbox
25.9k573114
25.9k573114
+1 but why don't you install from Ubuntu itself?
– Mark Yisri
Nov 8 '16 at 13:55
1
@MarkYisri : Thank you very much ! :) Because it is the safest way to reinstall the GRUB boot loader without corrupting things and in case the system does not boot properly ... the only way to do it ! :)
– cl-netbox
Nov 8 '16 at 13:58
After exchanging an Intel NUC the new device didn't start from the old HDD. This fixed it. You made my day - thanks a lot!
– Möhre
Oct 8 '17 at 19:06
In this solution, how does 'grub-install' know it is supposed to install in EFI mode?
– user334639
Oct 12 '17 at 0:38
@user334639 This happens right because the EFI partition gets recognized automatically ... :)
– cl-netbox
Oct 12 '17 at 10:23
|
show 8 more comments
+1 but why don't you install from Ubuntu itself?
– Mark Yisri
Nov 8 '16 at 13:55
1
@MarkYisri : Thank you very much ! :) Because it is the safest way to reinstall the GRUB boot loader without corrupting things and in case the system does not boot properly ... the only way to do it ! :)
– cl-netbox
Nov 8 '16 at 13:58
After exchanging an Intel NUC the new device didn't start from the old HDD. This fixed it. You made my day - thanks a lot!
– Möhre
Oct 8 '17 at 19:06
In this solution, how does 'grub-install' know it is supposed to install in EFI mode?
– user334639
Oct 12 '17 at 0:38
@user334639 This happens right because the EFI partition gets recognized automatically ... :)
– cl-netbox
Oct 12 '17 at 10:23
+1 but why don't you install from Ubuntu itself?
– Mark Yisri
Nov 8 '16 at 13:55
+1 but why don't you install from Ubuntu itself?
– Mark Yisri
Nov 8 '16 at 13:55
1
1
@MarkYisri : Thank you very much ! :) Because it is the safest way to reinstall the GRUB boot loader without corrupting things and in case the system does not boot properly ... the only way to do it ! :)
– cl-netbox
Nov 8 '16 at 13:58
@MarkYisri : Thank you very much ! :) Because it is the safest way to reinstall the GRUB boot loader without corrupting things and in case the system does not boot properly ... the only way to do it ! :)
– cl-netbox
Nov 8 '16 at 13:58
After exchanging an Intel NUC the new device didn't start from the old HDD. This fixed it. You made my day - thanks a lot!
– Möhre
Oct 8 '17 at 19:06
After exchanging an Intel NUC the new device didn't start from the old HDD. This fixed it. You made my day - thanks a lot!
– Möhre
Oct 8 '17 at 19:06
In this solution, how does 'grub-install' know it is supposed to install in EFI mode?
– user334639
Oct 12 '17 at 0:38
In this solution, how does 'grub-install' know it is supposed to install in EFI mode?
– user334639
Oct 12 '17 at 0:38
@user334639 This happens right because the EFI partition gets recognized automatically ... :)
– cl-netbox
Oct 12 '17 at 10:23
@user334639 This happens right because the EFI partition gets recognized automatically ... :)
– cl-netbox
Oct 12 '17 at 10:23
|
show 8 more comments
Thanks to @cl-netbox for the instructions!
After I upgraded (Linux Mint 18.2 Sonya to 18.3 Sylvia) my system wouldn't boot so I followed the instructions above but still no success. I noticed however that my machine has /boot in a separate partition (possibly because I am using LVM) so my slightly modified process was:
sudo mount /dev/sdXXX /mnt
sudo mount /dev/sdXY /mnt/boot
sudo mount /dev/sdXX /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt
grub-install /dev/sdX
update-grub
Note : sdX = disk | sdXX = efi partition | sdXY = boot partition | sdXXX = system partition
This worked for me! Thanks Rob
– GustavMahler
Jul 2 '18 at 18:01
I had a running Ubuntu Bionic system on which I accidentally did rm -Rf /boot/efi ! My system was still running, so I tried using the last two commands (grub-install /dev/mapper/ubuntu--vg-root AND update-grub). Rebooted, and everything work perfectly. Phewy and thanks :)
– Roel
Jul 29 '18 at 22:04
add a comment |
Thanks to @cl-netbox for the instructions!
After I upgraded (Linux Mint 18.2 Sonya to 18.3 Sylvia) my system wouldn't boot so I followed the instructions above but still no success. I noticed however that my machine has /boot in a separate partition (possibly because I am using LVM) so my slightly modified process was:
sudo mount /dev/sdXXX /mnt
sudo mount /dev/sdXY /mnt/boot
sudo mount /dev/sdXX /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt
grub-install /dev/sdX
update-grub
Note : sdX = disk | sdXX = efi partition | sdXY = boot partition | sdXXX = system partition
This worked for me! Thanks Rob
– GustavMahler
Jul 2 '18 at 18:01
I had a running Ubuntu Bionic system on which I accidentally did rm -Rf /boot/efi ! My system was still running, so I tried using the last two commands (grub-install /dev/mapper/ubuntu--vg-root AND update-grub). Rebooted, and everything work perfectly. Phewy and thanks :)
– Roel
Jul 29 '18 at 22:04
add a comment |
Thanks to @cl-netbox for the instructions!
After I upgraded (Linux Mint 18.2 Sonya to 18.3 Sylvia) my system wouldn't boot so I followed the instructions above but still no success. I noticed however that my machine has /boot in a separate partition (possibly because I am using LVM) so my slightly modified process was:
sudo mount /dev/sdXXX /mnt
sudo mount /dev/sdXY /mnt/boot
sudo mount /dev/sdXX /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt
grub-install /dev/sdX
update-grub
Note : sdX = disk | sdXX = efi partition | sdXY = boot partition | sdXXX = system partition
Thanks to @cl-netbox for the instructions!
After I upgraded (Linux Mint 18.2 Sonya to 18.3 Sylvia) my system wouldn't boot so I followed the instructions above but still no success. I noticed however that my machine has /boot in a separate partition (possibly because I am using LVM) so my slightly modified process was:
sudo mount /dev/sdXXX /mnt
sudo mount /dev/sdXY /mnt/boot
sudo mount /dev/sdXX /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt
grub-install /dev/sdX
update-grub
Note : sdX = disk | sdXX = efi partition | sdXY = boot partition | sdXXX = system partition
answered Jun 22 '18 at 22:32
Rob PearmanRob Pearman
211
211
This worked for me! Thanks Rob
– GustavMahler
Jul 2 '18 at 18:01
I had a running Ubuntu Bionic system on which I accidentally did rm -Rf /boot/efi ! My system was still running, so I tried using the last two commands (grub-install /dev/mapper/ubuntu--vg-root AND update-grub). Rebooted, and everything work perfectly. Phewy and thanks :)
– Roel
Jul 29 '18 at 22:04
add a comment |
This worked for me! Thanks Rob
– GustavMahler
Jul 2 '18 at 18:01
I had a running Ubuntu Bionic system on which I accidentally did rm -Rf /boot/efi ! My system was still running, so I tried using the last two commands (grub-install /dev/mapper/ubuntu--vg-root AND update-grub). Rebooted, and everything work perfectly. Phewy and thanks :)
– Roel
Jul 29 '18 at 22:04
This worked for me! Thanks Rob
– GustavMahler
Jul 2 '18 at 18:01
This worked for me! Thanks Rob
– GustavMahler
Jul 2 '18 at 18:01
I had a running Ubuntu Bionic system on which I accidentally did rm -Rf /boot/efi ! My system was still running, so I tried using the last two commands (grub-install /dev/mapper/ubuntu--vg-root AND update-grub). Rebooted, and everything work perfectly. Phewy and thanks :)
– Roel
Jul 29 '18 at 22:04
I had a running Ubuntu Bionic system on which I accidentally did rm -Rf /boot/efi ! My system was still running, so I tried using the last two commands (grub-install /dev/mapper/ubuntu--vg-root AND update-grub). Rebooted, and everything work perfectly. Phewy and thanks :)
– Roel
Jul 29 '18 at 22:04
add a comment |
this is the only way that worked for me:
(System: sdb8, boot: sdb6, efi: sdb2)
sudo mount /dev/sdb8 /mnt
sudo mount /dev/sdb6 /mnt/boot
sudo mount /dev/sdb2 /mnt/boot/efi
sudo mount --bind /dev /mnt/dev &&
sudo mount --bind /dev/pts /mnt/dev/pts &&
sudo mount --bind /proc /mnt/proc &&
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
grub-install --target=x86_64-efi /dev/sdb
grub-install --recheck /dev/sdb
exit &&
sudo umount /mnt/sys &&
sudo umount /mnt/proc &&
sudo umount /mnt/dev/pts &&
sudo umount /mnt/dev &&
sudo umount /mnt
add a comment |
this is the only way that worked for me:
(System: sdb8, boot: sdb6, efi: sdb2)
sudo mount /dev/sdb8 /mnt
sudo mount /dev/sdb6 /mnt/boot
sudo mount /dev/sdb2 /mnt/boot/efi
sudo mount --bind /dev /mnt/dev &&
sudo mount --bind /dev/pts /mnt/dev/pts &&
sudo mount --bind /proc /mnt/proc &&
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
grub-install --target=x86_64-efi /dev/sdb
grub-install --recheck /dev/sdb
exit &&
sudo umount /mnt/sys &&
sudo umount /mnt/proc &&
sudo umount /mnt/dev/pts &&
sudo umount /mnt/dev &&
sudo umount /mnt
add a comment |
this is the only way that worked for me:
(System: sdb8, boot: sdb6, efi: sdb2)
sudo mount /dev/sdb8 /mnt
sudo mount /dev/sdb6 /mnt/boot
sudo mount /dev/sdb2 /mnt/boot/efi
sudo mount --bind /dev /mnt/dev &&
sudo mount --bind /dev/pts /mnt/dev/pts &&
sudo mount --bind /proc /mnt/proc &&
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
grub-install --target=x86_64-efi /dev/sdb
grub-install --recheck /dev/sdb
exit &&
sudo umount /mnt/sys &&
sudo umount /mnt/proc &&
sudo umount /mnt/dev/pts &&
sudo umount /mnt/dev &&
sudo umount /mnt
this is the only way that worked for me:
(System: sdb8, boot: sdb6, efi: sdb2)
sudo mount /dev/sdb8 /mnt
sudo mount /dev/sdb6 /mnt/boot
sudo mount /dev/sdb2 /mnt/boot/efi
sudo mount --bind /dev /mnt/dev &&
sudo mount --bind /dev/pts /mnt/dev/pts &&
sudo mount --bind /proc /mnt/proc &&
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
grub-install --target=x86_64-efi /dev/sdb
grub-install --recheck /dev/sdb
exit &&
sudo umount /mnt/sys &&
sudo umount /mnt/proc &&
sudo umount /mnt/dev/pts &&
sudo umount /mnt/dev &&
sudo umount /mnt
answered Aug 28 '18 at 20:07
Chilu PereiraChilu Pereira
211
211
add a comment |
add a comment |
in addition to ci-netbox answer.
If your pendrive OS version does not match the one that is installed on the disk, grub-install may have difficulties to identify the right grub installation:
$ sudo chroot /mnt
# grub-install /dev/sdX
grub-install: error: /usr/lib/grub/i386-pc/modinfo.sh doesn't exist.
Please specify --target or --directory.
Try to identify manually the installation to use
# ls /usr/lib/grub/
grub-mkconfig_lib x86_64-efi x86_64-efi-signed
Then restart grub-install :
# grub-install --target=x86_64-efi /dev/sdX
Installing for x86_64-efi platform.
Installation finished. No error reported.
add a comment |
in addition to ci-netbox answer.
If your pendrive OS version does not match the one that is installed on the disk, grub-install may have difficulties to identify the right grub installation:
$ sudo chroot /mnt
# grub-install /dev/sdX
grub-install: error: /usr/lib/grub/i386-pc/modinfo.sh doesn't exist.
Please specify --target or --directory.
Try to identify manually the installation to use
# ls /usr/lib/grub/
grub-mkconfig_lib x86_64-efi x86_64-efi-signed
Then restart grub-install :
# grub-install --target=x86_64-efi /dev/sdX
Installing for x86_64-efi platform.
Installation finished. No error reported.
add a comment |
in addition to ci-netbox answer.
If your pendrive OS version does not match the one that is installed on the disk, grub-install may have difficulties to identify the right grub installation:
$ sudo chroot /mnt
# grub-install /dev/sdX
grub-install: error: /usr/lib/grub/i386-pc/modinfo.sh doesn't exist.
Please specify --target or --directory.
Try to identify manually the installation to use
# ls /usr/lib/grub/
grub-mkconfig_lib x86_64-efi x86_64-efi-signed
Then restart grub-install :
# grub-install --target=x86_64-efi /dev/sdX
Installing for x86_64-efi platform.
Installation finished. No error reported.
in addition to ci-netbox answer.
If your pendrive OS version does not match the one that is installed on the disk, grub-install may have difficulties to identify the right grub installation:
$ sudo chroot /mnt
# grub-install /dev/sdX
grub-install: error: /usr/lib/grub/i386-pc/modinfo.sh doesn't exist.
Please specify --target or --directory.
Try to identify manually the installation to use
# ls /usr/lib/grub/
grub-mkconfig_lib x86_64-efi x86_64-efi-signed
Then restart grub-install :
# grub-install --target=x86_64-efi /dev/sdX
Installing for x86_64-efi platform.
Installation finished. No error reported.
answered Dec 7 '17 at 23:53
EmmanuelEmmanuel
1,123911
1,123911
add a comment |
add a comment |
If you happen to lose the EFI partition, it's easy to get it back. You can use fdisk
or parted
to create a new GPT partition with type "EFI partition (1)" and format it with:
sudo mkfs.msdos /dev/sdX
then mount it and you can follow run:
sudo grub-install /dev/sdX
as in other solutions.
add a comment |
If you happen to lose the EFI partition, it's easy to get it back. You can use fdisk
or parted
to create a new GPT partition with type "EFI partition (1)" and format it with:
sudo mkfs.msdos /dev/sdX
then mount it and you can follow run:
sudo grub-install /dev/sdX
as in other solutions.
add a comment |
If you happen to lose the EFI partition, it's easy to get it back. You can use fdisk
or parted
to create a new GPT partition with type "EFI partition (1)" and format it with:
sudo mkfs.msdos /dev/sdX
then mount it and you can follow run:
sudo grub-install /dev/sdX
as in other solutions.
If you happen to lose the EFI partition, it's easy to get it back. You can use fdisk
or parted
to create a new GPT partition with type "EFI partition (1)" and format it with:
sudo mkfs.msdos /dev/sdX
then mount it and you can follow run:
sudo grub-install /dev/sdX
as in other solutions.
edited Jul 17 '18 at 11:48
Stephen Rauch
1,1546716
1,1546716
answered Jul 17 '18 at 9:04
cengiquecengique
1
1
add a comment |
add a comment |
Also, if booting from live cd to recover it might happen that you are missing grub-efi-amd64-bin package and then line
"grub-install --target=x86_64-efi /dev/sdb"
fails with error message: "grub-install: error: /usr/lib/grub/x86_64-efi/modinfo.sh doesn't exist. Please specify --target or --directory."
In this case run this outside of chroot
sudo apt get grub-efi-amd64-bin
and then add /usr/lib/grub/x86_64-efi to chroot mounts.
BTW "/dev/sdb" param is obsolete and is being ignored.
add a comment |
Also, if booting from live cd to recover it might happen that you are missing grub-efi-amd64-bin package and then line
"grub-install --target=x86_64-efi /dev/sdb"
fails with error message: "grub-install: error: /usr/lib/grub/x86_64-efi/modinfo.sh doesn't exist. Please specify --target or --directory."
In this case run this outside of chroot
sudo apt get grub-efi-amd64-bin
and then add /usr/lib/grub/x86_64-efi to chroot mounts.
BTW "/dev/sdb" param is obsolete and is being ignored.
add a comment |
Also, if booting from live cd to recover it might happen that you are missing grub-efi-amd64-bin package and then line
"grub-install --target=x86_64-efi /dev/sdb"
fails with error message: "grub-install: error: /usr/lib/grub/x86_64-efi/modinfo.sh doesn't exist. Please specify --target or --directory."
In this case run this outside of chroot
sudo apt get grub-efi-amd64-bin
and then add /usr/lib/grub/x86_64-efi to chroot mounts.
BTW "/dev/sdb" param is obsolete and is being ignored.
Also, if booting from live cd to recover it might happen that you are missing grub-efi-amd64-bin package and then line
"grub-install --target=x86_64-efi /dev/sdb"
fails with error message: "grub-install: error: /usr/lib/grub/x86_64-efi/modinfo.sh doesn't exist. Please specify --target or --directory."
In this case run this outside of chroot
sudo apt get grub-efi-amd64-bin
and then add /usr/lib/grub/x86_64-efi to chroot mounts.
BTW "/dev/sdb" param is obsolete and is being ignored.
answered Jan 12 at 1:15
mprotmprot
312
312
add a comment |
add a comment |
so my guess is the reason for the problem is that Ubuntu installation is not mounting the efi partition if fstab. and updates grub. on update.
add a comment |
so my guess is the reason for the problem is that Ubuntu installation is not mounting the efi partition if fstab. and updates grub. on update.
add a comment |
so my guess is the reason for the problem is that Ubuntu installation is not mounting the efi partition if fstab. and updates grub. on update.
so my guess is the reason for the problem is that Ubuntu installation is not mounting the efi partition if fstab. and updates grub. on update.
answered Jan 20 at 2:27
Shimon DoodkinShimon Doodkin
16114
16114
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f831216%2fhow-can-i-reinstall-grub-to-the-efi-partition%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
The instructions in the provided link are valid for reinstalling GRUB in legacy BIOS mode only, this will not work in your case. To reinstall GRUB to an Ubuntu installation in EFI BIOS mode, please read my answer. :)
– cl-netbox
Sep 29 '16 at 16:36
Thank you very much! :) I have some questions: when I installed Ubuntu in my UEFI system, I found two entries in the bios. Is there a way to have a unic ubuntu entry? In case of MBR partition table (so no EFI or any other boot partition), can I use the same commands except for: sudo mount /dev/sd** /mnt/boot/efi ?
– Generoso
Sep 30 '16 at 10:11
You can try to remove the second Ubuntu entry with : sudo efibootmgr (lists all entries) | sudo efi bootmgr -b <entry-number> -B .... and to reinstall GRUB in legacy BIOS mode execute these commands : sudo mount /dev/sd** /mnt | sudo grub-install --boot-directory=/mnt/boot /dev/sd* (* = disk | ** = system partition) ! :)
– cl-netbox
Sep 30 '16 at 10:54
Perfect :) Anyway, having a UEFI system and so a EFI partition, is there a way to avoid getting grub overriden when I perform a new Windows installation?
– Generoso
Sep 30 '16 at 12:18
Well, Microsoft doesn't take care for anything else but their own products, so you can install Linux systems without doing any harm to Windows - unfortunately this isn't the case the other way around - so when you install Windows after you have installed Ubuntu, you have to restore the GRUB boot loader afterwards. :)
– cl-netbox
Sep 30 '16 at 13:23