You are not logged in.

#1 2021-08-13 19:40:21

069cho
Member
Registered: 2021-08-13
Posts: 9

[S] emergency shell, can't mount /efi - how to fix without live stick?

Hello fellow arch users,
I would appreciate your assistance. Normally, I would know how to fix this issue myself by using a live USB stick and chroot, but unfortunately I can't do so right now, since I'm on vacation and don't have a USB drive (nor a hub or adapter, since the device only has one USB c port)

When booting my system I am prompted to enter the password for my Luks root partition (as usual) but afterwards I'm being put into emergency shell since /efi can't be mounted. I know why (and I'll describe the setup in the next paragraph), I just don't know how to fix this on the go.

My device has one ssd with three partitions:
nvme0n1p1 - efi partition, mounted to /efi
nvme0n1p2 - crypted root partition
nvme0n1p3 - swap

During the initial installation of arch on this device, I was a bit confused with the setup of the boot loader (using systemd boot) and the kernel hooks etc. and made some mistake: somehow when generating initramfs etc. It is not placed in /efi but rather in /boot. Eventually I was lazy and 'fixed' this issue by just copying initramfs and vmlinuz(big mistake, I know) to /efi manually.

Now, after forgetting about this issue and carelessly updating the system (and thus the kernel), I get this error message saying that I'm not able to mount /efi for vfat is an unknown filesystem.

Thus, I can't even 'fix' it for now by just pasting the files over again, since I can't access that boot partition at all.

All I can think of right now would be formatting the boot partition while in the emergency shell and setting it up again, but I'm not sure if that would be sensible.
Or downgrading the kernel via pacman-cache would be an option? Can't put the files generated by mkinitcpio in the right spot, though?

Any help would be appreciated. Thanks! (Please excuse bad formatting and lack of logs etc., I'm posting this from my phone's browser). Any further information needed?

Last edited by 069cho (2021-08-16 17:31:05)

Offline

#2 2021-08-13 19:59:47

loqs
Member
Registered: 2014-03-06
Posts: 19,008

Re: [S] emergency shell, can't mount /efi - how to fix without live stick?

Do you have the old version of the kernel package in pacman's cache ( /var/cache/pacman/pkg ) ?  If so you can downgrade the kernel package so the modules match the kernel version.

Offline

#3 2021-08-13 20:05:01

069cho
Member
Registered: 2021-08-13
Posts: 9

Re: [S] emergency shell, can't mount /efi - how to fix without live stick?

Thanks for your reply. According to uname -r I'm on 5.13.7 while the pacman cache has only 5.13.9 present?! Installing it, however, ends in an error message, as the generated initramfs can't be placed in the proper location as /efi can't be mounted

Offline

#4 2021-08-13 20:07:29

loqs
Member
Registered: 2014-03-06
Posts: 19,008

Re: [S] emergency shell, can't mount /efi - how to fix without live stick?

What was the error message?  What boot loader is the system using?

Offline

#5 2021-08-13 20:22:48

069cho
Member
Registered: 2021-08-13
Posts: 9

Re: [S] emergency shell, can't mount /efi - how to fix without live stick?

loqs wrote:

What was the error message?  What boot loader is the system using?

Boot loader is systemd boot.

First error message says
"failed to start load kernel modules"
(See systemctl status systemd-modules.service for details)

Second one says
"Failed to mount /efi"
(See systemctl status efi.mount for details)

Here's the output of the two status commands, hopefully readable: https://ibb.co/zJrPJqN

I think my problem might be identical to this, btw:
https://bbs.archlinux.org/viewtopic.php?id=178358
Just that I don't have access to a live system for an easy fix right now.

Last edited by 069cho (2021-08-13 20:23:31)

Offline

#6 2021-08-13 20:43:36

loqs
Member
Registered: 2014-03-06
Posts: 19,008

Re: [S] emergency shell, can't mount /efi - how to fix without live stick?

Without live media or the old kernel version it becomes more complicated.  What if you try and force loading of the fat module for 5.13.9?

# modprobe -f -S 5.13.9-arch1-1 fat

Offline

#7 2021-08-13 20:54:54

069cho
Member
Registered: 2021-08-13
Posts: 9

Re: [S] emergency shell, can't mount /efi - how to fix without live stick?

loqs wrote:
# modprobe -f -S 5.13.9-arch1-1 fat

Results in

modprobe: ERROR: could not insert "fat": invalid argument

(modprobe fat without specifying the kernel results in

modprobe: FATAL: module fat not found in directory /lib/modules/5.13.7-arch1-1 

as you might have guessed)

Offline

#8 2021-08-13 21:00:55

loqs
Member
Registered: 2014-03-06
Posts: 19,008

Re: [S] emergency shell, can't mount /efi - how to fix without live stick?

You did pass -S 5.13.9-arch1-1 to modprobe?  Does /lib/modules/5.13.9-arch1-1 exist?

Offline

#9 2021-08-13 21:04:32

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [S] emergency shell, can't mount /efi - how to fix without live stick?

loqs wrote:

You did pass -S 5.13.9-arch1-1 to modprobe?  Does /lib/modules/5.13.9-arch1-1 exist?

AFAIK the old module directory gets deleted on a kernel upgrade.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#10 2021-08-13 21:08:18

loqs
Member
Registered: 2014-03-06
Posts: 19,008

Re: [S] emergency shell, can't mount /efi - how to fix without live stick?

Slithery from post #3 the only version of the linux package in pacman's cache was 5.13.9 so reinstalling that package would still leave those modules installed?

Last edited by loqs (2021-08-13 21:08:46)

Offline

#11 2021-08-13 21:13:13

069cho
Member
Registered: 2021-08-13
Posts: 9

Re: [S] emergency shell, can't mount /efi - how to fix without live stick?

loqs wrote:

You did pass -S 5.13.9-arch1-1 to modprobe?  Does /lib/modules/5.13.9-arch1-1 exist?

I did so and yes, the directory exists, containing multiple folders like kernel and modules.*

Offline

#12 2021-08-13 21:14:48

loqs
Member
Registered: 2014-03-06
Posts: 19,008

Re: [S] emergency shell, can't mount /efi - how to fix without live stick?

What is the output of

# insmod /lib/modules/5.13.9-arch1-1/kernel/fs/fat/fat.ko.zst

Offline

#13 2021-08-13 21:30:55

069cho
Member
Registered: 2021-08-13
Posts: 9

Re: [S] emergency shell, can't mount /efi - how to fix without live stick?

loqs wrote:
# insmod /lib/modules/5.13.9-arch1-1/kernel/fs/fat/fat.ko.zst
fat: version magic '5.13.9-arch1-1 SMP preempt mod_unload ' should be '5.13.7-arch1-1 SMP preempt mod_unload '
insmod: ERROR could not insert module /lib/modules/5.13.9-arch1-1/kernel/fs/fat.ko.zst: invalid module format

Offline

#14 2021-08-13 21:35:40

loqs
Member
Registered: 2014-03-06
Posts: 19,008

Re: [S] emergency shell, can't mount /efi - how to fix without live stick?

Lets see if it can be forced

# insmod -f /lib/modules/5.13.9-arch1-1/kernel/fs/fat/fat.ko.zst

Offline

#15 2021-08-13 21:42:03

069cho
Member
Registered: 2021-08-13
Posts: 9

Re: [S] emergency shell, can't mount /efi - how to fix without live stick?

loqs wrote:
# insmod -f /lib/modules/5.13.9-arch1-1/kernel/fs/fat/fat.ko.zst
insmod: ERROR: could not insert module /lib/modules/5.13.9-arch1-1/kernel/fs/fat/fat.ko.zst: invalid parameters 

Offline

#16 2021-08-13 21:51:32

loqs
Member
Registered: 2014-03-06
Posts: 19,008

Re: [S] emergency shell, can't mount /efi - how to fix without live stick?

I assume networking is not available and you do not have removable media that uses the same file-system as the installed system's root file-system containing the linux 5.13.7 kernel package.
Then I am out of ideas without the use of live media.

Last edited by loqs (2021-08-13 21:51:52)

Offline

#17 2021-08-13 22:01:35

069cho
Member
Registered: 2021-08-13
Posts: 9

Re: [S] emergency shell, can't mount /efi - how to fix without live stick?

I'm assuming I can't use network from the emergency shell, but I'm not 100% sure. Thanks for your help nonetheless. Guess I'll have to try finding a USB C to A adapter and an USB drive (and another PC for preparing it).

Reformating the boot partition and reinstalling and -configuring the boot loader wouldn't be an option, right? Don't want to try it unless I'm 100% sure.

Offline

#18 2021-08-13 22:09:52

loqs
Member
Registered: 2014-03-06
Posts: 19,008

Re: [S] emergency shell, can't mount /efi - how to fix without live stick?

The ESP needs to be FAT.  Without the kernel fat module you would not be able to install a boot loader onto the newly formatted ESP.
systemd-boot can only read FAT so can not use the kernel in the root file-system's /boot directory even if it was not encrypted.

Offline

#19 2021-08-16 17:30:05

069cho
Member
Registered: 2021-08-13
Posts: 9

Re: [S] emergency shell, can't mount /efi - how to fix without live stick?

Thanks for your help, @loqs. In the end, I managed to find a USB C to USB A adapter and a USB drive and fixed the problem with a live stick. So, solved, I guess? Thread title seems to be too long for the tag anyway.

Last edited by 069cho (2021-08-16 17:31:40)

Offline

#20 2021-08-17 08:43:42

Wild Penguin
Member
Registered: 2015-03-19
Posts: 406

Re: [S] emergency shell, can't mount /efi - how to fix without live stick?

Shorten the title to accomodate for the tag.

On this problem for future reference: there is a relatively large window where the system is in a non-bootable state, when running pacman to upgrade the system. Namely, pacman will first install the kernel (this will remove old kernel(s), then the rest of the packages (which can take a long time) and finally, after everything else, install the module(s) of the new kernel (or several kernels) and create the initramfs's. If anything happens in between kernel and module installation which forces the system to reboot, the system can not use the modules from initramfs, nor the (old) modules of the (old) Kernel. This may mean the system can not be properly booted, and the system is non-fixable without some other, working boot.

For this kinds of situations, I usually have several boot loaders/managers in the EFI. This includes grub2, which is the most handy tool, since it can (with a bit of hassle) load many Kernels from live ISO images of Linux distributions straight from the HDD (haven't tried the Arch one, though).

As another approach, it might make sense to mount the EFI partition to /efi, however depending on the boot loader that might not be feasible.

Last edited by Wild Penguin (2021-08-17 08:45:29)

Offline

Board footer

Powered by FluxBB