recreation of corrupted EFI system partition

utku

New Member
Joined
Jun 23, 2022
Messages
6
Reaction score
0
Credits
62
Hello mates,

For those who can help, I will add detailed information below, but in summary, I have unfortunately corrupted the EFI System Partition of my laptop. What are my chances of fixing it?

Here I am attaching the picture of the score layout that is still available at the moment:
The 100MB area in this picture above seems to be flagged as bios_grub, but this is not true. I tried to format that part by doing Flag like this, it didn't accept. Normally, the Flag part is blank.

Windows 10 is installed on C Drive. The linux installed in the last partition (#6) was unusable. Because a long time ago, the boot selection screen turned into grub2win and linux was removed from the options, in a way that I did not understand how. Now I wanted to re-install AntiX and ubuntu linux. I wanted to install AntiX on partition 6 by formatting EFI System partition. At this stage, after the EFI is formatted, the linux installation is left unfinished. Now neither windows opens nor linux is opened/installed.

At the moment I am sharing the picture of the current splash screen of the computer:

None of these options above lead anywhere and when I try, the computer restarts and returns to the same screen.

As I understand it, there are normally two options available:
BIOS-MB + MBR or
EFI-MB + GPT

I think my hd has gpt and when I tried to change it to mbr, there was an incompatibility.

In short, how do I open my current windows and how can I install my new AntiX and ubuntu? Is there a way to do this? I would be glad if you help.

Respects,

utku.
 


GPT runs under Legacy BIOS and DOS runs UEFI just fine. Not sure how that myth got started.
But if you think about it, most Windows systems with UEFI, have DOS type partitions. (Maybe windows 10 and 11 are different).
If you are installing this all on a single hard drive, then everything will have to be EFI. The reason you will need GPT, is the
size of the drive or the number of partitions you need.

Rebuilding your grub and initramfs are fairly easy, but if your directory structure is hosed, then a rebuild might be easier.

You can try...
sudo update-initramfs

The second command is slightly trickier.
sudo grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg.

Almost every distro has a slightly different path.
I assume Ubuntu is /boot/efi/EFI/ubuntu/grub.cfg
 
[...] in summary, I have unfortunately corrupted the EFI System Partition of my laptop. What are my chances of fixing it?
[...]
In short, how do I open my current windows and how can I install my new AntiX and ubuntu? Is there a way to do this?
If you are going to (re)install Ubuntu and AntiX, then you don't need to fix anything. The installers will sort it all out, including Windows, so just run the installs (I suggest installing AntiX last coz it has a great default GRUB menu pre-configured) and when you reboot, it'll magically be fixed.

That said, for edicational purppses, if I were you and had the time, I'd still try to repair it as a learning exercise. It will better your understanding of the system, not just Linux (I learned of a firmware bug in Dell Inspiron 3k-series this way, for example). Anyway, there's my 2cents.
 
If you are going to (re)install Ubuntu and AntiX, then you don't need to fix anything. The installers will sort it all out, including Windows, so just run the installs (I suggest installing AntiX last coz it has a great default GRUB menu pre-configured) and when you reboot, it'll magically be fixed.

That said, for edicational purppses, if I were you and had the time, I'd still try to repair it as a learning exercise. It will better your understanding of the system, not just Linux (I learned of a firmware bug in Dell Inspiron 3k-series this way, for example). Anyway, there's my 2cents.
well I again installed ubuntu with creating new partitions as below:


Looks like everythin is perfect. After installation, it still opens with that screen and non of the options arrive anywhere:

:(
Any idea?
 
Okay, I see multiple problems here. Aside from your BIOS nvRAM having "stale entries, your SSD has no visible boot partition. There's 600MB unallocated which I assume was meant to be just that. Here's a quick tutorial...

Phase 1
First thing we need to do is boot using the AntiX liveUSB...
***Backup any data you have on this drive***
***Be careful if this is not the latest image of your drive***

Phase 2
Now, we're gonna wipe the redundant options and restore your BIOS boot defaults...
Code:
// Install boot manager
# apt-get install efibootmgr
# efibootmgr

// The above will list your entries. I'm going by the boot menu screen photo, so adjust where needed...
// Note the numbers "Boot0001    Something" etc. will be written as "0x0001" etc.
# efibootmgr --delete-bootnum -b 0x0001
# efibootmgr --delete-bootnum -b 0x0002
# efibootmgr --delete-bootnum -b 0x0003
# efibootmgr --delete-bootorder

Phase 3
I'm not too sure about this last image you posted. I see no signs of anything installed. So I'm assuming you're waiting. Fire up Gparted (still in AntiX live). I'm attaching you image with indicators.
6SNN8SL-mod.png

- Delete the partitions marked in red
- Now create 2 partitions of 45GB each: 1 is for AntiX, 1 is for Ubuntu. I will call these nvme-antix and nvme-ubuntu respectively.
- Now you can optionally create an 8GB swap partition (you shouldn't need it and it will shorten your SSD's life, but it's a safety net). nvme-swap.
- Now allocate the remaining partition: You will use this as your /home/ partition. You'll be sharing this with both distros. You can use a different username for either distro (example: utku-antix, utku-ubuntu) to prevent conflict of config files. nvme-home
- Optionally format the area in green FAT32 (the installer will do it. nvme-boot.

Phase 4 - Ubuntu
- Boot up in Ubuntu, do the install, select "manual partition"
- Now select nvme-ubuntu and choose to "use as ext4 filesystem" and "select mountpoint" as "/"
- Now select nvme-home and use as ext4 and set mountpoint to "/home"
- Optionally seyup swap
- Select nvme-boot and "use as EFI"
- Okay, done and confirm.
- Create your user account for Ubuntu
- Reboot and check that it works. If so, proceed. If not, fire up Antix LiveUSB and use its grub loader to boot into Ubuntu. Confirm it is installed right. It does not need to be bootable coz you're installing AntiX anyway.

Phase 5 - AntiX
- Boot up in AntiX, do install with manual partition
- Use nvme-antix as ext4 and set the mountpoint as /
- Use nvme-home as ext4 and set mountpoint as /home/. Select not to format this partition
- Optionally setup swap (UUID will change so you'll have to update Ubuntu -- separate question)
- Select nvme-boot and use as EFI partition
- Confirm.
- Create a user account with a different name from your Ubuntu install just now.
- Reboot and check everything is in order.

Phase 6 - Cleanup
So, if you followed my instructions and everything went well, you'll have 2 boot options from your BIOS: Ubuntu and AntiX. Obviously, you only need AntiX so you can use efibootmgr to delete the ubuntu entry from your BIOS's nvRAM and reset the boot order (you must reset the boot order) as you did in Phase #2. Okay, you're done. Reboot cold.

You should now have just one bootloader listed by your BIOS. It should boot automatically, though. The AntiX version of GRUB should boot up with options to boot into AntiX, Windows, or Ubuntu along with some advanced and diagnostic options. Congrats.

- J
 

Attachments

  • 6SNN8SL-mod.png
    6SNN8SL-mod.png
    621.2 KB · Views: 205
Hello again,

Thank you for your crystal clear guide!

Now I have a working AntiX in my computer.

When I tried to boot ubuntu, it looks like this:

WhatsApp Image 2022-06-28 at 5.57.25 PM.jpeg


So it looks like I have ubuntu but unable to use. I didn't run efibootmng after installing both linux as you mentioned in Phase 6 - Cleanup. I believe this is why ubuntu is not running maybe, but to be honest, I didn't understand why I need to cleanup after installing 2 different linuxes.

And this is my up to date boot list entries:

WhatsApp Image 2022-06-28 at 5.53.46 PM.jpeg


1- Which of them should I remove?
2- After this, do you think that ubuntu will work properly?
3- I have both AntiX and Ubuntu in grub. How can I add Windows as an option?
4- What do you think about first 8.98 MB partition at the beginning? Should I delete it?

And this is the final status of partitions:

WhatsApp Image 2022-06-28 at 4.52.22 PM (1).jpeg


Thanks!

utku.
 
root@antix1:/home/utqu# fdisk -l
Disk /dev/ram0: 16 MiB, 16777216 bytes, 32768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram1: 16 MiB, 16777216 bytes, 32768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram2: 16 MiB, 16777216 bytes, 32768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram3: 16 MiB, 16777216 bytes, 32768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram4: 16 MiB, 16777216 bytes, 32768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram5: 16 MiB, 16777216 bytes, 32768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram6: 16 MiB, 16777216 bytes, 32768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram7: 16 MiB, 16777216 bytes, 32768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram8: 16 MiB, 16777216 bytes, 32768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram9: 16 MiB, 16777216 bytes, 32768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram10: 16 MiB, 16777216 bytes, 32768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram11: 16 MiB, 16777216 bytes, 32768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram12: 16 MiB, 16777216 bytes, 32768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram13: 16 MiB, 16777216 bytes, 32768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram14: 16 MiB, 16777216 bytes, 32768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram15: 16 MiB, 16777216 bytes, 32768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/nvme0n1: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: SAMSUNG MZALQ512HALU-000L2
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: EC26CAE1-1BB7-4DC3-8F36-316805405330

Device Start End Sectors Size Type
/dev/nvme0n1p1 512002048 604162047 92160000 43.9G Linux filesystem
/dev/nvme0n1p2 604162048 696322047 92160000 43.9G Linux root (x86)
/dev/nvme0n1p3 696322048 712706047 16384000 7.8G Linux swap
/dev/nvme0n1p4 1261568 307202047 305940480 145.9G Microsoft basic data
/dev/nvme0n1p5 307202048 512002047 204800000 97.7G Microsoft basic data
/dev/nvme0n1p6 34 18431 18398 9M BIOS boot
/dev/nvme0n1p7 712706048 804866047 92160000 43.9G Linux root (x86)
/dev/nvme0n1p8 18432 1261567 1243136 607M EFI System

Partition table entries are not in disk order.
root@antix1:/home/utqu# sudo os-prober
/dev/nvme0n1p1:Ubuntu 22.04 LTS (22.04):Ubuntu:linux
root@antix1:/home/utqu#
 
Okay. Glad your system's more/less running. Let's start with the questions:
1- Which of them should I remove?
2- After this, do you think that ubuntu will work properly?
3- I have both AntiX and Ubuntu in grub. How can I add Windows as an option?
4- What do you think about first 8.98 MB partition at the beginning? Should I delete it?

1. Everything marked with an asterisk *, except Antix. Don't forget to run efibootmgr --delete-bootorder afterwards. Note the things like PXE boot will simply be restored by the BIOS firmware's autodetect and built-in options next boot anyway. You just need to make AntiX's GRUB install the primary boot option coz it is 20% cooler (and has nice built-in OOTB options). So you're ensuring this using this procedure.

2. Well, it is working... ACPI errors on an OS can be fixed with acpi=strict kernel parameter, but you'll want to try and fix the actual bug first (will get to that).

4. Do not delete it. It contains what looks to be legacy boot data. It's likely why your NVMe is being detected as a boot option unto itself. Leave it be.

3. Windows... We need to detect this. But lemme try to tie everything else in here, too:
So first:
I didn't run efibootmng after installing both linux as you mentioned in Phase 6 - Cleanup. I believe this is why ubuntu is not running maybe, but to be honest, I didn't understand why I need to cleanup after installing 2 different linuxes.
You should've done housecleaning because you've got multiple instances of GRUB installed and you want to make sure the latest one installed is booted (first). But that's not why Ubuntu's playing up. Seems you hit an ACPI snag which we can (most likely) fix with a firmware upgrade, or simpler: full dist-upgrade since it's a fresh install. Simply logging in as root (press Enter at that prompt, it should log you in automatically) and running apt-get update && apt-get dist-upgrade -y && sleep 5; reboot. Should that not work, try using the kernel parameter acpi=strict should fix it. To do this, highlight the "Ubuntu" item on the GRUB menu, press 'e' and add 'acpi=strict' to the kernel parameter list (add it to the end of the list of options on the line that says "linux"). Try booting with Ctrl + x. If it works, you'll have to edit /etc/default/grub.cfg and add "acpi=strict" to the line GRUB_CMDLINE_LINUX_DEFAULT=, then do not run update-grub yet.

You can now reboot into AntiX.

Most of the time, update-grub detects Windows, mounted or not. but it's easier just to:
Code:
# mkdir /mnt/p4 /mnt/p5
# mount -o ro /dev/nvme0np4 /mnt/p4
# mount -o ro /dev/nvme0np5 /mnt/p5
 // If no errors have ocurred, continue with
# update-grub
// Ubuntu should also be datected. If not then look in etc/default/grub.cfg for a line like "OS_PROBER_DISABLED=false" and uncomment it, then try again.
// Now cleanup...
# umount /mnt/p4; umount /mnt/p5
# rmdir /mnt/p4 /mnt/p5
After updating GRUB, it should read the /etc/default/grub.cfg on the Ubuntu install and generate all the correct entries. You can now reboot.

It should start in the AntiX-configured GRUB with plenty options including these three: AntiX, Ubuntu, and Windows.

It should be noted for the future that upgrades/installs on Ubuntu may trigger update-grub. If that happens, just boot into AntiX and run update-grub again.

Hope that helps. I'm on my phone ATM so I can't check over this post too well, so if I left anything unanswered, just ask. Meanwhile, good luck and let us know how it works out (hopefully no issues arise).
 
1. Everything marked with an asterisk *, except Antix. Don't forget to run efibootmgr --delete-bootorder afterwards. Note the things like PXE boot will simply be restored by the BIOS firmware's autodetect and built-in options next boot anyway. You just need to make AntiX's GRUB install the primary boot option coz it is 20% cooler (and has nice built-in OOTB options). So you're ensuring this using this procedure.

done.

Seems you hit an ACPI snag which we can (most likely) fix with a firmware upgrade, or simpler: full dist-upgrade since it's a fresh install. Simply logging in as root (press Enter at that prompt, it should log you in automatically) and running apt-get update && apt-get dist-upgrade -y && sleep 5; reboot. Should that not work, try using the kernel parameter acpi=strict should fix it. To do this, highlight the "Ubuntu" item on the GRUB menu, press 'e' and add 'acpi=strict' to the kernel parameter list (add it to the end of the list of options on the line that says "linux"). Try booting with Ctrl + x. If it works, you'll have to edit /etc/default/grub.cfg and add "acpi=strict" to the line GRUB_CMDLINE_LINUX_DEFAULT=, then do not run update-grub yet.

unfortunately, none of them worked.
when dist-upgrading it says lots of "Failed to fetch http://tr.archive.ubuntu.com/..."
and in the final line:

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

also booting with ctrl+x after 'acpi=strict' addition like below still leading to same screen and unable to boot Ubuntu.


WhatsApp Image 2022-06-29 at 7.22.52 AM.jpeg


and then I added grub.conf "acpi=strict" as

GRUB_CMDLINE_LINUX_DEFAULT="quiet acpi=strict"

well obviously this removed some of error messages but Ubuntu is still in emergency mode and not booting. Should I re-install it?

# mkdir /mnt/p4 /mnt/p5
# mount -o ro /dev/nvme0np4 /mnt/p4
# mount -o ro /dev/nvme0np5 /mnt/p5
// If no errors have ocurred, continue with
# update-grub
// Ubuntu should also be datected. If not then look in etc/default/grub.cfg for a line like "OS_PROBER_DISABLED=false" and uncomment it, then try again.
// Now cleanup...
# umount /mnt/p4; umount /mnt/p5
# rmdir /mnt/p4 /mnt/p5

didn't have any error messages but it couldn't detect Windows, only Ubuntu.

revised grub.cfg as "OS_PROBER_DISABLED=" (deleted false) and same result.

Thanks,

Utku.
 
when dist-upgrading it says lots of "Failed to fetch http://tr.archive.ubuntu.com/..."
and in the final line:

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
I should've just said upgrade, thought you were running 20.* for some reason, but AFAIK 22.* is the latest. Anyway, not the issue at hand... Now, did anything fetch successfully?
If so, try apt-get update --fix-missing as the error suggests. Then run apt-get upgrade -y.
If not, then try echo "nameserver 8.26.56.26" > /etc/resolv.conf; echo "nameserver 8.8.8.8" >> /etc/resolv.conf. This should fix any resolution errors you may be having, or/and you could try another mirror (change tr.archive.ubuntu in /etc/apt/sources.list then run apt-get update to refresh apt's cache) and then do an apt-get update && apt-get upgrade -y.

didn't have any error messages but it couldn't detect Windows, only Ubuntu.

revised grub.cfg as "OS_PROBER_DISABLED=" (deleted false) and same result.
No, you want it to read: OS_PROBER_DISABLED=false without comments.

and then I added grub.conf "acpi=strict" as

GRUB_CMDLINE_LINUX_DEFAULT="quiet acpi=strict"

well obviously this removed some of error messages but Ubuntu is still in emergency mode and not booting. Should I re-install it?
Reinstalling this early is one option since you have nothing invested, but it may not auto-onfigure properly, leaving you with the same issues still present. A reinstallation is unlikely to fix the firmware issue unless packages are updated in realtime (such as with a network/minimum install).
 
Just to be clear...

20.04 will not offer to upgrade to 22.04 until after 22.04.1 is released, or about that time.
 
Oh, didn't know that. Just saw OP was on 22.04 so I knew it was the latest. I'm not terribly in the know on Ubuntu's release system -- or minor cycles.
 

Staff online

Members online


Latest posts

Top