WhyDidPasswordChange

When your password only sometimes doesn't work, or it works in GUI but not when using a text-based terminal (one you access by entering <Ctrl+Alt+Fn>), most likely you have entered your password in an alternative language setting.

  • Before we continue any further, let's make sure, your <Caps Lock> and <Num Lock> keys are not activated incorrectly. This may be your only problem. Sometimes rebooting your system also helps, though I hesitate to recommend this option. I'd reserve this step as absolutely the last step, and only if all other steps fail.

  • If your root password has mysteriously changed, and you are no longer able to enter it correctly, and are sure both GUI and non-GUI environments currently have identical language / keyboard settings, there still are chances, that your password has changed it in a different keyboard environment, and what we are discussing here may still be applicable to your situation, providing you know how to switch between the two environments, and also change them, so you will eventually be able to use the password again. I encourage you to continue reading.

There are two distinctly different scenarios, which may have something to do with your password problem. One is where your password is correct, but your language and/or keyboard environment got changed, and the other is where you have the right environment, but your password was entered/modified in a different environment. There of course are other possibilities, which may be far more serious than the ones mentioned above, but are either result of a broken software or a sign of some kind of tampering with your system. These last two possibilities are less common, and we should always start without assuming the worst.

What is a language and/or a keyboard environment and, how can it change?

Often text-based environment and GUI environments, may operate in different language (locale) environments. If they are installed at the same time they should be identical. However, if you installed your GUI separately, or even if you've made a major update of either your OS or GUI, and you are now experiencing problems with your passwords, likelihood that you created conflicting language/keyboard (locale) environments is not insignificant. This can usually be corrected, and this is what I'll eventually try to help you with, after we learn about relevant issues, and possible things that may have gone wrong or perhaps are just as they should be, and will in the future merely require you to be a bit more aware of them.

Before we continue, let's first be clear you are confident you know how to switch between the two environments. First of all the two environments are:

  • GUI (graphic environment known as GNOME, KDE, ...)

  • text-based terminal (one you access by entering <Ctrl+Alt+Fn>)

In GUI environment the equivalent of "text-based terminal" environment is your terminal, which you can get into (depending on which window manager you run KDE, GNOME, ...) by searching your GUI menus. For instance in:

  • KDE: find your Konsole (Terminal Program), or Root Terminal (GKsu)

  • GNOME: select System->Terminals->GNOME Terminal

On the other hand you can get into the non-GUI, i.e. text-based environment by pressing the keys <Ctrl+Alt+Fn> simultaneously and log in, of course replacing the <Fn> with one of the <F1> through <F12>, depending how many function keys are configured on your system for this purpose.

Once you know how to switch between the GUI and non-GUI environments, as well as work with the command-line tool like the terminal, it is time to figure out which of the two scenarios prevent you from entering your password correctly. Namely, is the password what you think it is, or is your keyboard or language setting for some reason different from what it should be.

In order to do that we will test how your keyboard writes the password in either environment. To avoid permission problems, you have to follow the steps verbatim, and in the same order as they are laid out here. As you know our problem is that we can enter the root password correctly in one but get the "incorrect password" in the other environment. This determines in which environment we have to start our investigation, namely, in the one in which we can log in as root, so we will have no trouble granting access to our "test files" to all.

Following are the steps you should take

  1. in the environment where you can log-in as root, open a terminal

  2. Enter the command; (NOTE: a single greater sign ">" here)

    echo "key-in-your-password" > /tmp/my-saved-passw

    Replace the text key-in-your-password with your root password.

  3. Grant access to the file "/tmp/my-saved-passw" to all other users, by entering the following command:

    chmod 666 /tmp/my-saved-passw
  4. In the environment in which you can not log in as root repeat slightly modified command from the step #2 above (NOTE: the double greater sign ">>" this time

    echo "key-in-your-password" >> /tmp/my-saved-passw

    Again, replace the text key-in-your-password with your root password.

  5. In either environment, better a graphic one, where you can cut-n-paste, enter the following command as a regular user:
    cat /tmp/my-saved-passw
    You should see the your password twice in a row, on two separate lines.

If they are slightly different, our assumption that the two environments are configured to use different keyboards was correct. Just to be absolutely certain, that our diagnosis is correct we should do yet another test, which will show us the subtle differences, we may have missed in our previous test, and will also allow us to determine exactly which keys may behave differently. On the other hand if our keyboard / language setting is not different a problem this time this second test will confirm this beyond any shadow of a doubt. Hence, do now the following:

  1. In GUI terminal enter
    dumpkeys > /tmp/g-kcodes

    b. In text (<Ctrl+Alt+Fn>) terminal enter

    dumpkeys > /tmp/t-kcodes

    c. In either environment (better a graphic), carefully enter the following exactly as shown (do not use single quotes {'}, and more importantly do not miss them!):

    diff /tmp/*-kcodes && echo "differences found (Error=$?)" || echo "no differences (Error=$?)"
    1. (c.1) Obviously, the message "differences found (Error=1)" confirms our diagnosis, that we have two differently set keyboard / (language) environments. NOTE: the Error=1 is set to number one (1).

    2. (c.2) If however we get the other message "no differences (Error=0)" (NOTE: the Error=0 should in this case be set to number zero (0)), the two environments are identical, and our keyboard output is not the problem. This may be a reason for a greater concern, and you should immediately seek help, perhaps with your system administrator or a knowledgeable friend.

A Quick Fix - (changing your root password)

Continue with this part if (c.1) confirmed the difference, or if you are one of those who can no longer use the root password, but are sure that they and nobody else changed it. These two cases are the two possibilities, to which I referred at the beginning, as two distinct scenarios. Namely:

  • when in one place your password works and in other it doesn't, and
  • when you no longer can enter your password correctly is one.

The first case is obvious and we confirmed it in step (c) above. However, also the second case above, and if we believe, that nobody and nothing could have changed the password, which now for some reason you can not enter, may be the result of a mix-up with keyboard setups, only in in this second instance the password was entered (created) with a different keyboard and/or its setup was at that time also different. Of course in this last situation, you'll need to resort to some guesswork, and figure out whether the culprit was a different keyboard as a piece of hardware, or whether it should have been a different configuration. In both cases you should try to use the keys, that were supposedly used to create the password. This my friend, is your only chance to recovery, unless of course you save a "rat" on your system.

But for the first case above you fave to first find out which are the keys that are not different in both environments, you use. For instance avoid German characters on "English" speaking keyboard. Once you determined which keys are valid in both worlds you should make up a new password only of those characters / keys.

Follow the following steps to change your password to be "multi-lingual":

  • Log in as root
  • Enter the command:
    passwd
    Follow the prompts. Of course the new password should consist only of characters available in both (or all) your language / keyboard environments.

NOTE: this does not solve your keyboard configuration problem, if there is one.

Fixing or misconfiguring your keyboard settings

If you set up your computer for a multilingual use, you can change your keyboard layout (nationality) on a fly by a single click on your Desktop panel. The keyboard setting effects all applications currently opened on the desktop. I have noticed that this "keyboard type" selector setting may easily be misconfigured. I found it beneficial to use the "Keyboard Indicator" not only to toggle between different keyboards, but also to check that keyboard setting is not misconfigured. Namely, when two or more languages are set up, and you can not toggle between them, you can fairly conclude that keyboard setting is indeed misconfigured.

When this is the case, to correct the problem you should set the default settings in your "Keyboard Preferences" window, which will remove all but system default keyboard from the "Keyboard Preferences". After that add those that were removed without checking any check-boxes beside them, or even worse, moving them to different positions by clicking either Up or Down buttons. These actions may very well be using a buggy procedure, because they prevent the toggle functionality, rather than merely change which keyboard should always be used as the default.

WhyDidPasswordChange (last edited 2008-08-06 16:31:31 by localhost)