Fixing "ERROR: device /dev/mapper/root not found"
This morning I booted my work laptop, only to be greeted by the error mentioned in the title.
Being thrown into an emergency shell is not my prefered way to start my work day, but it is what it is and being a Linux user, I at least have tools ready to use to tackle such a problem.
It was not the first time that I encountered that problem. As far as I remember I always updated either the Linux kernel or some firmware package which then resulted in my encrypted drive not being mounted/found properly. Each time, recreating my inital ramdisk environment via mkinitcpio
solved that issue. I assume that during the package update process something might have gone wrong recreating it (which normally happens automatically at least after updating the linux kernel). Yesterday was such a day where I updated the linux-firmware
, linux-firmware-whence
and amd-ucode
packages before shutting down my computer to end my workday.
Since I was unable to use the emergency shell in any way (especially since no keyboard worked, neither the internal laptop one nor my USB one) I grabbed my ready-to-use arch linux install medium USB stick from my drawer and booted into it. I highly recommend having such an USB stick always ready (independent of the distribution in use) to be able to boot into your machine if the installed OS stops working. It is one of the superpowers people using Linux have – being able to access all their system by booting with another system.
Once booted into the installation medium, I was able to open my internal encrypted drive via cryptsetup
and mount it and the boot partition. Using arch-chroot
, which basically wraps chroot
while ensuring some important functionality I was able to change into my local system installation.
Into my local system, there was only one thing left to do: Recreating my ramdisk environment on my boot partition. I achieved this by using mkinitcpio -P
, which recreates all presets available. After waiting a few seconds for it to finish its job, I exited from the chroot, unmounted the boot and root partitions, rebooted my system and ta-da, it is booting properly!
Linux rocks!