Boot accidentally deleted

Good morning everyone, as I am a goat or so, in trying to format a USB I think I formatted the boot part of my operating system! Now, is there a method to fix it or do I have to format it all over again? If so, how?
The message I get as soon as I turn on the computer is the following:

“reboot and select proper boot device for inserted boot media in selected boot device and press key”.

I thank everyone in advance for any valuable help you can give me

We would need some more info. To begin with, boot up your live usb and post the output of the following commands:


sudo parted -l
1 Like
[liveuser@eos-2024.01.25 ~]$ efibootmgr
EFI variables are not supported on this system.
[liveuser@eos-2024.01.25 ~]$ sudo parted -l
Model: ATA Samsung SSD 870 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name         Flags
 1      2097kB  1051MB  1049MB  fat32                     boot, esp
 2      1051MB  1000GB  999GB   ext4         endeavouros

Model: ATA Samsung SSD 860 (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End    Size   File system  Flags
 1      0.00B  500GB  500GB  ext4

Model: Kingston DataTraveler 3.0 (scsi)
Disk /dev/sdg: 15.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size   Type     File system  Flags
 2      2595MB  2760MB  165MB  primary  fat16        esp

And the fat32 partition is empty?

I see you do not boot ISO in EFI mode make sure to disable CSM in Bios or choose the EFI boot entry for the USB boot to boot in efi mode.

It is pretty straight forward to recreate the boot files as long as you do not do it wrong :wink:

But i do not want to disturb @pebcak… i will be away anyway now

1 Like

On the contrary, your observations and input is highly welcome and appreciated. Thanks!

So let’s wait for more info from OP.

1 Like
liveuser@eos-2024.01.25 ~]$ efibootmgr
BootCurrent: 000B
Timeout: 1 seconds
BootOrder: 0009,0008,000A,000B,000C,000D,0000,0004,0003
Boot0000* ubuntu        VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)
Boot0003* debian        VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)
Boot0004* Manjaro       VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)
Boot0008* Linux Boot Manager    HD(1,GPT,b372b538-43e2-4381-b33e-10a86062e139,0x1000,0x1f4000)/File(\EFI\SYSTEMD\SYSTEMD-BOOTX64.EFI)
Boot0009* UEFI OS       HD(1,GPT,b372b538-43e2-4381-b33e-10a86062e139,0x1000,0x1f4000)/File(\EFI\BOOT\BOOTX64.EFI)0000424f
Boot000A* UEFI: KingstonDataTraveler 3.0PMAP    PciRoot(0x0)/Pci(0x1,0x3)/Pci(0x0,0x0)/USB(20,0)/CDROM(1,0x4d5940,0x4ea98)0000424f
Boot000B* UEFI: KingstonDataTraveler 3.0PMAP    PciRoot(0x0)/Pci(0x1,0x3)/Pci(0x0,0x0)/USB(20,0)/CDROM(1,0x4d5940,0x4ea98)0000424f
Boot000C* UEFI: KingstonDataTraveler 3.0PMAP    PciRoot(0x0)/Pci(0x1,0x3)/Pci(0x0,0x0)/USB(20,0)/CDROM(1,0x4d5940,0x4ea98)0000424f
Boot000D* UEFI: KingstonDataTraveler 3.0PMAP, Partition 2       PciRoot(0x0)/Pci(0x1,0x3)/Pci(0x0,0x0)/USB(20,0)/HD(2,MBR,0x4e4305b5,0x4d5940,0x4e800)0000424f
[liveuser@eos-2024.01.25 ~]$ 

now you are booted in efi mode.

Well and now?

still needs more information.

procedure is to reformat the efi partition flagged as boot and rebuild the bootloader files…

But first check if you really erased the efi partition output does not look like that.


sudo mount /dev/sda2 /mnt
sudo mount /dev/sda1 /mnt/efi
sudo arch-chroot /mnt
ls /efi

if you are using systemd-boot with grub you need to set /mnt/boot/efi instead for the efi partition mounting…

show the output of ls /efi or ls /boot/efi from inside the chroot please.
If any of the commands give error, show the output

[liveuser@eos-2024.01.25 ~]$ sudo mount /dev/sda2 /mnt
[liveuser@eos-2024.01.25 ~]$ sudo mount /dev/sda1 /mnt/efi
mount: /mnt/efi: mount point does not exist.
       dmesg(1) may have more information after failed mount system call.
[liveuser@eos-2024.01.25 ~]$ sudo arch-chroot /mnt
mount: /mnt/proc: mount point does not exist.
       dmesg(1) may have more information after failed mount system call.
==> ERROR: failed to setup chroot /mnt
[liveuser@eos-2024.01.25 ~]$ ls /efi
ls: cannot access '/efi': No such file or directory
[liveuser@eos-2024.01.25 ~]$ ls /boot/efi
ls: cannot access '/boot/efi': No such file or directory
[liveuser@eos-2024.01.25 ~]$ 

If you use grub, then the mount point should be /mnt/boot/efi

Could you show us the content of your /etc/fstab ?

Mount your root partition first:

sudo mount /dev/sda2 /mnt


cat /mnt/etc/fstab

[liveuser@eos-2024.01.25 ~]$ sudo mount /dev/sda2 /mnt
[liveuser@eos-2024.01.25 ~]$ cat /mnt/etc/fstab
# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=8532-9F99                            /efi           vfat    fmask=0137,dmask=0027 0 2
UUID=59741aff-fcd0-4fff-af96-2ae3e907d1d4 /              ext4    noatime    0 1
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0
[liveuser@eos-2024.01.25 ~]$ 

Well, what do I fill the boot space with now?

[liveuser@eos-2024.01.25 ~]$ sudo mkdir /mnt/efi
mkdir: cannot create directory ‘/mnt/efi’: File exists
[liveuser@eos-2024.01.25 ~]$ 

liveuser@eos-2024.01.25 ~]$ cd /mnt/efi
[liveuser@eos-2024.01.25 efi]$ ls
[liveuser@eos-2024.01.25 efi]$ 

File exists …

what shows ls /mnt

here you are running commands on the liveiso structure not installed system path… would be /mnt in front to catch these…

ls /mnt/efi

the error from try mounting the ESP could be related to what you have done to this partition… Could simply be corrupted … like some bytes erased only…

here it looks like intact size filesystem and flags do look like an actual esp partition…

But what if you check?

fsck /dev/sda1 ?

[liveuser@eos-2024.01.25 efi]$ cd ..
[liveuser@eos-2024.01.25 mnt]$ ls
bin   dev  etc   lib    lost+found  opt   root  sbin  sys  usr
boot  efi  home  lib64  mnt         proc  run   srv   tmp  var
[liveuser@eos-2024.01.25 mnt]$ fsck /dev/sda1
fsck from util-linux 2.39.3
e2fsck 1.47.0 (5-Feb-2023)
fsck.ext2: Permission denied while trying to open /dev/sda1
You must have r/w access to the filesystem or be root
[liveuser@eos-2024.01.25 mnt]$ sudo fsck /dev/sda1
fsck from util-linux 2.39.3
fsck.fat 4.2 (2021-01-31)
There are differences between boot sector and its backup.
This is mostly harmless. Differences: (offset:original/backup)
1) Copy original to backup
2) Copy backup to original
3) No action
[123?q]? 3
Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
1) Remove dirty bit
2) No action
[12?q]? q
No changes have been written to the filesystem yet. If you choose
to quit, it will be left in the same state it was in before you
started this program.
1) Quit now
2) Continue
[12?]? q
[12?]? 1
[liveuser@eos-2024.01.25 mnt]$ 

But now what should I do? Because I understood that there is a backup but I was afraid to restore it because I didn’t understand what backup is