Arch Linux: failed to mount on real root

By | 07/25/2023

I updated my Arch Linux yesterday, and for the first time in 9 years of using this system, I encountered an error when after a reboot the system could not mount a disk:

ERROR: device UUID not found.
mount: /new_root: can’t find UUID.
ERROR: Failed to mount UUID on real root.
You are now being dropped into an emergency shell.

The problem is clear – either the UUID of the disk has changed, or “something went wrong” with the kernel.

That happened because, during the upgrade, free space was exhausted in  the /tmp and mkinitcpio wasn’t able to build a new kernel’s image.

So, boot from a USB flash, and let’s try to fix it.

First, check whether the correct UUID is specified in fstab.

Check the partitions:

[simterm]

[root@archiso ~]# lsblk 
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0         7:0    0 693.5M  1 loop /run/archiso/airootfs
sda           8:0    1  14.3G  0 disk 
├─sda1        8:1    1   798M  0 part 
└─sda2        8:2    1    15M  0 part 
nvme0n1     259:0    0 953.9G  0 disk 
├─nvme0n1p1 259:1    0   512M  0 part 
├─nvme0n1p2 259:2    0   900G  0 part 
└─nvme0n1p3 259:3    0  53.4G  0 part

[/simterm]

/dev/nvme0n1p2 – my root partition here.

Mount it:

[simterm]

[root@archiso ~]# mount /dev/nvme0n1p2 /mnt/

[/simterm]

Check the UUID from the /etc/fstab on the old system:

[simterm]

[root@archiso ~]# cat /mnt/etc/fstab 
# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/nvme0n1p2
UUID=31268b66-5fca-44f6-8e22-acc281026eaf       /               ext4            rw,relatime     0 1

[/simterm]

And check the real UUID of this partiton:

[simterm]

[root@archiso ~]# blkid  /dev/nvme0n1p2
/dev/nvme0n1p2: UUID="31268b66-5fca-44f6-8e22-acc281026eaf" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="519b201a-02"

[/simterm]

Everything looks like correct. Okay, go next.

Run iwctl, configure WiFi.

Find an interface:

[simterm]

[iwd] station list

[/simterm]

Find available WiFi networks:

[simterm]

[iwd]# station wlan0 get-networks

[/simterm]

Connect to yours. A password will be asked during the connection:

[simterm]

[iwd]# station wlan0 connect setevoy-linksys-5-0

[/simterm]

Install kernel’s packages:

[simterm]

[root@archiso ~]# pacstrap /mnt base linux linux-firmware

[/simterm]

And build initramfs:

[simterm]

[root@archiso ~]# arch-chroot /mnt/
[root@archiso /]# mkinitcpio -p linux

[/simterm]

Reboot – and it works now.