15

I have a dual boot system setup with Windows 10 and Ubuntu 16.04, when turning on my PC grub shows correctly, Windows and Ubuntu are recognized, no problems there. Every time there's an update or i have to install something, I keep getting this error:

Errors were encountered while processing:
 grub-efi-amd64-signed
 shim-signed
Setting up shim-signed (1.12+0.8-0ubuntu2) ...
Installing for x86_64-efi platform.
grub-install: errore: cannot find EFI directory.
dpkg: error processing package shim-signed (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up grub-efi-amd64-signed (1.66+2.02~beta2-36ubuntu3) ...
grub-install: errore: /usr/lib/grub/i386-pc/modinfo.sh doesn't exist. Please specify --target or --directory.
dpkg: error processing package grub-efi-amd64-signed (--configure):
 subprocess installed post-installation script returned error exit status 1

Can I just ignore it or do is there something I can do to fix it?

  • Is this a UEFI system? Does your /etc/fstab mount the EFI partition at /boot/efi? Does the /boot/efi contain a directory EFI? – ubfan1 Apr 27 '16 at 1:20
  • Yes, it is a UEFI system, the /boot/efi contains the EFI directory, don't understand the /etc/fstab bit – BressanFranco Apr 27 '16 at 2:50
  • It looks like an update might have gotten interrupted at some time before the packages completely finished configuring try dpkg --configure -a – MttJocy Apr 27 '16 at 3:13
  • @MttJocy tried it, gives me the same error with package grub-efi-amd64-signed and shim-signed – BressanFranco Apr 27 '16 at 9:47
  • 1
4

The reference to /usr/lib/grub/i386-pc/modinfo.sh indicates a BIOS-mode GRUB install -- specifically, the i386-pc section of that path identifies the BIOS-mode version of GRUB. (For an EFI-mode installation on AMD64/x86-64, the equivalent path is /boot/grub/x86_64-efi/modinfo.sh.) OTOH, the package names clearly indicate an EFI-mode GRUB install. The two should not be mixed, but somehow that's happened in your case. Perhaps you've got a leftover GRUB configuration file from a previous BIOS-mode install, in which case tracking it down and updating it should fix the problem. Perhaps Boot Repair could fix the problem automatically. Note, however, that a repair attempt runs the risk of making matters worse by rendering your system unbootable. I therefore advise proceeding with extreme caution!

If you can't fix it easily, you could look into replacing GRUB with something else -- several alternatives are available, as described on this Web page of mine. GRUB 2 is the most difficult boot loader to tweak once it goes "off the rails," as yours has, which is why replacing it can be a good option. My own rEFInd boot manager is likely to be easy to install, with the caveat that there's an Ubuntu 16.04 bug that complicates installation from the PPA with Secure Boot active. (That's covered in the documentation.) Note also that simply installing a new package won't overcome your problem; you'd need to uninstall the GRUB package that's causing you difficulty to do that. I cover that topic specifically here, since it's not as easy as you might think. (Ubuntu keeps trying to re-install GRUB if you remove it.)

  • Boot-Repair in advanced options has a full uninstall/reinstall of grub. That may fix the configuration issue. Be sure to boot in UEFI mode if UEFI install. – oldfred Apr 27 '16 at 14:44
  • @oldfred how do i make sure that i boot in UEFI mode? if it's a bios setting it should (actually i'm definitely sure that it is) already be enabled – BressanFranco Apr 27 '16 at 16:35
  • You choose from UEFI boot menu. Usually flash drive is show twice. Once as UEFI:flashdrive and again just as flashdrive which then is the BIOS boot. You can also tell if you get grub menu it is UEFI, if you get accessibility screen (tiny icons at bottom) it is BIOS. Shows install with screen shots. Both BIOS purple accessibility screen & UEFI black grub menu screen help.ubuntu.com/community/UEFI – oldfred Apr 27 '16 at 18:28
  • tried the boot-repair live disc and perform the auto repair, all seems to be good now, not getting the same errors as before, update-grub re-added the windows partition. All seems fine – BressanFranco Apr 27 '16 at 21:01
40

Try

sudo apt-get purge grub\*
sudo apt-get install grub-efi
sudo apt-get autoremove
sudo update-grub

to fix.

  • fixed it with the boot-repair live disc – BressanFranco Apr 27 '16 at 22:22
  • These commands worked like a charm Xubuntu 16.04 – guyfromfl May 13 '16 at 1:49
  • 4
    Is this safe to do? – Pithikos Jul 15 '16 at 10:35
  • 1
    It's safe both ways. You can either use the commands above or the boot-repair live disc. – John Jul 16 '16 at 14:02
  • 1
    I upgraded Ubuntu 17.04 to 18.04 and then was getting the error: Errors were encountered while processing: grub-efi-amd64 grub-efi-amd64-signed shim-signed E: Sub-process /usr/bin/dpkg returned an error code after doing sudo apt upgrade. Your solution worked with me too. Thanks. – mario go Sep 15 '18 at 9:02
4

In case someone's looking at setting up a multiboot USB disk to handle both mbr and grub:

If your current system is EFI, then you'll be missing this:

sudo apt install grub-pc-bin

If your current system is MBR, then you'll be missing this:

sudo apt install grub-efi-amd64-bin
# You may also need grub-efi-amd64-signed
1

try:

sudo apt-get -f install

step 1: start the shim uninstall

then: this terminal command will remove the shim-signed archive

step 2: shim uninstalling

after: with the shim archive removed successfully

step 3: shim removed

finally: at least the Ubuntu software updates should start working again if it all goes well (as in my case)

step 4: System updates prompt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.