Stuck with the boot error, Welcome to Emergency mode in Linux? We can help 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.
As part of our Server Management Services, we assist our customers with several Linux queries.
Today, let us see how to fix, Welcome to Emergency mode in Linux.
Welcome to Emergency mode in Linux – Boot error
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.
Moving ahead, let us see how to resolve this issue.
-
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.
-
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.
-
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.
-
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 it, select Change settings that are currently unavailable in Control Panel\All Control Panel Items\Power Options\System Settings. Uncheck the option “Turn on fast startup”.
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.
[Need help with either of these? We’d be happy to assist]
Conclusion
To conclude, this error occurs after an emergency power outage on a server, a system crash, or similar situations. Today we saw how our Support Techs fix them.
Thank you sir