I made a mistake and cannot log into my fedora (18) machine anymore. The system only has one user, when I was logged in as that user I locked that user such that it cannot create new processes and then I killed all processes for that user, also Xorg.

At the login screen, when I try to log in with user name and password, it cannot authenticate.

When I try to login in the command line (by pushing ctr+alt+f1) and to login as root, it asks me for a password. The problem is that I have never set a root password.

In google I found information about the init=/bin/bash trick, which means adding this line to the boot record in grub and then a bash starts. This works and I have a bash where I am logged in as root. However, when I try to use passwd to give a password to root, I get a Authentication token manipulation error. Unlocking the user account with passwd -u username does not work either, because everything is a read-only file system. Adding another user did not work for me either, because I don't have the useradd command.


I got a little bit further, I know now that I can avoid the read-only file system by using rw init=/bin/bash in grub. If I then unlock with passwd -u username, it tells me it was a success. I can also change the root password.

However, now, when I try to start fedora to get to the login screen, it does not even get there but gets stuck where it displays the fedora logo. I am able to switch to another tty where it prompts me for login. But when I try to log in as the user or as root with the new password, it fails.

Could anyone help me to get out of this mess?

  • In addition to my answer below, you may want to review this question that was asked on Meta Super User a while back. – allquixotic Apr 24 '14 at 15:46

From your edit, it looks like you might have munged stuff up (in ways which aren't entirely clear to me from the details you've given here) to the point that a reinstall might be better for you. However...

To respond to your initial problem of setting a password on a system you've been locked out of; this is actually quite easy.

What I will typically do is boot up the Live CD (or whichever media I used to install the OS originally), then use chroot to virtualize into the root directory of the (mounted) main system. At this point, the / directory is re-mapped to the / directory of your actual system on the hard disk, and you'll have root access. Before you do this, make sure you mount all relevant volumes of the system you're rescuing.

For example, if you originally had:

/dev/sda1 on /boot
/dev/sda2 on /
/dev/sda3 on /home
/dev/sda4 on /var

you'd have to mount them in the live/rescue system as follows:

/dev/sda2 on /mnt/rescued
/dev/sda1 on /mnt/rescued/boot
/dev/sda3 on /mnt/rescued/home
/dev/sda4 on /mnt/rescued/var

You can then of course run passwd (or any other root commands you need to recover the system). This method works fine as long as you don't have disk encryption on your system.

Regarding your immediate problem: It is possible that the passwd reset in your init=/bin/bash environment didn't actually "stick" because the password database file was on a mount point that wasn't mounted at the time. This is unlikely but possible, depending on your mount points.

This is the best I can offer with the information you've provided. However, this really smacks of a "troubleshooting" question where a lot of back and forth will be necessary to restore you to a working system; due to that, I would recommend you use Root Access chat to chat with some of us and resolve the problem interactively. It's a better medium than the question and answer site for troubleshooting questions of a very localized nature like this.

I'll leave your question up for now, but just be aware that it is probably not obvious to anyone exactly how to fix your system (without a reinstall) based on the info in your question, especially now that you have "messed around" with it and have introduced a startup problem and aren't getting to the desktop environment properly.

  • I got it to work with the live cd as you suggested: mount all partitions, do chroot and the I reinstalled gdm and everything worked. Thanks! – user1981275 Apr 25 '14 at 9:53

Probably your root file system is read only. Remount it: mount -o remount,rw /dev/mapper/fedora-root (type your device name) Then change password.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.