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

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.

10 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

6 posts were split to a new topic: After I’ve given the root user a password, how do I log in and use that account?

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:

2 Likes

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.

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

This is really a good candidate for :fedora: QUICK-DOCS

Who is willing to colaborate?

I was in a trouble this morning and this guide helps me a lot.

REFERENCES

Regards.,

1 Like

I agree! I filed Issue #401: Good Quick Docs candidate: how to log in to emergency shell when root is locked - quick-docs - Pagure.io to put the suggestion in a second place at least.

How to Reset the root Password :: Fedora Docs

1 Like

This docs has two problem:

1.- is just migrated from wiki and anybody reviewed it.
2.- doesn’t have how to mount the default system brtfs.

Regards.,

1 Like

I think, also, it needs a little tailoring for people who have this specific console problem, which we see pretty frequently. (This topic has almost 80,000 views!)

@hhlp Héctor Louzao

Let’s not forget that some choose to use encryption also. So the LUKS container would have to be unlocked before gaining access to the partition data.

Thx for your recomendation, so this quick-doc should be also tweak as OP redirect in the answer.

Here is the issue:

https://pagure.io/fedora-docs/quick-docs/issue/402

Regards.,

2 Likes