[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.

2 Likes

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.

7 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.

1 Like

@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.

I have exactly the same experience…I can login to this new ‘root’ but that does not really help as I cannot recover anything from the old installation even though I can ‘see’ it . It seems that everyone assumes that getting to the ‘root’ will solve everything - I have no idea how to proceed. I will search other solutions but since I have done the steps suggested here (and the linked page), it is even harder to explain what help I need?
I was hoping to learn Fedora OS in a much less stressful way, my Fedora laptop is now not usable (for a couple of weeks already), I feel like wiping everything and installing it again.

Hi @znam and welcome to Ask Fedora!

Logging in as root usually gives you power to resolve most issues preventing normal boot/login of your system. Of course, you have to have some idea of what to do, it won’t resolve itself.

The issue at question on this page prevents people from accessing recovery console – even for people who do know what to do once there – and for completely unexpected reason. That was the reason for this post – not as a way to solve any issue, but as a way to login to recovery console, nothing more.


One of the most often encountered reasons (but not the only one) your system dumps you to emergency console is it can’t mount your root or home filesystem. Quite often in such a case you can run fsck manually from a recovery console to resolve some filesystem issues.

For more specific help you need to create a new topic explaining your problem, provide any error messages you can see – either as text or as screenshots. The reasons for boot failure are different, the solutions will be different as well. To provide any help / advice we need to know, what’s the actual problem in your case.

Edit: I see you’ve already created a new topic. We can troubleshoot your problem there.

Note that (at least in F31) you can’t enter into rescue.target (by running systemctl isolate command or by adding systemd.unit kernel parameter, it’s the same) if SELinux is in “enforcing” mode. I don’t know it’s a bug or not, but keep in mind that if you want to use rescue target, previously you should have put your system in “permissive” SELinux’s mode

A post was split to a new topic: Root account is locked