Formated my boot partition via windows by accident. I can't boot into arch linux

Hello I have been struggling in the past days to fix the problem. Basically my arch linux system is on a 4TB ssd. The problem is my efi/boot partition was formated by me which was located on amother ssd via windows. Sadly there is multiple of them (The 4TB SSD got 2 of them). I tried to use the fat partition of my 4tb ssd but without success. I can arch chroot fine into my system but can’t boot it via uefi. Windows 11 works fine however. Can anyones help me? I have followed a lot of guides. My linux knowledge concerning partitions is pretty limited and don’t feel like doing archinstall and reformat everything from ground one. Got lots of gaming vms and progress on that drive

Thank you for your help and please let me know if you need to know anything to simplify the process

1 Like

Are you using Grub?

Be sure to also mount the EFI partition when you set up the arch-chroot. Then, reinstall the bootloader and regenerate the Grub config.

https://discovery.endeavouros.com/system-rescue/arch-chroot/

https://discovery.endeavouros.com/system-rescue/repair-a-non-booting-grub/

1 Like

im using grub but im wondering how do I create an efi partition?

You don’t need to create an EFI partition if there is already one on the device (typically a Grub installation only takes up a few MB on the EFI). You can share the EFI partition with Windows. Mount the EFI partition in the chroot and do the installation, and it will take care of this for you. The Windows files on there will not be affected.

Having multiple EFI partitions on the same disk is not recommended because it can cause issues with applications that expect only one EFI partition to be present per device. For example, os_prober may not work correctly.

I get this error I even tried to follow this guide I still can’t boot into my system grub show but not my system

https://spacebums.co.uk/fixing-grub-


arch-linux/

The guide you provided after running the command give me an error. Here is how /mnt look

Edit: I decided to use window’s efi partition for the process




Those commands are for a legacy BIOS installation. If you have an EFI partition you should be following the instructions below that:

Repair GRUB on EFI/UEFI systems

Before you are going to repair GRUB, you should also check your EFI-boot-settings, this also can be the reason why GRUB isn’t booting.

  1. reinstall GRUB files:

Only grub-install is needed no need to add any options, at least on EndeavourOS where we use the default efi-path /boot/efi what is the default used for the command already. The --bootloader-id option will create a new entry with the given ID that in some cases will not get set as the default boot entry in the firmware.

If not used it will use the GRUB_DISTRIBUTOR= entry from the grub main config in /etc/default/grub, in case this is not the same as used before for bootloader-id it will create a new entry.

default boot entry in this example is 0020 that has the bootloader-id endeavouros (default set one)

  1. Rebuild the grub.cfg configuration file:

grub-mkconfig -o /boot/grub/grub.cfg

Now GRUB is repaired, and you should be able to boot into your system again.

Additionally, it doesn’t look like the chroot is set up right. Are you sure /dev/sda is the right disk? There is an error message about ext2 on there; it would be odd if you were using that filesystem for your EndeavourOS installation.

Also, it doesn’t look like the EFI partition has been mounted correctly. See the instructions in this article: https://discovery.endeavouros.com/system-rescue/arch-chroot/

So we need to mount /dev/sda2 and the ESP (/dev/sda1) make sure to know your ESP mount point on your installed system can be /efi or /boot/efi (older installs, or if you are using grub instead of systemd-boot).

You will see in the /etc/fstab file of the installed system if you cannot remember.

sudo mount /dev/sda2 /mnt

sudo cat /mnt/etc/fstab (to check the mount point of your ESP)

sudo mount /dev/sda1 /mnt/efi (or /mnt/boot/efi)

Now your installed system is mounted.

Run arch-chroot to login to the installed system

With this information, you are able to arch-chroot, so type the following command:

sudo arch-chroot /mnt

Now you’ve chrooted into your installed system, and you are able to access your files, install packages, or alter scripts to rescue your system.

For a Grub installation, typically the EFI partition will be mounted at /boot/efi (so for setting up the chroot you will mount it at /mnt/boot/efi).

After running “grub-install” it tells me “Cannot find EFI directory” idk what im doing wrong

I don’t use endeavor OS I use arch linux

Im sorry im just confused so much right now

You need to tell grub install where efi directory is, for example grub-install --efi-directory=/boot/efi. Before this you need to create a directory ‘efi’ for example located in /boot (mkdir /boot/efi). then mount the efi partition (the one windows uses) at /boot/efi. you can also create the efi folder directly in root: /efi and mount the efi partition there, just tell grub-install where it is.

Okay so followed all your instruction and grub only show a setting to launch uefi. I tried using /dev/sdb1 instead of the efi partition of windows /dev/sdba1 I couldn’t install anything it told me I had no space when I got 2tb left

Well I only told you how to fix the missing efi directory error. You need to follow a thorough grub install tutorial. For example you need to also specify boot directory: grub-install --efi-directory=/boot/efi --boot-directory=/boot. But you also need to ensure efi partition persistence (in /etc/fstab). There are multiple steps and there are plenty of in-depth tutorials for this. I;m not very knowledgeable myself, but I spent 2 or three hours just last week setting up multi-boot for my own system. I went through a hell of a trial and err process but i got it working in the end :slight_smile:

My problem was that the disks kept changing. When booting off a drive it would assume /dev/nvme0, while when booting off another drive, the same drive would assume designation /dev/nvme1. I should have ensured persistence in /etc/fstab using uuid, but I assigned mounting points using /dev/nvme0-1.

This link was partially helpful: https://wiki.archlinux.org/title/GRUB , i also found helpful articles by searching the internet.

It looks like you installed to a target other than the actual EFI partition.

You shouldn’t need the --efi-directory= flag if the EFI partition is correctly mounted. I think this is the crucial detail which is not being addressed.

  • Identity the EFI partition. If you aren’t sure, post the output of lsblk -o name,type,fstype,label,size into the thread.
  • Identity the mount point for the EFI partition. If you are not sure, mount the root partition at /mnt and post the output of cat /mnt/etc/fstab into the thread.

If the EFI partition is not getting mounted correctly in the chroot, the rest of the steps will not work even if you do them exactly right.

Im not sure tbh my outputs by running your commands looks like this


I don’t see any efi partitions

/dev/sda1 and /dev/sdb1 both look like efi partitions (Windows creates tiny efi partitions, and that’s what sda1 looks like). You can install grub using either of them, you just need to tell your firmware to boot the right one, and let os-prober detect your Windows install.

From the looks of it you have mounted /dev/sda1 to /boot, which is not necessary and is probably what causes your setup to fail. Let boot be a simple folder on the same main partition as root (you do this by unmounting /boot). In that folder make sure to create an efi folder if it doesn’t exist in which you should mount the efi partition.

To recap the steps: 1. Commenting out the second mounted partition in your /mnt/etc/fstab, 2. Chroot into /mnt, 3. unmounting /boot (and making sure /boot/efi folder exists), 4. then installing grub again using chroot should fix the issue.

I was able to fix issue, I had to select the /dev/sdb1 drive on /etc/fstab and then I followed those instruction re installed the linux-zen & linux-zen-headers kernel and everything works fine. Thank you everyone for your help!

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.