I recently got a new pre-loved laptop and as always I nuked Windows but in the process of booting up, I noticed that my BIOS was a bit out of date. Like a whole year out of date. Flashing your BIOS in Ubuntu is a trivial albeit manual process nowadays. You just have to follow these steps:
- Go to your PC manufacturer’s website
- Enter your device’s service tag or serial number
- Download the BIOS .exe file or .iso file depending on your device maker
- Plugin a USB drive:
- Delete all partitions from it
- Format it using an ancient file system called FAT
- Reboot your laptop and flash BIOS
A case of mistaken partition
Easy right? Wrong. In the process of deleting all partitions, I used a graphical utility and failed to pay attention to the disk I was editing. Both my USB and OS drive had EFI partitions. I ended up deleting the all-important EFI partition without even noticing. The operation failed when I tried to delete my main partition. Again I was so distracted I failed to notice that I wasn’t working on my external drive.
Everything came to a crashing halt when I decided to restart. The laptop wouldn’t boot up and kept saying it was checking memory. Firing up a one-time boot using F12 showed that there was no operating system. Fortunately the USB I had failed to edit was a live USB. After booting up I noticed the EFI partition was missing. In the old Legacy Boot days not booting up could easily be fixed by reinstalling Grub2 the glorious Linux bootloader. Most internet searchers were useless but a few hours later I found a solution. Guess not people are making the mistake I made.
How to reinstall the EFI partition after accidentally deleting it in Ubuntu 20.04

The following steps will allow you to reinstall Grub on a computer with EFI enabled in order to make it bootable again. First, make sure you have an Ubuntu Live USB with Ubuntu 20.04. I have a 30GB UHS 3 SD card that I always keep at the back of my wardrobe draw that has the latest LTS on it just in case. You would be wise to have one too. You never know when you need it. If you don’t have a spare computer you will have to download the Ubuntu ISO on your phone and borrow a computer to make a live USB.
Then follow these steps:
- Plug in your USB preferably in the USB 3 port if you have a disk that supports it
- Boot up your machine from USB on most machines you press F12 or F8 at the splash machine
- When Ubuntu boots up select Try Ubuntu as opposed to Install Ubuntu
- Open a Terminal
- Determine whether your computer is in EFI or Legacy mode first
- [ -d /sys/firmware/efi ] && echo “EFI boot on HDD” || echo “Legacy boot on HDD”
- If your computer is in Legacy boot just reinstall Grub the old fashioned way if it’s in EFI boot then we are in business
- Run the command sudo fdisk -l to see all the drives and partitions on the operating system
- In my case, my main drive (i.e. the one inside the laptop) was shown as /dev/sda while my USB was identified as /dev/sdb
- The main drive only had one partition /dev/sda2 instead of the usual two. The first partition /dev/sda1 was missing
- I opened the Disks utility which is preinstalled
- Created a new partition at the beginning of the disk
- Format the partition as a FAT partition
- Go back to the terminal and mounted the main partition to /mnt using command: sudo mount /dev/sda2 /mnt
- Now mount the EFI partition to EFI directory of your main drive: sudo mount /dev/sda1 /mnt/boot/efi
- Prepare chroot environment if you don’t know what that is it’s OK just do it: for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
- Now activate chroot and set /mnt as root: sudo chroot /mnt
- Finally reinstall grub: grub-install /dev/sda
- Make grub pick up the new changes: sudo update-grub
That’s almost all of it. If you followed these steps you should be able to reboot. However, in my case, the machine was taking about 45 seconds to reboot instead of the usual 5-9 seconds to get to the “log on” screen. Pressing escape showed me what was going on. Startup scripts were trying to mount the original none existent old EFI partition. Because it didn’t exist the script would get stuck and the system would wait for it to timeout.

To fix this I followed the following steps:
- Patiently waited for the computer to boot up and logged in
- Open the fstab file using the command: sudo nano /etc/fstab
- Navigated to the line about mounting EFI created during installation and commented it out by placing # at the beginning
- Run command to obtain the partition’s new UUID: sudo blkid /dev/sda1
- Created new entry: UUID=D303-EB8B /boot/efi vfat umask=0077 0 1
- Run: sudo update-grub
Make sure you replace the UUID with your actual UUID obtained using the blkid command otherwise it won’t work. Also, the last command about updating grub is not needed after updating fstab but it doesn’t hurt to run it. After this, my blazing boot times were restored.
I lived to flash another time
I merrily went on to flash my BIOS updated but this time around I was super attentive. Flashing BIOS can be dangerous especially if you make a mistake. It might turn your laptop into a paperweight. Deleting the wrong partition might just have been a blessing in disguise as it shocked my wandering mind into attention.
What’s your take?