Welcome to Emergency mode in Linux - Fix this boot error now ?









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.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to resolve Linux Errors.

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.


[Need urgent help in fixing Ubuntu errors? We'd be happy to assist. ]

Conclusion

This article covers how to fix boot error, Welcome to Emergency mode in Linux. This issue happens after an emergency power outage on a server, a system crash, or similar situations.


The Emergency Mode sometime means that your file system may be corrupted.

In such cases, you will be left out with a prompt to go nowhere.

All you have to do is perform a file system check using,

fsck.ext4 /dev/sda3

where sda3 can be your partition and if you are using ext3 file system, change the command as follows:

fsck.ext3 /dev/sda3

About the partition number, Linux shows you the partition before arriving at the prompt.

This should solve the problem.


To fix  Emergency Mode On Ubuntu:

1. use Ubuntu Live USB to boot, and open terminal:

$ sudo fsck.ext4 /dev/sda3

2. Adding sudo because it needs root permission.

(Replace ext4 with ext3 if applicable to you)

3. Cycle through the SDAs by changing the last number in the sda to see which file system has problems.

Ex: sda1, sda2, sda3, sda4, and so on

4. As I encountered, the problem might be with the 'home' directory.

5. Once you run the above command, you'll be prompted to fix the issue right inside the terminal itself.

6. Keep hitting y (for yes) until the end of the fix.

(or you can use -fy for automatically response yes to all.)

7. Navigate to the home folder of your sda using your files explorer.

(This will be mounted from the HDD since you are working with a Live USB)

8. Check inside 'home' if you can see all your files. If yes, then you're ready to reboot to your system (remove the Live USB).




Keep In Touch

We hope to hear from you.

Accept File Type: jpg,jpeg,png,txt,pdf,doc,docx