Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I installed Ubuntu on an old XP machine (replaced XP with Ubuntu) and it seemed like it went well... Until I tried to download and install the suggested updates!

The password I set during installation will not work for authentication. It won't even work for the User account. I thought maybe I'd typed the password wrong (twice) and checked online how to change it. Holding shift during start up won't give me boot options or grub so I can't get into recovery mode!

I've reinstalled three times (twice with the CD, once with the usb) and it's the same deal.

Basically, I'm sure I typed the password correctly, so I severely doubt that changing the password will help. It will automatically log in if I set it to do so during installation. Otherwise, I can only use the guest account and obviously can't setup another account or update software.

This is my first experience with Ubuntu and until it asked for the password, I thought it had gone so well. I sincerely hope I've missed something simple and I can get this working properly.

I'm surprised that I haven't found any questions with exactly the same issue. Please help! :)

Requested information

1: df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       147G  4.7G  135G   4% /
udev           1000M  4.0K 1000M   1% /dev
tmpfs           403M  836K  402M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none           1007M  176K 1007M   1% /run/shm
/dev/sdc1       7.5G  4.7G  2.8G  63% /media/PENDRIVE
patricia@[computer name removed by me just in case it shouldn't be shared]

2: dpkg -l | egrep 'lightdm|gdm|kdm|lxdm'

ii  liblightdm-gobject-1-0       1.2.1-0ubuntu1          LightDM GObject client library
ii  lightdm                      1.2.1-0ubuntu1          Display Manager

3: Regarding whether or not there were error messages when logging in to a virtual console and attempting to change the password with passwd and sudo passwd $USER:

  • No, I had to do the mount remount thing first but it said the password was successfully changed after that. It also tells me that I've successfully logged in...

New development:

I can now login to the user account created during setup.... I still can't use that password to authenticate though!

Hopefully we're getting closer.. Thanks so much for all your help :)

share|improve this question
add comment

2 Answers

Summary: How This Problem Has Developed

So far, this problem appears to have progressed through two stages.

  1. First, it was not possible to log in at all, on the graphical login screen. It was possible to log in on a virtual console. Information obtained in a virtual console indicated that:

    • The output of df -h shows there's plenty of free space available. Graphical login has been known to fail when there is zero or very little free space on the hard disk, but that is apparently not what's wrong here.
    • The output of dpkg -l | egrep 'lightdm|gdm|kdm|lxdm' shows that the only display manager (which provides the login screen) installed is LightDM. This information was valuable because a potential solution to being unable to log in could have been to try a different display manager (for example, by installing and switching to gdm).
    • When changing the password, you said "had to do the mount remount thing first but it said the password was successfully changed after that." That suggests to me that you actually changed the password by booting into recovery mode, and not on the virtual console. If I am mistaken about this assumption, please let me know.
  2. Now, you can log in, presumably by entering your username and password at the graphical login screen. (Please make sure to let me know if this is not correct.) However, you cannot authenticate after logging in. Therefore:

    • Changing the password appears to have fixed part of the problem. I'm guessing the password either had not been set properly during installation (perhaps due to some bug), or it contained characters that for some reason LightDM is unable to handle on its login screen, or it contained characters that mapped to different keys on your keyboard during installation than they did on the LightDM login screen. With your new password, you can log in.
    • However, the problem is not entirely fixed, because you cannot authenticate after logging in. I have preserved the general information I presented as my original answer in the first section below, entitled Password Doesn't Work On Login Screen. That information may be useful to other people who experience similar problems. Please skip down to the section called Can Log In, But Other Authentication Fails.

Password Doesn't Work On Login Screen

A few things to check:

  1. Is Caps Lock on?
    • Similarly, if you're using the numeric keypad to enter some of the characters, is Num Lock on?
  2. Does your password contain unusual characters? (Perhaps you've found a weird bug.) Have you tried different passwords?
  3. Did you set your password with a different keyboard layout from the one you're using to authenticate with it? If so, you may be typing in a totally different password.
  4. Is your password blank (i.e., the zero character long password)? This doesn't work properly; you need to have an actual password.
  5. Maybe something is systematically going wrong during the installation process. If you started with an Ubuntu ISO image, then:

    It's common for a bad ISO or a bad burn/write to prevent installation from succeeding, but it is also possible to get a broken installation.

As for fixing this:

  1. You have a Wubi system*, so GRUB runs after the Windows boot loader. Select Ubuntu on the screen where Windows and Ubuntu are you two choices, then press Shift and hold it down, then press Enter. This way, the Shift key is being pressed as the Windows boot loader chain-loads GRUB.

    • *Edit: Actually, it turns out (from information you've since provided) that you do not have a Wubi system. I'm not sure why holding down Shift doesn't work for you. Since the above advice applies whenever any boot loader besides GRUB chain-loads into the Ubuntu system's GRUB boot loader, it may work (or have worked) for you still. Otherwise, the problem could be that you are not holding down the Shift key early enough in the boot process, or that you are releasing it too soon.
  2. It's possible that this is, somehow, a problem with the graphical login screen. So you might be able to log in successfully from a text-based virtual console. To attempt that, boot the Ubuntu system, then after the graphical login screen comes up (or, even when you're logged in graphically as guest), press Ctrl+Alt+F1. Enter your username and press Enter. Then put in your password and press Enter. (You won't see anything happening as you enter your password but that's normal.)

    If you can log in to a virtual console, try changing your password by running the command passwd. If that doesn't work or you still can't log in graphically, try changing it by running the command sudo passwd $USER.

Can Log In, But Other Authentication Fails

This section assumes that you now are able to log in as the user created during setup, using the graphical login screen. That is to say that you can use your Ubuntu system via graphical user interface, not just as guest, but also as the user created during setup. If I have misunderstood, please let me know.

You're able to log in now, but once you're logged in, you can't authenticate. There are three main types of authentication that are performed after logging in:

  1. Authentication to perform administrative tasks. You are asked for a password when you try to perform actions that cannot be accomplished by an ordinary, unprivileged user, like installing software or changing system files. For this, you use the same password as you use to log in. Such authentication will only succeed if you are an administrator on the system. I am assuming this is the kind of authentication that is currently failing. Please let me know if my assumption is incorrect.

  2. Authentication to unlock the screen. You can manually lock the screen, or you can configure the screen saver to lock it. It may also be locked when resuming from sleep (suspend-to-RAM) or hibernation (suspend-to-disk). For this, you also use the same password as you use to log in.

  3. Authentication to unlock your keyring. The keyring may be used to store passwords (for example, for Internet services) or other sensitive data. Your keyring password is not necessarily the same as the password you use to log in. Unlike your login password, my understanding is that the keyring password can be blank, without causing problems.

The things to check for problems authenticating while logged in (whether to perform administrative tasks, unlock the screen, or unlock the keyring) are largely the same as for being unable to log in: Points 1-4 under Password Doesn't Work On Login Screen apply (except that point 4 doesn't apply to keyring passwords).

But I'm guessing you've already considered that. So, let's focus on problems specific to logging in to perform administrative tasks. These are the things to check. (Please note that this is long because it provides some instructions for fixing the problem, under some circumstances. Actually checking these things, generally speaking, is not particularly difficult or time-consuming.)

Are you actually an administrator?

Open a Terminal window (Ctrl+Alt+T) and run this command:

groups

That lists the groups your user account is a member of. To be an administrator, admin or sudo (or both) must be listed. Please note that adm is a different group from admin and doesn't make you an administrator (though you should also be a member of that group).

If you're not an administrator, you can make yourself one by following any procedure for resetting a lost password (typically you'd use recovery mode for this, but single user mode via editing GRUB boot options, or chrooting from a live CD/DVD/USB, will also work). Except instead of running the passwd username command, run these commands:

usermod -a -G admin username
usermod -a -G sudo username

It's fine if one (but not both) of those commands fails. (If it fails, you get an error message. If it succeeds, there's generally no output.) What that does is to put you into whichever of the admin or sudo groups exist (or both, if they both exist).

Are only some ways of authenticating to perform administrative tasks broken?

Ubuntu actually provides two underlying mechanisms for administrators to authenticate to perform administrative tasks--sudo (which has graphical frontends such as gksu/gksudo and kdesudo), and PolicyKit.

In a Terminal window, run this command, to test PolicyKit:

pkexec echo Success.

You should be prompted for your password (probably by a graphical dialog box, but possibly in the Terminal window). If authentication succeeds and the word Success. is echoed back to you (i.e., printed in the Terminal), then PolicyKit works for performing administrative tasks (though it's possible it's still not working, for specific tasks).

Now run this command:

sudo echo Success.

This tests sudo in the same way (though the authentication will definitely be in the Terminal window--you won't get a graphical dialog box asking for your password).

Now run this command, to see if sudo is working graphically (run this even if sudo didn't work above, in case the problem has to do with the way the Terminal accepts input):

gksu xclock

You'll be prompted for your password. If that succeeds, a simple clock application will run. (You can quit the clock application.) If that fails, run this to see if the problem is that gksu is not configured properly:

gksudo xclock

If this is a Kubuntu system, then you will probably not have the gksu and gksudo utilities, so test with the kdesudo utility instead:

kdesudo xclock

If pkexec works but sudo and also gksu and gksudo (or kdesudo) don't work:

Either sudo's configuration is broken, or sudo itself is broken. The former is more common, and easier to fix--I'll cover that here. (You'd know if sudo itself is broken because you'd get an error about how it refuses to run due to incorrect ownership/permissions, or an error saying command not found.)

Run pkexec visudo to edit /etc/sudoers, sudo's main configuration file. Near the end of the file, you should see something like this:

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL
  • If you're running a version of Ubuntu earlier than 12.04, don't worry about the %sudo line.
  • If you're running Ubuntu 12.04 and later and you did not upgrade from a version of Ubuntu earlier than 12.04, don't worry about the %admin line (it might not even be present at all).

The %admin and/or %sudo lines (see above two bullet points) should be uncommented--that is, should not start with a # character.

After %admin and/or %sudo, there should be a space, followed by ALL=(ALL) ALL or ALL=(ALL:ALL) ALL.

If things are not as described above, you can edit the file to fix them. Since you're using the visudo utility to edit the file, it will catch syntax errors when you try to save the file. You should not attempt to override and save a file that it says has syntax errors. (sudo, and its graphical frontends, will refuse to work if the sudoers file contains even a single syntax error.)

If everything appears to be in order in your sudoers file, try reinstalling sudo. Assuming you haven't customized your sudoers file, reinstall sudo by running this command:

pkexec apt-get update
pkexec apt-get --purge --reinstall install sudo

However, if you have customized your sudoers file (before this--I don't mean the editing described above) and it's important to you that you not lose the customizations, leave off the --purge flag:

pkexex apt-get update
pkexec apt-get --reinstall install sudo

If pkexec, sudo, and gksudo work, but gksu doesn't work:

Run the command gksu-properties (this does not need to be run as root, i.e., don't run it with pkexec, sudo, or gksudo). Make sure Authentication mode is set to sudo and not su.

Source: Password not working in Graphical Applications (gksu)? Works with sudo (Has a screenshot.)

If pkexec and sudo work, but gksu and gksudo (or kdesudo) don't work:

Try reinstalling gksu/gksudo (they're provided by the same package):

pkexec apt-get update
pkexec apt-get --purge --reinstall install gksu

Or if this is Kubuntu and it's kdesudo that's not working:

pkexec apt-get update
pkexec apt-get --purge --reinstall install kdesudo

If pkexec doesn't work, but sudo, gksu, and gksudo do work:

Try reinstalling PolicyKit:

sudo apt-get update
sudo apt-get --purge --reinstall install policykit-1 libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0

If pkexec works, and gksu and gksudo (or kdesudo) work, but sudo doesn't work:

pkexec usually authenticates graphically, like gksu/gksudo (or kdesudo on Kubuntu). So if graphical authentication is working for both PolicyKit and sudo-based methods, and console authentication is failing, there may be a problem with the way passwords are being entered into the Terminal. I've heard of this happening, but I'm not familiar with any concrete cases where it was known to occur and was then fixed. (Except where it was due to the user making a mistake entering the password in the Terminal.)

If this is happening, then to provide further information:

  1. See if sudo works in a virtual console (Ctrl+Alt+F1). This can help figure out if it's the graphical terminal application causing the problem.
  2. See if pkexec works in a virtual console. When run in a virtual console, pkexec will not create a graphical dialog box. This can help figure out if the problem is also specific to sudo-based methods.
  3. See if su $USER works, in both a Terminal window and in a virtual console. This command does not enable you to perform administrative tasks. It just authenticates as yourself. But it asks for a password (non-graphically) while doing so. This can help figure out the extent of the problem entering passwords to authenticate non-graphically.

If:

  • the situation is different from all the combinations listed above, or
  • the situation is one of the combinations listed above, but there's a problem following the instructions, or
  • the situation is one of the combinations listed above and you've followed the instructions without apparent problems, but the underlying problem (of being unable to authenticate) has not gone away...

Then please edit your question to provide details, and also comment here (with or without @Eliah--when you comment on my answer, I'm always notified) to let me know.

share|improve this answer
    
Thanks for replying so quickly. I can sign in using the text based console and I've now managed to change the password from there and from grub shift etc method. Still can't sign in using the gui though? –  Nick Aug 16 '12 at 1:01
    
also just tried with sudo passwd... didn't help –  Nick Aug 16 '12 at 1:06
    
I don't know how all this works... If I type @Eliah I'm hoping it will alert you to my reply. :) –  Nick Aug 16 '12 at 1:13
    
I've updated my question with the answers. Hopefully it's what you requested. Thanks –  Nick Aug 16 '12 at 2:32
    
Most important bit and I must have deleted it before I pressed Add comment lol @Eliah –  Nick Aug 16 '12 at 2:38
show 1 more comment

I can see why this is terrible. First I want to troubleshoot with you. Check the following things:

  1. Is my Caps Lock on?
  2. Is my Num Lock on?
  3. Could any of these things have been on during the installation, when you typed in the password.

If none of this doesn't work, you could try again to boot into Recovery Mode. Here is a good explanation on how to use this method to fix your problem.

Good luck

share|improve this answer
    
Thanks, I just replied to the guy below. I have booted in recovery mode successfully now and I've changed the password. I've even managed to sign in with that password successfully but only in the text based virtual console.. not the gui. Any ideas? –  Nick Aug 16 '12 at 1:07
    
@Nick You could do the command sudo reboot, to restart and see the log in screen. If that does not work, then try startx. Glad to help –  Max Tither Aug 16 '12 at 1:16
    
Could it be a question of keyboard layouts? Try typing the password in a Text editor or some other graphical app and see if it is what it should be. –  To Do Aug 16 '12 at 10:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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