When systemd cannot finish booting, usually because a filesystem in /etc/fstab failed to mount, it stops at You are in emergency mode. SSH is not running, so you fix it from the VPS console. The cause is almost always a bad fstab line or a filesystem that needs checking.
Before you start
- Open the VNC/console from your VPS control panel.
- Have the root password ready. Emergency mode asks for it.
Find what failed
Log in with the root password and read the boot log:
journalctl -xb | grep -iE "fail|error|timed out" | head -30Typical lines:
Dependency failed for /dataorTimed out waiting for device /dev/disk/by-uuid/…: an fstab entry points to a disk that no longer exists or has a new UUID.UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY: the filesystem needs a repair.
Fix /etc/fstab
The root filesystem may be mounted read-only. Remount it writable first:
mount -o remount,rw /Compare fstab with the real disks:
blkid && cat /etc/fstabEdit with nano /etc/fstab and correct the UUID, or comment out the broken line with #. For extra data disks, add nofail so that a missing disk never blocks boot again:
UUID=1234-abcd /data ext4 defaults,nofail 0 2Test every entry without rebooting:
systemctl daemon-reload && mount -aNo output means all entries mounted. The full fstab format is explained in mount a new disk with fstab.
Repair the filesystem
If the log asks for fsck, run it on the unmounted partition:
umount /dev/vdb1 && fsck -y /dev/vdb1For the root filesystem, boot the rescue ISO and run fsck from there, because it cannot be checked while mounted read-write. See fix a read-only file system.
Boot normally
systemctl defaultOr simply run reboot. Confirm afterwards with systemctl --failed that no units failed.
Other causes
- A full root disk can stop services from starting. See fix no space left on device.
- A broken kernel or initramfs causes a different failure; see recover from a kernel panic.
- A mistyped mount option, such as
defualts, also makes the mount fail.
FAQ
What is the difference between emergency mode and rescue mode?
Rescue mode mounts all local filesystems and starts basic services. Emergency mode mounts only root, usually read-only, because something essential failed.
I don't know the root password. What now?
Boot a rescue ISO, mount the root disk, chroot into it and set a new password with passwd. Then fix fstab from there.
Should I use device names like /dev/vdb1 in fstab?
No. Device names can change between boots. Use UUID= values from blkid.
