[Howto] Cannot open access to console, the root account is locked in emergency mode (dracut emergency shell)

If Fedora can’t mount /home partition for any reason, it’ll enter emergency mode (also known as dracut emergency shell) as it should, but will give this error message:

Cannot open access to console, the root account is locked.
See sulogin(8) man page for more details.

Press Enter to continue.

On pressing [Enter] it tries to reload emergency shell and the process repeats. Emergency shell is unusable.

1 Like

Why does this happen

This is a known problem. It happens Fedora releases 28 and newer, which don’t require password for root account during installation and use first user added as administrator/superuser. In this case root account is locked, and if /home is inaccessible – then the system can’t use superuser/administrator account either.

What to do

If you find yourself in this situation and you can’t resolve problem with /home mounting from Live disk/USB, and you need access to emergency mode, the solution is simple.

  1. Boot into Live disk/usb and chroot into your Fedora installations as documented in this Fedora quick-docs article – following steps 1 through 8.

  2. Unlock root account by supplying password for it:

    passwd root
    
  3. Exit chroot environment with [Ctrl-d] or

    exit
    
  4. Reboot your computer with GUI or with

    systemctl reboot
    

You should get back to emergency mode but with perfectly functional shell/console.

6 Likes

Hello,

I have the same problem as nightromantic’s posted solution and I am trying to solve this. I have the below output, but I don’t know how to match my output with the instructions of Fedora quick-docs article.

Device         Start        End    Sectors   Size Type
/dev/sda1       2048     923647     921600   450M Windows recovery environment
/dev/sda2     923648    1128447     204800   100M EFI System
/dev/sda3    1128448    1161215      32768    16M Microsoft reserved
/dev/sda4    1161216  313420961  312259746 148.9G Microsoft basic data
/dev/sda5  313421824  315121663    1699840   830M Windows recovery environment
/dev/sda6  315121664  317218815    2097152     1G Linux filesystem
/dev/sda7  317218816 1953523711 1636304896 780.3G Linux LVM

Could I have a help please?

Check this way:

lsblk
ls /dev/mapper
1 Like

@vgaetera ,

[liveuser@localhost ~]$ lsblk
    NAME                            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
    sda                               8:0    0 931.5G  0 disk 
    ├─sda1                            8:1    0   450M  0 part 
    ├─sda2                            8:2    0   100M  0 part 
    ├─sda3                            8:3    0    16M  0 part 
    ├─sda4                            8:4    0 148.9G  0 part 
    ├─sda5                            8:5    0   830M  0 part 
    ├─sda6                            8:6    0     1G  0 part 
    └─sda7                            8:7    0 780.3G  0 part 
      ├─fedora_localhost--live-swap 253:2    0   5.9G  0 lvm  [SWAP]
      ├─fedora_localhost--live-home 253:3    0 724.4G  0 lvm  /run/media/liveuser/d0ba1ebb-291d-472e-8746-7411f6b0bf4c
      └─fedora_localhost--live-root 253:4    0    50G  0 lvm  
    sr0                              11:0    1   1.4G  0 rom  /run/initramfs/live
    loop0                             7:0    0   1.4G  1 loop 
    loop1                             7:1    0   6.5G  1 loop 
    ├─live-rw                       253:0    0   6.5G  0 dm   /
    └─live-base                     253:1    0   6.5G  1 dm   /run/media/liveuser/Anaconda
    loop2                             7:2    0   512M  0 loop 
    └─live-rw                       253:0    0   6.5G  0 dm   /

and

[liveuser@localhost ~]$ ls /dev/mapper
control  fedora_localhost--live-home  fedora_localhost--live-root  fedora_localhost--live-swap  live-base  live-rw

but I am in from live DVD.

This should be the volume with your root file system:

/dev/mapper/fedora_localhost--live-root
1 Like

Now, when I boot it asks the root password, which I set with the above instructions.

After that, I put the new root password and I am to the shell as root. What I should do to bring the GUI and login to my desktop?

I tried the “startx” command, but nothing happened.

@dimgs, hi!

You usually don’t go to emergency mode to “startx”, computer goes there when it cannot boot normally. Emergency mode is usually used to troubleshoot things preventing normal boot – usually using cli commands. Then you just reboot into normal mode.

Here’s an FedoraMagazine article that gives some very brief overview of things you can do in emergency mode:

https://fedoramagazine.org/initramfs-dracut-and-the-dracut-emergency-shell/

Look for “The Dracut Emergency Shell” subtitle.

I suggest you create a new topic, and we’ll troubleshoot there why your system refused to boot in normal mode and dumped you to emergency mode.

2 Likes

After changing the mount point as the instructions above, I am trying to copy-paste some images from my “home” folder:

fedora_localhost–live-home

to an external HDD, but I receive this:

Error reading from file: Input/output error

How can I roll-back the mount points?

Hey @dimgs. Since your issue seems not strictly related to this topic (indeed this topic talks about how to enable the root account in order to use it in emergency mode) and you are experiencing a problem (it could also be a failing hard disk) while doing something other, well I suggest you to open another topic (post). :wink:

2 Likes

You might find you get stuck on @nightromantic’s suggestion of step 1 when using logical partitions in dual boot scenario’s.

Tried:

mount /dev/sda1 /mnt/root/boot/

Error:

mount: /mnt/root/boot: unknown filesystem type 'LVM2_member'.

Worked through mounting an LVM partition and everthing worked as expected. :slight_smile:

Thank you @nightromantic :+1:

1 Like

thanks! this helped me get out of the emergency mode loop…

1 Like

Hi @bunnydays, and welcome to Ask Fedora!

Yep, this catch22 is quite a tricky one is you don’t have an appropriate info.