# EndeavorOS

Tips and tricks for running this arch based distro

# systemd-boot Failed to mount /efi [solved]

After a recent update using `eos-update --aur` I rebooted my machine and found myself only able to boot into emergency mode.

For boot, my devices uses systemd-boot. I spent some time searching around figuring out what the issue could possibly be. 

## Smoking Gun 

`uname -a` yielded a response of `6.18.8-arch2-1`

Comparing that with `pacman -Q kernel` yields a repsonse of `6.18.9-arch1-2` 

## Diagnosis 

Somehow my kernel versions got out of date. 

## Resolution 

This resolution differs from Edmund Goodman's linked post slightly, but his work was crucial for figuring out how to get into the encrypted drive. 

### Boot from live USB

If you do not have a drawer of live USBs, follow the [options](https://discovery.endeavouros.com/installation/create-install-media-usb-key/2021/03/) provided by EndeavorOS.

### Connect to the internet
Connecting via the GUI connection manager should suffice. You will need this for redownloading the package.

### Identify your drives 

`lsblk -f` 

Example output: 

```
nvme0n1
├─nvme0n1p1                                   vfat        FAT32             B3E1-C4A9                               1.8G     9% /efi
├─nvme0n1p2                                   crypto_LUKS 2                 e2a1b3c4-d5e6-4f78-9a0b-c1d2e3f4a5b6
│ └─luks-e2a1b3c4-d5e6-4f78-9a0b-c1d2e3f4a5b6 ext4        1.0   endeavouros f1e2d3c4-b5a6-4987-8654-321fedcba987  673.3G    17% /
└─nvme0n1p3                                   crypto_LUKS 2                 a9b8c7d6-e5f4-4321-b0a9-8765fedc4321
  └─luks-a9b8c7d6-e5f4-4321-b0a9-8765fedc4321 swap        1     swap        1a2b3c4d-5e6f-4789-a0b1-c2d3e4f5a6b7                [SWAP]

```
### Open Your Encrypted Drive

`sudo cryptsetup open /dev/nvme0n1p2 luks_root`

### Mount the Drives 

`sudo mount /dev/mapper/luks_root /mnt`  
`sudo mount /dev/nvme0n1p1 /mnt/boot`

### Root Into the Drive

`sudo arch-chroot /mnt`

### Reinstall the Linux Kernel 
`pacman -S linux`

Note: at some point I had cleared pacman cache of the linux header. It is not clear if that was a necessary step but it did happen during the troubleshooting that led to this. 

### Validate the Kernel Was Installed 

`kernel-install list`

Example output:

```
VERSION        HAS KERNEL PATH                           
6.18.9-arch1-2          ✓ /usr/lib/modules/6.18.9-arch1-2

```

### Exit & Reboot 

`exit`  
`reboot` 

###

You might see multiple versions you can boot, choose the one with the version that should load. After rebooting, running `kernel-install list` should only present the version that was just installed. 

## Theory of What Happened

I am not 100 percent confident that this is exactly what happened, but in trying to make a model of what happened this is the best estimation that can be provided: 

Pacman installed an updated kernel, the hook to trigger `dracut` (which generates the initramfs) was successful; however, the hook to trigger `kernel-install` which copies the kernel and initramfs to a version directory and also adds the boot loader entry appears to have failed. 


## References 

https://edmundgoodman.co.uk/posts/2024/fixing-endeavouros-boot-failures/