Bonjour, j'ai lancé aujourd'hui un `apt dist-upgrade` sur ma ubuntu `Linux nextcloud 4.15.0-142-generic #146-Ubuntu SMP Tue Apr 13 01:11:19 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux` Kimsufi et j'ai eu l'erreur suivante :
```
Setting up grub-efi-amd64-signed (1.167~18.04.1+2.04-1ubuntu44) …
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.
dpkg: error processing package grub-efi-amd64-signed (–configure):
installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status 1
```
J'ai cherché dans les logs mais rien ne m'a expliqué pourquoi cet exit 1. `dpkg --configure grub-efi-amd64-signed` recontrant le même problème, j'ai été un peu téméraire et j'ai lancé
```
apt purge grub-efi*
(…)
The following packages will be REMOVED:
grub-efi-amd64* grub-efi-amd64-bin* grub-efi-amd64-signed* shim-signed*
0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 14.0 MB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database … 45360 files and directories currently installed.)
Removing shim-signed (1.37~18.04.8+15+1552672080.a4a1fbe-0ubuntu2) …
Removing grub-efi-amd64-signed (1.167~18.04.1+2.04-1ubuntu44) …
Removing grub-efi-amd64 (2.04-1ubuntu44) …
Removing grub-efi-amd64-bin (2.04-1ubuntu44) …
(Reading database … 45046 files and directories currently installed.)
Purging configuration files for grub-efi-amd64-bin (2.04-1ubuntu44) …
Purging configuration files for grub-efi-amd64 (2.04-1ubuntu44) …
Purging configuration files for shim-signed (1.37~18.04.8+15+1552672080.a4a1fbe-0ubuntu2)
```
puis
```
apt install grub-efi
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
grub-efi-amd64 grub-efi-amd64-bin grub-efi-amd64-signed
The following NEW packages will be installed:
grub-efi grub-efi-amd64 grub-efi-amd64-bin grub-efi-amd64-signed
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 1258 kB of archives.
After this operation, 12.6 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ubuntu.mirrors.ovh.net/ubuntu bionic-updates/main amd64 grub-efi-amd64-bin amd64 2.04-1ubuntu44 [727 kB]
Get:2 http://ubuntu.mirrors.ovh.net/ubuntu bionic-updates/main amd64 grub-efi-amd64 amd64 2.04-1ubuntu44 [46.9 kB]
Get:3 http://ubuntu.mirrors.ovh.net/ubuntu bionic-updates/main amd64 grub-efi-amd64-signed amd64 1.167~18.04.1+2.04-1ubuntu44 [482 kB]
Get:4 http://ubuntu.mirrors.ovh.net/ubuntu bionic-updates/main amd64 grub-efi amd64 2.02-2ubuntu8.23 [2596 B]
Fetched 1258 kB in 0s (9717 kB/s)
Preconfiguring packages …
Selecting previously unselected package grub-efi-amd64-bin.
(Reading database … 45044 files and directories currently installed.)
Preparing to unpack …/grub-efi-amd64-bin_2.04-1ubuntu44_amd64.deb …
Unpacking grub-efi-amd64-bin (2.04-1ubuntu44) …
Selecting previously unselected package grub-efi-amd64.
Preparing to unpack …/grub-efi-amd64_2.04-1ubuntu44_amd64.deb …
Unpacking grub-efi-amd64 (2.04-1ubuntu44) …
Selecting previously unselected package grub-efi-amd64-signed.
Preparing to unpack …/grub-efi-amd64-signed_1.167~18.04.1+2.04-1ubuntu44_amd64.deb …
Unpacking grub-efi-amd64-signed (1.167~18.04.1+2.04-1ubuntu44) …
Selecting previously unselected package grub-efi.
Preparing to unpack …/grub-efi_2.02-2ubuntu8.23_amd64.deb …
Unpacking grub-efi (2.02-2ubuntu8.23) …
Setting up grub-efi-amd64-bin (2.04-1ubuntu44) …
Setting up grub-efi-amd64 (2.04-1ubuntu44) …
Creating config file /etc/default/grub with new version
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.
Failed: grub-install --target=x86_64-efi
WARNING: Bootloader is not properly installed, system may not be bootable
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/50-cloudimg-settings.cfg'
Generating grub configuration file …
Found linux image: /boot/vmlinuz-4.15.0-143-generic
Found initrd image: /boot/initrd.img-4.15.0-143-generic
Found linux image: /boot/vmlinuz-4.15.0-142-generic
Found initrd image: /boot/initrd.img-4.15.0-142-generic
done
Setting up grub-efi-amd64-signed (1.167~18.04.1+2.04-1ubuntu44) …
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.
dpkg: error processing package grub-efi-amd64-signed (–configure):
installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status 1
Setting up grub-efi (2.02-2ubuntu8.23) …
Errors were encountered while processing:
grub-efi-amd64-signed
E: Sub-process /usr/bin/dpkg returned an error code (1)
```
Bon, la voilà mon erreur : `grub-install: error: cannot find EFI directory.`
Si je lance juste la commande, j'ai bien toujours le même problème:
```
grub-install --target x86_64-efi /dev/sda
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.
```
Si je force le directory aussi:
```
grub-install --directory /usr/lib/grub/x86_64-efi /dev/sda
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.
```
Est-ce que quelqu'un pourrait m'aider ?
```
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop1 7:1 0 99.2M 1 loop /snap/core/10958
loop2 7:2 0 210.1M 1 loop /snap/nextcloud/27697
loop3 7:3 0 217.5M 1 loop /snap/nextcloud/27920
loop4 7:4 0 55.5M 1 loop /snap/core18/1997
loop5 7:5 0 55.4M 1 loop /snap/core18/2066
loop6 7:6 0 99M 1 loop /snap/core/11081
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 4G 0 part /boot
├─sda2 8:2 0 923.5G 0 part /
└─sda3 8:3 0 4G 0 part [SWAP]
```
```
fdisk -l /dev/sda
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 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: 0xb56860ad
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 4096 8390655 8386560 4G 83 Linux
/dev/sda2 8390656 1945131007 1936740352 923.5G 83 Linux
/dev/sda3 1945131008 1953517567 8386560 4G 82 Linux swap / Solaris
```
```
~# apt list --installed | grep grub
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
grub-common/bionic-updates,now 2.02-2ubuntu8.23 amd64 [installed,automatic]
grub-efi/bionic-updates,now 2.02-2ubuntu8.23 amd64 [installed]
grub-efi-amd64/bionic-updates,now 2.04-1ubuntu44 amd64 [installed,automatic]
grub-efi-amd64-bin/bionic-updates,now 2.04-1ubuntu44 amd64 [installed,automatic]
grub-efi-amd64-signed/bionic-updates,now 1.167~18.04.1+2.04-1ubuntu44 amd64 [installed,automatic]
grub2-common/bionic-updates,now 2.02-2ubuntu8.23 amd64 [installed,automatic]
```