1

Ubuntu informs me there's a firmware upgrade for my Dell Optiplex 7070 system, but when I try to install it, I get an error saying there's not enough space:

/boot/efi does not have sufficient space, required 33.6 MB, got 30.9 MB

According to the description, it's an update "to address security vulnerabilities", so if at all possible, I'd like to install this update.

I've seen a very similar question on this forum (How to make space in /boot/efi without resizing the partition?), but the answers there suggest to either run the update in a terminal (which is what I did in the first place, and what gave me the above error), or to move or remove files and/or directories, which I'm not exactly comfortable with.

My PC has a dual boot, with Windows, which came pre-installed on the main HDD, and Ubuntu 22.04 on a separate SSD. One of the comments by @PonJar on the question above suggests the following:

Bit of a long shot. How many HDD/SDD/etc do you have in this machine? I have a desktop with two storage devices. Both have an EFI partition. One is untouched since the original Windows install. The other has the stuff to boot Linux and a copy of the stuff to boot Windows. This device boots first, I get to choose Linux and the family can go Windows. Apart from a simple copy of the Windows folder I never touched the original EFI. So if you have a second device you could create a larger EFI and never touch the original. Probably doesn’t fit your scenario but thought I’d mention it in case.

This looks like something that might work for me, but I'm not sure how to do this. So my question is: how can I create a larger EFI? Or, alternatively, is there a safe way to make space on my existing EFI?

For sake of completeness, this is what's in my EFI at the moment:

163K    /boot/efi/EFI/Microsoft/Boot/bg-BG
207K    /boot/efi/EFI/Microsoft/Boot/cs-CZ
205K    /boot/efi/EFI/Microsoft/Boot/da-DK
213K    /boot/efi/EFI/Microsoft/Boot/de-DE
216K    /boot/efi/EFI/Microsoft/Boot/el-GR
155K    /boot/efi/EFI/Microsoft/Boot/en-GB
200K    /boot/efi/EFI/Microsoft/Boot/en-US
209K    /boot/efi/EFI/Microsoft/Boot/es-ES
163K    /boot/efi/EFI/Microsoft/Boot/es-MX
157K    /boot/efi/EFI/Microsoft/Boot/et-EE
207K    /boot/efi/EFI/Microsoft/Boot/fi-FI
167K    /boot/efi/EFI/Microsoft/Boot/fr-CA
213K    /boot/efi/EFI/Microsoft/Boot/fr-FR
161K    /boot/efi/EFI/Microsoft/Boot/hr-HR
213K    /boot/efi/EFI/Microsoft/Boot/hu-HU
207K    /boot/efi/EFI/Microsoft/Boot/it-IT
182K    /boot/efi/EFI/Microsoft/Boot/ja-JP
182K    /boot/efi/EFI/Microsoft/Boot/ko-KR
159K    /boot/efi/EFI/Microsoft/Boot/lt-LT
159K    /boot/efi/EFI/Microsoft/Boot/lv-LV
203K    /boot/efi/EFI/Microsoft/Boot/nb-NO
209K    /boot/efi/EFI/Microsoft/Boot/nl-NL
209K    /boot/efi/EFI/Microsoft/Boot/pl-PL
207K    /boot/efi/EFI/Microsoft/Boot/pt-BR
207K    /boot/efi/EFI/Microsoft/Boot/pt-PT
55K /boot/efi/EFI/Microsoft/Boot/qps-ploc
159K    /boot/efi/EFI/Microsoft/Boot/ro-RO
206K    /boot/efi/EFI/Microsoft/Boot/ru-RU
161K    /boot/efi/EFI/Microsoft/Boot/sk-SK
159K    /boot/efi/EFI/Microsoft/Boot/sl-SI
161K    /boot/efi/EFI/Microsoft/Boot/sr-Latn-RS
204K    /boot/efi/EFI/Microsoft/Boot/sv-SE
205K    /boot/efi/EFI/Microsoft/Boot/tr-TR
161K    /boot/efi/EFI/Microsoft/Boot/uk-UA
174K    /boot/efi/EFI/Microsoft/Boot/zh-CN
174K    /boot/efi/EFI/Microsoft/Boot/zh-TW
14M /boot/efi/EFI/Microsoft/Boot/Fonts
15K /boot/efi/EFI/Microsoft/Boot/Resources/en-US
182K    /boot/efi/EFI/Microsoft/Boot/Resources
54K /boot/efi/EFI/Microsoft/Boot/CIPolicies/Active
55K /boot/efi/EFI/Microsoft/Boot/CIPolicies
29M /boot/efi/EFI/Microsoft/Boot
57K /boot/efi/EFI/Microsoft/Recovery
29M /boot/efi/EFI/Microsoft
1.9M    /boot/efi/EFI/Boot
1.0K    /boot/efi/EFI/ubuntu/fw
4.3M    /boot/efi/EFI/ubuntu
32M /boot/efi/EFI/Dell/Bios/Recovery
32M /boot/efi/EFI/Dell/Bios
35K /boot/efi/EFI/Dell/logs
32M /boot/efi/EFI/Dell
67M /boot/efi/EFI
1.0K    /boot/efi/System Volume Information/ClientRecoveryPasswordRotation
1.0K    /boot/efi/System Volume Information/AadRecoveryPasswordDelete
16K /boot/efi/System Volume Information
67M /boot/efi

EDIT: Thanks for those commands @oldfred, the output is

NAME        FSTYPE   SIZE FSUSED LABEL PARTLABEL                    MOUNTPOINT
sda                232.9G                                           
├─sda1      swap    15.3G                                           [SWAP]
└─sda2      ext4   217.6G  95.4G                                    /
nvme0n1            238.5G                                           
├─nvme0n1p1 vfat     100M  66.6M       EFI system partition         /boot/efi
├─nvme0n1p2           16M              Microsoft reserved partition 
├─nvme0n1p3 ntfs   237.8G              Basic data partition         
└─nvme0n1p4 ntfs     565M                                           

Not sure whether I have unallocated space on drives, so just to be sure, here's the output of sudo fdisk -lu

Disk /dev/loop0: 4 KiB, 4096 bytes, 8 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


Disk /dev/loop1: 116.7 MiB, 122363904 bytes, 238992 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


Disk /dev/loop2: 116.79 MiB, 122458112 bytes, 239176 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


Disk /dev/loop3: 55.61 MiB, 58310656 bytes, 113888 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


Disk /dev/loop4: 55.61 MiB, 58310656 bytes, 113888 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


Disk /dev/loop5: 63.27 MiB, 66347008 bytes, 129584 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


Disk /dev/loop6: 63.28 MiB, 66355200 bytes, 129600 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


Disk /dev/loop7: 72.91 MiB, 76447744 bytes, 149312 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


Disk /dev/nvme0n1: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk model: BC501 NVMe SK hynix 256GB               
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: gpt
Disk identifier: 5B252C4C-013E-4AFF-9F85-B7FEC562A83E

Device             Start       End   Sectors   Size Type
/dev/nvme0n1p1      2048    206847    204800   100M EFI System
/dev/nvme0n1p2    206848    239615     32768    16M Microsoft reserved
/dev/nvme0n1p3    239616 498954356 498714741 237.8G Microsoft basic data
/dev/nvme0n1p4 498956288 500113407   1157120   565M Windows recovery environment


    Disk /dev/sda: 232.89 GiB, 250059350016 bytes, 488397168 sectors
    Disk model: Samsung SSD 860 
    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: gpt
    Disk identifier: 8F38827F-BAAA-4005-8821-47DE99EED3BB
    
    Device        Start       End   Sectors   Size Type
    /dev/sda1      2048  31999999  31997952  15.3G Linux swap
    /dev/sda2  32000000 488396799 456396800 217.6G Linux filesystem
    
    
    Disk /dev/loop8: 72.91 MiB, 76447744 bytes, 149312 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
    
    
    Disk /dev/loop9: 12.98 MiB, 13611008 bytes, 26584 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
    
    
    Disk /dev/loop10: 7 MiB, 7335936 bytes, 14328 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
    
    
    Disk /dev/loop11: 239.12 MiB, 250732544 bytes, 489712 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
    
    
    Disk /dev/loop12: 240.61 MiB, 252301312 bytes, 492776 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
    
    
    Disk /dev/loop13: 162.87 MiB, 170778624 bytes, 333552 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
    
    
    Disk /dev/loop14: 164.76 MiB, 172761088 bytes, 337424 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
    
    
    Disk /dev/loop15: 346.3 MiB, 363118592 bytes, 709216 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
    
    
    Disk /dev/loop16: 346.33 MiB, 363151360 bytes, 709280 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
    
    
    Disk /dev/loop17: 81.26 MiB, 85209088 bytes, 166424 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
    
    
    Disk /dev/loop18: 91.69 MiB, 96141312 bytes, 187776 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
    
    
    Disk /dev/loop19: 329.64 MiB, 345653248 bytes, 675104 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
    
    
    Disk /dev/loop20: 329.5 MiB, 345509888 bytes, 674824 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
    
    
    Disk /dev/loop21: 424.17 MiB, 444772352 bytes, 868696 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
    
    
    Disk /dev/loop22: 45.93 MiB, 48156672 bytes, 94056 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
    
    
    Disk /dev/loop23: 45.93 MiB, 48160768 bytes, 94064 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
    
    
    Disk /dev/loop24: 49.83 MiB, 52248576 bytes, 102048 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
    
    
    Disk /dev/loop25: 49.84 MiB, 52260864 bytes, 102072 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
    
    
    Disk /dev/loop26: 304 KiB, 311296 bytes, 608 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
    
    
    Disk /dev/loop27: 428 KiB, 438272 bytes, 856 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
1
  • We do not need the typical files in ESP. But need your partitions & sizes. Post this: lsblk -e 7 -o name,fstype,size,fsused,label,partlabel,mountpoint Do you have unallocated space on drive(s)? If so post this for more detail on drive/partitions: sudo fdisk -lu
    – oldfred
    Commented Feb 22, 2023 at 14:55

1 Answer 1

2

Your EFI System Partition (ESP; what's mounted at /boot/efi) is only 100 MiB in size, which is small. IIRC, Microsoft used to create ESPs of that size, but they bumped up the default size several years ago because they recognized it was too small. Thus, IMHO you're on the right track to be looking for a way to resize the ESP or create a larger one. Unfortunately, this isn't an easy task.

Resizing the ESP is possible, but it would require moving the following partition (which is probably /dev/nvme0n1p2 -- a Microsoft Reserved partition that you don't want to resize) and resizing the one after that (probably /dev/nvme0n1p3, which is a Windows partition) from the start of the partition. Resizing a partition from the start is time-consuming and dangerous, so I don't recommend this approach unless you want to delete Windows on this computer. OTOH, if you have good backups and enough time, it might be a simpler approach than the one I'm about to describe.

The safer option is to find a partition that you can resize from the end, shrink it by a good size (I recommend 550 MiB, but rounding up to 1 GiB is reasonable), and create a new ESP there. You've got both /dev/sda and /dev/nvme0n1 drives, and both have big partitions that you could probably afford to shrink by a suitable amount, so either one is an option. /dev/sda2 is your 217.6 GiB Ubuntu root (/) partition, and /dev/nvme0n1p3 is a 237.8 GiB Windows partition. The following procedure is from memory; it may contain typos or other errors. To do this:

  1. Pick one of the partitions.
  2. Back up all important data on the partition you intend to shrink.
  3. Shrink the chosen partition. If you shrink the Ubuntu partition, you'd probably use GParted. The last I checked, this would require booting an emergency disk, but this may have changed. If you shrink the Windows partition, GParted should be able to do it, but using Windows tools might be safer.
  4. Create a new ESP in the freed space. If you use GParted, create a FAT partition and be sure to set the "esp" (aka "boot") flag on it. You'll probably have to reboot after creating the partition. In fact, I strongly recommend doing so, since the partition numbers may change, and you don't want to slip up and accidentally damage one partition thinking it's another one.
  5. Copy the old ESP's data to the new ESP. This can be done by mounting the new ESP somewhere and using cp, tar, a GUI file manager, or some other tool to copy the files from /boot/efi to the temporary mount point. Be sure to copy the entire directory tree (e.g., cp -r, not just cp).
  6. Create new EFI boot manager entries to point to GRUB 2 (or whatever you use to boot Ubuntu) and the Microsoft boot loader on the new ESP. This will involve typing two commands, one for each boot program. Details will vary, but the commands will look something like this (the -d option points to the whole disk and -p specifies the partition number on the disk). Be sure to type them in this order:
    • sudo efibootmgr -c -d /dev/sda -p 3 -l /EFI/Microsoft/boot/bootmgfw.efi -L "Windows boot loader"
    • sudo efibootmgr -c -d /dev/sda -p 3 -l /EFI/ubuntu/shimx64.efi -L "ubuntu 2"
  7. Type sudo efibootmgr and note the BootOrder variable. Each entry identifies one of the Boot#### entries that follows. The new order should have your new ubuntu 2 option first in the list.
  8. Type sudo blkid /dev/nvme0n1p1 and take note of the UUID value.
  9. Type sudo blkid /dev/sda3 (or whatever the device is for the new ESP) and identify its UUID value.
  10. Edit /etc/fstab. Locate the option that mounts /boot/efi; it should have the UUID value you identified for the current ESP. Change that UUID value to match the one you found for the new ESP.
  11. Reboot. If you did everything precisely correctly, the computer should boot from the new ESP and mount the new ESP at /boot/efi.
    • Type df /boot/efi to check that the new ESP is mounted there.
    • Type efibootmgr and check the BootCurrent variable. It should match the new ubuntu 2 entry you created.
  12. Type sudo update-grub. This will update your GRUB configuration and should cause it to detect the Windows boot loader on the new ESP.
  13. Reboot again and verify that you can boot into Windows.
  14. Using Windows or Ubuntu tools, delete the old ESP. Its space is probably not worth reclaiming.
  15. Reboot again and verify you can still boot both Ubuntu and Windows.
  16. Install your system updates; you should have no problems with space on the ESP.

There's a good chance that something will go wrong somewhere along the line, especially if I've made a typo or error or if you skip a step or make a typo yourself. Thus, you may need to troubleshoot. Until you delete the old ESP, though, the computer should remain bootable even if there's a problem. (If the partition you resize is damaged, though, all bets are off for booting it; that's why I explicitly said to back it up.)

A variant that can save a little time and might be a little safer is to keep both ESPs, keeping the original 100 MiB one for Windows and moving only GRUB 2 to the new one. To do this, you'd follow the preceding procedure; however:

  • In step #5, you could omit the Windows files (from /boot/efi/EFI/Microsoft) from the copy, or delete them from the target after they've been copied.
  • In step #6, you would omit creating the new EFI boot manager entry for Windows; just create the one for Ubuntu.
  • Step #12 is probably not necessary.
  • In step #14, rather than delete the old ESP, you can mount it somewhere and delete the EFI/ubuntu directory it holds.
2
  • Thanks a lot for this super comprehensive explanation! It looks awfully scary (I never tried anything like this), but I suppose I'll give it a try anyway
    – Sita
    Commented Feb 27, 2023 at 7:30
  • So I finally gathered enough courage to try this, and it worked! At least, most of it: looks like I accidentally copied one level too high from the original ESP, resulting in boot/efi/efi/ etc. So Ubuntu and Windows are still booting from the old ESP, but the firmware upgrade (which I was silly enough to run without fixing this first), finished successfully and just created its own directory structure on the new ESP. Is there a way to repair this? Can I replace the original fw directory and fwupdx64.efi with the new ones somehow?
    – Sita
    Commented Sep 20, 2023 at 6:20

You must log in to answer this question.

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