After unlocking the encrypted disks, my server enters emergency mode. I lost the root password to access it. Is there a way to reset it?

2

First off, I've been looking into this question for quite a while, but it seems that finding a solution in near impossible.

So here's the deal:

I have an encrypted LVM setup, multiple drives fused to one mount point. When I boot the server, I unlock the encryption with a password, that I remember. The boot starts, and then hangs because of a problem with a drive; it cannot mount 1 drive that is required in the fstab.

The boot then stops, and enters emergency mode, where it asks for a root password, that, for the life of me, I can't remember. I think it might have something to do with the keyboard that's AZERTY when the keyboard is seen as QWERTY by the OS.

I've been told that the best way to do would be to boot a bash shell before the OS and then change the root password from there, comment the drives out in fstab, and reboot. Is it possible ? How should I do such thing?

N07070

Posted 2017-12-14T10:19:44.597

Reputation: 31

It is definately possible to fix this - but the advice to boot to a bash shell is overly simplistic and the exact steps are a bit variable. You need to use a rescue CD which recognises LVM and has decryption tools - in general terms you boot the rescue disk, ensure the LVM is reconstructed, manually decrypt the root partition, mount it and edit /etc/shadow to change the root password. You can, of-course also fix the fstab file at this point. – davidgo – 2017-12-14T18:10:19.560

No answers