Password not working after sign in

Ubuntu Support Template

Ubuntu Version:
24.04

Desktop Environment (if applicable):
KDE Plasma 5.27.12

Problem Description:
Starting the switch from Windows to Ubuntu Studio and starting with my laptop. Ubuntu installed and I am able to login with the password I set. Once I am logged in however, the password stops working. I cannot use it for sudo commands, I cannot use it to reset my password, I cannot even use it to unlock my screen after it locks - I am forced to reboot. I read an followed instructions on how to enter recovery mode and add my account to the sudo group. There is a problem with grub where I select the recovery mode option, which should bring up a list of options - it does not, it is a blank menu. By trial and error I was able to find the option I needed. None of this has helped. Occasionally Sudo and my password seems to work, but with no consistency and I have not yet decerned a pattern for when it does (it is very rare and sometimes after a boot, but only once and then stops and not after every boot). Ubuntu will be useless to me if I cannot sudo. It just keeps saying that authentication failed. WAY past my level of Linux fu.

Relevant System Information:
Lenovo Legion Y545. Brand new Ubuntu Studio install, clean wipe from Windows 11. Kernel Version 6.14.0-33-generic (64-bit)

Very commonly, it doesn’t need Linux-fu at all. Two of the most common sources of this kind of problem are:

  • Faulty keyboard (including weak keyboard batteries). Try a different keyboard to login.

  • Keyboard language different than system language.

1 Like

If you can open up the laptop, confirm that the keyboard connector strip is

  • not compromised, and
  • properly seated at both ends (motherboard and keyboard).

Otherwise, make sure the insides don’t have so much “dust” that you are experiencing random circuit shorts.



If the above doesn’t help, do you experience the same problem when you use a Live ISO? You should be able to test that

  • by setting a password for root during your Live session,
  • creating a secondary user with Admin privileges (again in Live session),
  • doing su to that secondary user, then
  • attempting sudo command for a root-only service and see if it behaves correctly.

Update: While playing around with things, I noticed that when the screen locks and I go to unlock it, there is a button almost hidden to the right of the password input box. The first is the right facing arrow, but the second is an upward and downward facing arrow side by side. When I input the password before hitting that button, it fails, but when I hit the button with the side by side arrows are larger sign in box appears giving me both the option to change user and a pull down menu for different versions of Plasma. When I use the same password on this screen, I am able to sign in no problems. It seems as though the two sign in screens are authenticating with different authentication lists. This tells me that my password and possibly my whole account has not fully propagated throughout the device. I do not know linux well enough to say which authentications each are using, but I am guessing that even knowing I supposedly added my account to the sudo group (assuming my instructions were correct and that I followed them correctly) that the sudo group is not talking to the correct authentication service, and my credentials are not being disseminated. Is there anyone out there with knowledge of the various authentication services (kerberos?), how they interact, and how to force them to talk / share credentials?

That sounds legit troubleshooting steps, and completely beyond my ability to without some very specific instructions. I work in IT and data centers, I am no stranger to that field, but my linux is beginner at best, part of why I am making the switch from Windows (that and windows security just sucks). Can you give more detailed instructions?

I have a high degree of certainty that the keyboard is not faulty. Plus I am able to sign in with no problems from the boot up login screen every time.

Now I BELIEVE the Keyboard language should be the same as the system language, but where / how do I verify that? And how do I change it if I think it is incorrect?

Hi and welcome to Ubuntu Discourse :slight_smile:

Please open a terminal and run the following commands separately:

locale
setxkbmap -print -verbose 10 | grep layout

Copy the output from the terminal and paste back here in a reply. Then highlight the text and use </> in the composer or Ctrl + E on the keyboard to wrap with code tags.

Let’s first see if the system language and keyboard layout match up before next steps.

cowboy-dave@cowboy-dave-Legion-Y545:~$ locale

LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

cowboy-dave@cowboy-dave-Legion-Y545:~$ setxkbmap -print -verbose 10 | grep layout
layout: us
cowboy-dave@cowboy-dave-Legion-Y545:~$

Thanks for posting the output.

It appears that the system language and keyboard layout do indeed match.

Next thing to check is whether you (as user) are in the sudo group:
groups

You should see something like this:
cowboy-dave : cowboy-dave sudo adm

If sudo is missing that is likely the root of the issue.

Either post the output or let us know whether it is there or not.

If it does show you in the sudo group, test this to see if sudo can prompt correctly:
sudo -l

What happens when you type the password?

Does it authenticate or do you get error messages?

If errors, post them here please.

cowboy-dave@cowboy-dave-Legion-Y545:~$ groups
cowboy-dave adm cdrom sudo audio dip plugdev users lpadmin

cowboy-dave@cowboy-dave-Legion-Y545:~$ sudo -l
[sudo] password for cowboy-dave:
Sorry, try again.
[sudo] password for cowboy-dave:

Oh, and as a side note, I have tried changing the keyboard layout in settings - no change. Also I have opened LibreOffice and tested the keyboard and the output was correct. I also typed out my password there and it typed correctly.

Since we seem to have ruled out other possibilities, I am starting to suspect there is some issue with PAM (Pluggable Authentication Modules) used by sudo, screen unlock, etc.

We can check this and hopefully see if there is anything missing or misconfigured:
cat /etc/pam.d/sudo

Post the full output.

Thanks

Given what you said about being “beginner at best”, I am feeling uncomfortable to offer instructions.

I think, before trying anything which, admittedly, is “fancy footwork”, I will

  • allow those more intimate with the inner workings to guide you,
  • recommend you read a few Beginner books to ensure that you become familiar, and have comfortably mastered, basic command line and OS functions, and
  • possibly suggest that you may want to practice within a Live environment before commiting to performing actions with an on-disk installation.

I think it goes without saying that you must make backups of all important data at this point.

Hopefully we can help you resolve this but if not then the likely solution will be to reinstall.

1 Like

As I stated before, this is a fresh clean install from Windows 11, I made sure to back everything up before the install. If this entire OS was nuked there is nothing that cannot be re-downloaded. Just bout everything I have is on external drives, and those have back ups. Not my first goat rodeo :wink:

cowboy-dave@cowboy-dave-Legion-Y545:~$ cat /etc/pam.d/sudo

#%PAM-1.0

# Set up user limits from /etc/security/limits.conf.
session    required   pam_limits.so

session    required   pam_env.so readenv=1 user_readenv=0
session    required   pam_env.so readenv=1 envfile=/etc/default/locale user_readenv=0

@include common-auth
@include common-account
@include common-session-noninteractive

cowboy-dave@cowboy-dave-Legion-Y545:~$

Oh, also, this install is only 3 days old, and without reliable sudo access, I have not been able to do much downloading since then, so this is mostly a clean off the shelf version. I downloaded a VPN, I think that is the extent of what I have been able to do so far.

Can we see the output from this please:
ls -l ~/.Xauthority ~/.ICEauthority 2>/dev/null

Thanks

cowboy-dave@cowboy-dave-Legion-Y545:~$ ls -l ~/.Xauthority ~/.ICEauthority 2>/dev/null
cowboy-dave@cowboy-dave-Legion-Y545:~$

I think we might be getting somewhere; those files appear to not exist and may be the cause of the problems.

We need to check your home permissions to hopefully confirm this:
ls -ld ~

cowboy-dave@cowboy-dave-Legion-Y545:~$ ls -ld ~
drwxr-x--- 18 cowboy-dave cowboy-dave 4096 Oct 17 18:34 /home/cowboy-dave
cowboy-dave@cowboy-dave-Legion-Y545:~$