Can't log in to Linux with correct password, error "POWER FAILURE"?

Thu, 08/02/2024 - 11:26 -- James Oakley

Today, I had a very annoying problem that I managed to fix. It's a couple of hours of my life that I won't get back, and I found very little online to help me.

So, to help anyone else with the same problem, here's the problem and the solution.

For what it's worth, this is with Fedora 39, KDE Plasma spin. But I honestly suspect that makes little difference. Other distros (Debian, Ubuntu, etc.) are probably just the same.

What happened: An innocent power cut?

Our power tripped. My computer is connected to a UPS, which shut the computer down when the battery drained too low. I turned the power back on, and brought the computer back up. But I couldn't log in.

I tried all the obvious things. Did I have capslock on? (No). Type the password really slowly, checking every key. (No joy).

My next trick was to press Ctrl+Alt+F3 to enter TTY3, and try a terminal login. I was able to confirm I was entering the correct password. If you type in the password wrongly, you get "Login incorrect". If you type it in correctly, you still can't log in, but you get a different error:

Fedora Linux 39 (KDE Plasma)
Kernel 6.6.14-200.fc39-.x86_64 on an x86_64 (tty3)

mypc login: james
Password:
Login incorrect

mypc login: james
Password:
POWER FAILURE

Authentication Failure

Screenshot of the login errors

TL;DR: It was a marker file placed there by my UPS.

Digging around to find the problem

Searching the internet for login problems where the error is "POWER FAILURE" led me nowhere.

So I made a Fedora Live USB and booted into that. I did other things that were red herrings (ran fsck on every disk partition I have in the computer) and was able to mount the root file system of the computer. (Remember, in a Live USB, you need sudo to make any changes to the physical hard drives in the computer to prevent accidental alterations.)

sudo mount /dev/sdc2 /mnt

That meant I could search my logs, and I found this

sudo grep POWER /mnt/var/log/messages
Feb  8 07:47:33 mypc sddm[1290]: Authentication error: SDDM::Auth::ERROR_AUTHENTICATION "POWER FAILURE\n"
Feb  8 07:47:43 mypc sddm[1290]: Authentication error: SDDM::Auth::ERROR_AUTHENTICATION "POWER FAILURE\n"
Feb  8 07:47:52 mypc sddm[1290]: Authentication error: SDDM::Auth::ERROR_AUTHENTICATION "POWER FAILURE\n"

Armed with the actual error message, I was able to search the internet more exactly. That led me to this page on the Fedora forums. There was only that one page on the entire internet. That's why I'm writing this up: It's highly like there are more than two of us who encounter this problem, so I want to make it easier for people to search and find the answer.

The user who was asking for help there figured out the problem himself:

Screenshot from the Fedora Forums

Nevermind...figured it out.

apcupsd created a nologin file presumably to prevent new logins during the shutdown process. That should have been removed at some point but when the power came back up, there were a couple of "hiccups" where the power went out and came back in quick succession before going down again for a bit. I'm guessing that those hiccups somehow prevented apcupsd from removing the nologin file.

Solving the problem

I now knew I could solve this. Thanks, dciarnie, whoever you are.

Checking the man file for apcupsd.conf told me that the default location for the nologin marker file is /var/run. I checked in my live USB environment

sudo ls /mnt/var/run -l

and it was empty.

So I found my apcupsd.conf file at /etc/apcupsd/apcupsd.conf and checked it (again, remember, I'm doing all this in my live USB environment).

sudo grep -i login /mnt/etc/apcupsd/apcupsd.conf
# NOLOGINDIR <path to nologin directory>
#   Directory in which to write the nologin file. The existence
#   of this flag file tells the OS to disallow new logins.
NOLOGINDIR /etc

Sure enough, there was a file named /etc/nologin. The contents of that file? You guessed it:

sudo cat /mnt/etc/nologin
POWER FAILURE

Remove the file

sudo rm /etc/nologin

Reboot. And away we go.

Blog Category: 

Comments

Endre's picture
Submitted by Endre on

Thank you so much for this writeup! I stumbled upon exactly the same problem on my laptop. I am using Fedora 39 and I was debugging a APC UPS using the USB cable and apcupsd. At some point the UPS failed, and apcupsd instructed the laptop to shut down. Afterwards, I could not log in with my user account because of the /etc/nologin file with "POWER FAILURE" inside.

With the help of this Fedora article, I was able to boot into single user mode and remove the nologin file. It essentially requires you to:

  • Interrupt the boot, to edit the grub configuration.
  • Add the following to the linuxefi line in the grub configuration: rw init=/bin/bash

Without your writeup, it would have taken me a ridiculous number of hour to figure out the nologin problem. I have never dealt with the nologin mechanism before. Again, thank you so much!

James Oakley's picture
Submitted by James Oakley on

As an alternative to editing grub, you can also boot with a live CD and mount the partition that normally powers the system root, and remove the nologin file that way. More than one way to solve, but as you say - until you know that's what's causing the login failures, there's no way forwards. Hopefully this will help others too in due course.

Add new comment

Additional Terms