Grub install ошибка не удалось найти каталог efi

Device          Start        End   Sectors   Size Type
/dev/sda1        2048    1050623   1048576   512M EFI System
/dev/sda2     1050624  837228543 836177920 398.7G Linux filesystem
/dev/sda3  1452748800 1465147391  12398592   5.9G Linux swap
/dev/sda4   837228544 1452748799 615520256 293.5G Microsoft basic data

Partition table entries are not in disk order.


Disk /dev/sdb: 14.6 GiB, 15636364800 bytes, 30539775 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00378159


Device     Boot Start      End  Sectors  Size Id Type
/dev/sdb1  *     2048 30539774 30537727 14.6G  c W95 FAT32 (LBA)

I am kinda lost here. I am not very experienced with ubuntu and might need a little detailed solution. I installed Windows 10 after ubuntu 16.10 and when I try to reinstall grub2 and it gives me the following error:
Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Please help!

Tony Lancer's user avatar

asked Nov 25, 2016 at 13:49

Evion Cane's user avatar

10

Try this:

Boot the Ubuntu Live Usb-Dvd.

Open a terminal,

Press Ctrl+Alt+T

Run it:

sudo -i
mount /dev/sda2 /mnt
mount /dev/sda1 /mnt/boot/efi
grub-install --boot-directory=/mnt/boot --bootloader-id=ubuntu  --target=x86_64-efi --efi-directory=/mnt/boot/efi  
reboot

answered Nov 25, 2016 at 15:28

kyodake's user avatar

kyodakekyodake

15.1k3 gold badges40 silver badges48 bronze badges

5

The root cause of your problem is Temporary failure resolving 'al.archive.ubuntu.com This means that when you attempted this process the server was temporarily unavilable. You have 2 options.

1) Try again

2) Choose a different mirror By Opening Software & Updates and selecting a different server in the Download from drop down menu. (Choosing Other will run a series of tests to determine which is the best server for you.)

answered Nov 25, 2016 at 16:07

Elder Geek's user avatar

Elder GeekElder Geek

35.5k25 gold badges96 silver badges181 bronze badges

You must log in to answer this question.

Not the answer you’re looking for? Browse other questions tagged

.

I just now encountered this issue. I booted a rescue USB stick. Let me describe the fix that worked for me.

Prowling around with gdisk -l /dev/sda I can see that my original root partition is /dev/sda2. To access it, I type sudo mount /dev/sda2 /mnt

So far, so good. Let me first describe what didn’t work, and then a solution. Some pages advise chroot /mnt and then grub-install, but this won’t work; giving the grub-install: error: cannot find EFI directory. error.

Following other suggestions, I see that my EFI partition is /dev/sda1 so I try sudo mount /dev/sda1 /mnt/boot/efi and chroot again. Now, grub complains about missing /dev so I mount --bind /dev/ /mnt/dev. … But then grub complains about something else. It’s snowballing out of control. chroot is not the answer.

What did work was this: grub-install -d /mnt/usr/lib/grub/x86_64-efi --boot-directory=/mnt/boot /dev/sda

Note that the -d flag is mandatory, as otherwise, grub tries to use /usr/lib/grub/i386-pc from the rescue image, which does not contain the correct stuff.

Yayy! My system is now bootable again!

I recently dual-boot kali-linux-2016.2-amd64 with windows 10. After sometime I updated my windows 10 and due to this windows might have removed grub from the boot menu. Now I can’t boot kali-linux from the boot menu because it doesn’t appear there anymore.

So I decided to re-install grub by booting into Live-kali(Persistent) from USB. I entered the following command in the terminal:

fdisk -l
sudo mount /dev/sda* /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
grub-install /dev/sda

CTRL + D

sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt/sys
sudo umount /mnt

After the 7th command-line I got this error:
enter image description here

asked Oct 31, 2016 at 5:42

defalt's user avatar

It’s very hard to help you because you don’t know basic commands… but I’ll try okay?

  • With fdisk -l you list your current partition, like your image.
  • With your image I can see that you have /dev/sda1 as EFI System, /dev/sda10 as Linux filesystem and /dev/sda11 as Linux swap. Keep this information.
  • When you boot with a live cd you must do a chroot for access your system, in other words, an operation that changes the apparent root directory for the current running process and its children. Lets go:

  • mount your system at /mnt. Remember? Linux filesystem? Yes. It’s /dev/sda10. So do command:

            
    sudo mount /dev/sda10 /mnt.

    You are using sudo because you must have administrator permissions to do it.

  • So, mount the temporary filesystems needed for programs work, with the commands:

            
    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

  • You are modifying your boot, so you need your /boot partition too. Some systems uses the same partition for the /boot directory and system root (/). If you don’t know what is your case, so at this point check if you have files in the folder /mnt/boot/ (you will find your kernel images, configurations , etc).

       — If the /mnt/boot folder is empty, so you need mount the /boot partition. The only other possibly usable partition on your case is /dev/sda1, so will be it. Mount at /mnt/boot.

       — If you found the files, so the another partition at /dev/sda1 should be really the EFI Filesystem, and it must be mounted at /mnt/boot/EFI.

  • With all mounted,change root directory using:

            
    sudo chroot /mnt /bin/bash

  • Now, inside chroot, you can install grub:

    sudo grub-install /dev/sda

answered Oct 31, 2016 at 6:03

Lara Maia's user avatar

4

You must log in to answer this question.

Not the answer you’re looking for? Browse other questions tagged

.

#1 2020-01-10 16:42:32

light9876
Member
Registered: 2020-01-05
Posts: 114

[SOLVED] grub-install: error «cannot find EFI directory»

I never had the following problem when I used to install Arch on an HDD.

But not on my new SSD, this is what I’m doing (note that when I do fdisk -l I can see the SSD has a GPT partitioning table):

1. I have been reading the following guides all day (and I’m following them):
https://wiki.archlinux.org/index.php/Installation_guide
https://wiki.archlinux.org/index.php/Partitioning
https://wiki.archlinux.org/index.php/Arch_boot_process

2. cgdisk /dev/sda and I create 3 partitions:
sda1; 2GB, code:ef00, name=efi
sda2; 200GB, code:8300, name=root
sda3; ~750GB, code:8302, name=home

3. I format all 3 partitions:
mkfs.ext4 /dev/sda1
mkfs.ext4 /dev/sda2
mkfs.ext4 /dev/sda3

4. Mount root:
mount /dev/sda2 /mnt

5. Install base:
pacstrap /mnt base base-devel linux grub efibootmgr
mkinitcpio -p linux

6. : All of the following commands give the same error: grub-install: error «cannot find EFI directory»
grub-install /dev/sda
grub-install —target=x86_64-efi /dev/sda
grub-install —efi-directory=/boot/efi —target=x86_64-efi /dev/sda

Can someone tell me what I am doing wrong please?

Last edited by light9876 (2020-01-10 18:37:40)

#2 2020-01-10 17:09:51

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 6,997
Website

Re: [SOLVED] grub-install: error «cannot find EFI directory»

You forgot to mount the EFI system partition, it should be FAT-formatted (not ext4) and you should (arch-)chroot in before running the GRUB commands.

Step 4 should be

# mount /dev/sda2 /mnt
# mkdir -p /mnt/boot/efi
# mount /dev/sda1 /mnt/boot/efi

And step 6 should start with

Note that the UEFI grub-install command doesn’t need a block device.

EDIT: and the mkinitcpio command should be run from the chroot (although you probably don’t need to run it at all).

Last edited by Head_on_a_Stick (2020-01-10 17:11:24)

#3 2020-01-10 17:15:38

light9876
Member
Registered: 2020-01-05
Posts: 114

Re: [SOLVED] grub-install: error «cannot find EFI directory»

Thank you, I will try this immediately!

I am already doing arch-chroot /mnt but I forgot to mention it.

I will try now to format correctly and to mount /mnt/boot/efi

Last edited by light9876 (2020-01-10 17:15:58)

#4 2020-01-10 18:46:02

light9876
Member
Registered: 2020-01-05
Posts: 114

Re: [SOLVED] grub-install: error «cannot find EFI directory»

Thank you so much everything works okay now!

Only for future reference: the information you provided is written here:
https://wiki.archlinux.org/index.php/GR … allation_2

One final question:
I installed lxde and lxdm; then I logged in my user account. Now the partition /dev/sda3 that I created for /home, is not mounted at /home.

Instead, /home directory and all of its contents are resident on /dev/sda2

How can I fix this please?

Last edited by light9876 (2020-01-10 18:46:36)

#5 2020-01-10 18:58:31

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 6,997
Website

Re: [SOLVED] grub-install: error «cannot find EFI directory»

light9876 wrote:

How can I fix this please?

Create an fstab line to mount /home correctly then move the contents over to the new partition.

If you need more help with that then please open a new thread, it is off-topic here.

#6 2020-01-10 20:09:57

light9876
Member
Registered: 2020-01-05
Posts: 114

Re: [SOLVED] grub-install: error «cannot find EFI directory»

Thank you so much! I am very happy with the generous support you and everyone else have given me! : ) God bless you!

Last edited by light9876 (2020-01-10 20:10:39)

In the Linux environment, encountering errors during or after installing a bootloader like GRUB can be frustrating, especially when it involves the EFI directory. A common error is the ‘Cannot Find EFI Directory’ after running grub-install. The issue can occur due to several reasons, from incorrect booting mode to issues with the EFI System Partition (ESP). This guide aims to demystify these EFI directory troubles.

We will delve into the potential reasons behind the ‘Cannot Find EFI Directory’ error and provide step-by-step solutions to address them. Understanding these problems and their remedies will not only help you solve current issues, but also prevent future ones, ensuring smoother booting processes. Ready to unravel the mysteries of EFI directory errors? Let’s dive in!

Understanding the Context

Before we dive deep into the troubleshooting, let’s understand the components at play: Grub, EFI, and the /dev/sda location.

Grub (GRand Unified Bootloader): Grub is the bootloader commonly used in Linux. Its main job is to manage the sequence of events that happens right after your computer is powered on. It makes sure your operating system gets up and running. We’ll often interact with Grub for operations such as installing a new OS, managing multiple OS on one system, or repairing a broken system.

EFI (Extensible Firmware Interface): EFI is a specification detailing an interface that helps hand off control of the system for the pre-boot environment (i.e., after the system is powered on, but before the operating system starts) to an operating system. EFI can replace the older BIOS firmware interface present in all computers. EFI boot loaders understand both a filesystem (for example, FAT32) and EFI boot applications, which provide a more flexible pre-OS environment.

/dev/sda: This represents your first master drive. It’s the equivalent of C:\ in Windows. The “sda” is short for “SCSI disk a,” and it’s the name given to the first hard drive in a Linux system.

So, if you’re using a command like sudo grub-install –boot-directory=/mnt/boot /dev/sda, you’re essentially instructing the system to install Grub in the boot directory of your first hard drive. The /mnt/boot directory is where the bootloader files are stored.

Unraveling the Error: “Cannot Find EFI Directory”

Now that we understand the different components, let’s tackle the error at hand. When you try to install Grub and receive the “Cannot find EFI directory” error message, it means that the installation process is unable to locate the EFI system partition.

But why does this happen? It’s usually because the directory where the EFI partition should be mounted (/mnt/boot/efi in most cases) doesn’t exist, or there’s no EFI partition to mount at all, or it could be because your system is not booting in UEFI mode but rather in Legacy mode.

Practical Example and Detailed Walkthrough

I believe booting into the legacy mode is a common issue for most users. Here is how you can fix it in such a scenario.

Scenario 1

First, you need to confirm if your system uses UEFI or BIOS. In case of UEFI, there should be an EFI system partition. If there isn’t, then it’s possible your system is using BIOS.

You can check if your system is running in UEFI mode by executing the following command in the Linux terminal:

[ -d /sys/firmware/efi ] && echo UEFI || echo BIOS

If the result is “UEFI”, then you’re in UEFI mode, otherwise, you’re in BIOS mode.

In case of UEFI, GRUB should be installed in the EFI system partition, and the correct command for this would be:

sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB

Please note that “/boot/efi” should be replaced with the path where your EFI system partition is mounted.

Before running the above command, ensure that the EFI system partition is properly mounted. You can mount it with:

sudo mount /dev/sda1 /boot/efi

Replace “/dev/sda1” with the appropriate device for your EFI system partition. You can find this out by running lsblk or fdisk -l and looking for the EFI system partition.

If your system is booting in BIOS mode, your original command should work, but please ensure that the /mnt/boot directory exists and is the actual boot directory.

Remember to chroot into the system you’re trying to fix before installing GRUB. If you’re trying to repair the GRUB on a system you’re chrooted into, you would install it without the –boot-directory flag like this:

sudo grub-install /dev/sda

This will install GRUB to the MBR of the first disk. Ensure that the device you’re installing to (/dev/sda in this example) is correct for your system.

Scenario 2

Let’s go through a practical example to better illustrate this. Imagine you’ve got a fresh new system, and you’re trying to install Ubuntu on it. You boot up the live Ubuntu via a USB stick, partition your hard drive, and everything seems to be going well. But when you get to the grub installation part, you hit this error.

Step 1: Identifying the EFI Partition
Firstly, we need to find if there’s an existing EFI partition on your disk. You can use the lsblk or fdisk command to list the disk partitions. Look out for a partition type that says ‘EFI System’.

sudo fdisk -l

For instance, you might see an output similar to this:

Device Start End Sectors Size Type
/dev/sda1 2048 999423 997376 487M EFI System
/dev/sda2 999424 250068991 249069568 118.8G Linux filesystem
Here, /dev/sda1 is the EFI system partition.

Step 2: Mounting the EFI Partition
Once you’ve identified the EFI partition, the next step is to mount it. You would need to create the mount point if it doesn’t exist.

sudo mkdir -p /mnt/boot/efi

Then, mount the EFI partition:

sudo mount /dev/sda1 /mnt/boot/efi

Here, replace /dev/sda1 with the name of your EFI partition.

Step 3: Re-running the Grub-install Command
Now, you can re-run the grub-install command:

sudo grub-install --boot-directory=/mnt/boot /dev/sda

After these steps, your problem should ideally be resolved.

Common Troubleshooting Tips

Sometimes, despite mounting the EFI partition correctly, you may still run into the same error. This could be due to several reasons.

No EFI System Partition: If there’s no EFI partition, you will need to create one. Use a partitioning tool like gdisk or parted to create an EFI system partition (usually about 500 MB). Make sure to format it as FAT32.

Incorrect Boot Mode: Your system may be in Legacy/BIOS mode instead of UEFI mode. If your system firmware setup (often accessible by pressing F2, F10, or DEL during startup) has an option to set the boot mode, ensure it’s set to UEFI.

Missing EFI Boot Manager: If the EFI boot manager is missing or corrupted, the grub-install command may fail. You might need to use a boot repair tool to fix this.

I hope this detailed guide helps you the next time you encounter the “Cannot find EFI directory” error after running grub-install. These errors may be frustrating, but remember, every problem you solve is a step towards becoming a more knowledgeable Linux user.

And hey, who doesn’t love the feeling of victory after conquering a troublesome error? As for the ones that take a little longer to fix, well, they make for great stories at tech parties! Happy troubleshooting, and may your codes be error-free (or at least, less error-prone)!

Понравилась статья? Поделить с друзьями:
  • Grub install dummy неисправимая ошибка
  • Grub install dev sda ошибка
  • Grounded ошибка xbox
  • Grounded ошибка microsoft visual c runtime
  • Groovy обработка ошибок