After a kernel upgrade, Ubuntu 24.04 can sometimes drop straight into emergency mode if the initramfs can’t mount the root filesystem. The prompt usually looks like:
Emergency mode
You are in emergency mode. The root filesystem is mounted read‑only.
Below is a practical walk‑through of the most common culprits and how to bring the root back online without compromising security.
Why emergency mode happens
- UUID mismatch – The kernel’s
root=parameter points at a UUID that no longer exists (think LVM snapshot churn or a fresh partition). - Missing drivers – The initramfs was rebuilt without the modules needed for your storage controller or filesystem.
- Secure‑boot hiccups – A signed kernel gets rejected because the firmware can’t find the signing key or the initramfs isn’t signed.
- Filesystem corruption – Bad blocks or a half‑finished update can stop the kernel from mounting the root.
The emergency shell gives you a minimal environment with the root filesystem mounted read‑only, which is perfect for debugging without risking further damage.
Getting to the emergency prompt
- Boot menu – At the GRUB screen, press Esc to reveal the hidden menu.
- Select the new kernel – If the latest kernel is already chosen, pick the previous one (or go to Advanced options for Ubuntu → Ubuntu, with Linux <old‑kernel>).
- Press
e– Edit the boot entry, replacequiet splashwithsystemd.unit=emergency.target, then press Ctrl‑X or F10.
You’ll land in a root shell. The prompt will be root@ubuntu:/#.
Diagnose the root mount failure
# Show the kernel command line
cat /proc/cmdline
# List block devices and UUIDs
blkid
lsblk -f
Compare the root= value from /proc/cmdline with the UUIDs shown by blkid. If they differ, you’ve got a UUID mismatch.
Check /etc/fstab for the same UUID. If it’s wrong, update it:
nano /etc/fstab
Replace the old UUID with the correct one, then save.
Fix a UUID mismatch
After correcting /etc/fstab, update GRUB so the kernel uses the right UUID:
update-grub
If you’re still in emergency mode, reboot with the old kernel and run the same commands again. Once the UUID matches, the root should mount normally.
Repair the filesystem
If the UUID is correct but the filesystem is corrupted, run a filesystem check from the emergency shell. First, unmount the root (it’s read‑only, so this is safe):
umount -R /
Then run fsck on the device:
fsck -f /dev/sda1 # replace with your root device
Follow the prompts to fix errors. After completion, remount the root read‑only:
mount -o remount,ro /
Rebuild initramfs
If the problem was missing drivers, rebuild the initramfs for all installed kernels:
update-initramfs -u -k all
If you need to add a module (e.g., nvme), edit /etc/initramfs-tools/modules:
echo nvme >> /etc/initramfs-tools/modules
update-initramfs -u -k $(uname -r)
Reboot to test.
Security considerations
- Secure boot – If you use UEFI Secure Boot, make sure the kernel and initramfs are signed with a key the firmware trusts. A missing key will cause the kernel to refuse to boot, which can also trigger emergency mode.
- Root‑fs integrity – Consider enabling
dm‑verityon the root partition. It provides read‑only verification at boot time and prevents tampering. - Minimal initramfs – Keep the initramfs lean; unnecessary modules increase the attack surface. Use
initramfs-tools’sMODULES=mostorMODULES=depto include only what’s needed.
Common pitfalls
| Symptom | Likely cause | Fix |
|---|---|---|
| “root: unknown filesystem type” | Wrong filesystem type in /etc/fstab |
Verify TYPE= field |
| “no such device” | Wrong device name in root= |
Use lsblk to find the correct device |
| “Failed to load module” | Missing module in initramfs | Add to /etc/initramfs-tools/modules and rebuild |
| “Secure boot rejected kernel” | Kernel not signed | Sign the kernel or disable Secure Boot (not recommended) |
When all else fails
If you can’t resolve the issue from the emergency shell, boot from a Ubuntu 24.04 live USB:
- Mount the root partition:
sudo mount /dev/sda1 /mnt - Bind‑mount necessary filesystems:
for d in /dev /dev/pts /proc /sys; do sudo mount --bind $d /mnt$d; done - Chroot into the system:
sudo chroot /mnt - Reinstall the kernel or repair the initramfs from within the chroot.
After exiting, unmount and reboot.
See also
- Granting Group Write Access on a Shared /srv/web Directory Using ACLs Without Changing File Ownership
- Hardening a Home Assistant Docker Container with User Namespaces and Read‑Only Volumes
- Avoid systemd‑resolved from overriding your /etc/hosts entries on Ubuntu 24.04
- Fixing the “Permission denied” error when mounting a host directory into a rootless Podman container
- Using journalctl’s _SYSTEMD_UNIT filter to debug intermittent Docker start failures