“Welcome to emergency mode!” Boot Error: Understanding and Resolving fsck Issues

A file system error is one possible reason that you may encounter the Welcome to emergency mode! error message when attempting to boot your Linux system. While in emergency mode, you can determine if a fsck (file system check) error is the culprit of your problems by examining the system logs with journalctl. Once you are sure that an fsck problem is to blame, there are a few troubleshooting steps you can take to remedy the problem.

In this tutorial, we will go through the troubleshooting steps necessary to resolve fsck issues on a Linux system. The error itself is rather generic and could be caused by a variety of different issues. What ever the problem may be, it can sometimes be a fatal error that will prevent your computer from booting into the operating system until it has been fixed. Let’s get started!

In this tutorial you will learn:

  • How to check the file system for errors with fsck
  • How to examine system logs for errors with journalctl
  • How to fix a faulty /etc/fstab file to prevent booting issues
"Welcome to emergency mode!" Boot Error: Understanding and Resolving fsck Issues
“Welcome to emergency mode!” Boot Error: Understanding and Resolving fsck Issues
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software fsck
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to Resolve fsck Related Boot Issues




The Welcome to emergency mode! error message that you encounter when trying to boot your computer can occur under a variety of circumstances. In this tutorial, we will deal specifically with file system errors preventing the computer from booting properly. The full error message usually reads:

Welcome to emergency mode! After logging in,type "journalctl -xb" to view   
system logs, "systemctl reboot" to reboot, "systemctl default" or ^D to   
try again to boot into default mode.
NOTE
Just as the message says, you can always try executing systemctl default or use the Ctrl + D keyboard combination to attempt booting into “default mode” (and avoid emergency mode). However, this is only a temporary solution that will get you into your operating system, but does not clear the error message from occurring on future system boots.

Let’s go over some step by step instructions that we can use to identify and resolve an fsck boot error:

  1. While in emergency mode, we can heed the advice of the emergency mode welcome message, and execute the journalctl command to try and pinpoint the error that is causing us to enter emergency mode:
    $ journalctl -xb
    

    You will encounter some output like that below if the problem is indeed related to a file system (fsck) error:

    -- Unit systemd-fsckd.service has begun starting up.
    systemd-fsck[414]: /dev/sdb1 contains a file system with errors, check forced.
    systemd-fsck[414]: /dev/sdb1: Inodes that were part of a corrupted orphan linked list found.
    systemd-fsck[414]: /dev/sdb1: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
    systemd-fsck[414]: (i.e., without -a or -p options)
    systemd-fsck[414]: fsck failed with error code 4.
    systemd-fsck[414]: Running request emergency.target/start/replace
    systemd[1]: systemd-fsck-root.service: main process exited, code=exited, status=1/FAILURE
    systemd[1]: Failed to start File System Check on Root Device.
    -- Subject: Unit systemd-fsck-root.service has failed
    




    As you can see above, while systemd is attempting to start the fsckd service, it encounters a file system with errors, and a check is enforced. Once the check is failed, we receive an error message, which then puts the computer into emergency mode. Now we have identified the culprit.

  2. As indicated in the error message above, we have an issue with the /dev/sdb1 partition. Check your own error message to identify which file system is causing the error for you. If you can boot into default mode and access the command line terminal, unmount the partition that is causing problems and check the file system with the fsck command. Replace /dev/sdX1 below with the device path to your own partition:
    $ sudo umount /dev/sdX1
    $ sudo fsck -y /dev/sdX1
    $ reboot
    

    Note: if you are not able to boot into your operating system at all, then you will need to use a bootable USB drive or CD/DVD that has Linux loaded on it, and access the terminal from there to perform the file system check.

  3. If this did not resolve your problem, it could be due to the /etc/fstab file attempting to mount a partition that does not exist. It can also be from the file using an invalid mount option. If you have recently edited the /etc/fstab file to automatically mount a partition, examine it for any misconfigured lines, or consider removing the related line and performing more troubleshooting.
    $ sudo nano /etc/fstab
    
    Checking the /etc/fstab file for misconfigured partition mount lines
    Checking the /etc/fstab file for misconfigured partition mount lines

    This screenshot shows that we have one manually configured partition in the file. We can try deleting this line and see if the PC boots without any problems.

  4. It is worth noting that many users who dual boot their Linux system with Microsoft Windows have also reported encountering this error. The solution in that case is to disable Windows’s ‘fast boot’ feature. Or, you can reboot Windows from the command line with the following command, which circumvents ‘fast boot.’ Then, see if you can boot into your Linux operating system without any problems:
    shutdown /s /t 5
    

Closing Thoughts




In this tutorial, we saw how to resolve file system check errors that cause our system to boot into emergency mode on a Linux system. This is a frustrating error that will sometimes completely prevent us from successfully booting into the operating system. In the steps above, we covered a variety of common scenarios that are known to cause this error. Unmounting the problematic partition, performing a file system check, verifying the /etc/fstab configuration file, and (when applicable) disabling Window’s Fast Boot option are all possible solutions to the problem.



Comments and Discussions
Linux Forum