Are you facing the boot error 'Welcome to Emergency mode in Linux' ?
This guide is for you.
Recently we had a customer who came across this error. At times, the emergency mode means that there is corruption in the file system.
Emergency mode , provides the minimal bootable environment and allows you to repair your system even in situations when rescue mode is unavailable. In emergency mode , the system mounts only the root file system, and it is mounted as read-only.
In this context, we shall look into how to fix the error, Welcome to Emergency mode in Linux.
Nature of the boot error, Welcome to Emergency mode in Linux ?
Generally, this error occurs after an emergency power outage on a server, a system crash, or similar situations.
However, in 90% of cases, the error relates to fstab or Linux file system damage which we can fix quite easily.
Now, let's see how to resolve this issue.
1. How to Fix Linux File System Errors Using LiveCD
Suppose, there is a failure on the server and while connecting to Linux server in the remote console or VNC, we see the following:
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 boot into default mode.
Give root password for maintained (or press Control-D to continue).
The emergency mode provides a minimum Linux environment to recover our system if an OS cannot boot into the rescue mode.
In the emergency mode, Linux mounts the root file system as read-only.
If we press Control + D, the system will start booting, but in some time it gets back to the emergency mode.
In order to solve this, we boot our server from a LiveCD or LiveUSB and use the SystemRescueCd tool.
Then we run a file system check and fix all found errors using this command:
# fsck -y /dev/sda1
Eventually, we check all partitions and restart our host.
In most cases, this will solve the problem.
2. Emergency Mode due to /etc/fstab issues
Another possible error is a fstab damage or incorrect configuration.
Initially, we try to boot from systemrescuecd. Then we check whether the issue is resolved. If not, open fstab.
In this case, there were no disk partitions to mount.
To solve this, we must get UUIDs of disks using blkid.
Then add all the information we have got in fstab and reboot our Linux host.
If done properly, our Linux will boot in normal mode.
3. Linux Has Been Installed from a USB Stick
When we install Linux from a USB media, after a server restart, the system might boot with a ‘Welcome to emergency mode!’ message.
After viewing fstab, turns out that the USB device displays there as a working partition.
In this case, we delete the USB drive mount entry and reboot the system.
Like in the first case, we must boot from systemrescuecd and open fstab.
It is likely, we will see a similar entry- /mnt/usb1.
Just remove this line if we are not using the USB drive.
4. Dualboot Windows and Linux configuration
Another variant of this problem is using both Windows and СentOS on the same computer. The emergency mode error often occurs when mounting Windows partitions during the boot.
Usually, we can solve the problem by disabling Windows fast startup.
To disable Windows fast startup:
1. Select Change settings that are currently unavailable in Control Panel\All Control Panel Items\Power Options\System Settings.
2. Uncheck the option “Turn on fast startup”.
3. Eventually, save the changes and restart the device.
Now, Linux should boot normally.
In addition, using LVM partitions may also lead to this error.
However, the solution is similar to the common partition: check fstab configuration and fix errors in it.