Nixpkgs: Lightdm does not "remember" user session

Created on 12 Oct 2015  Â·  37Comments  Â·  Source: NixOS/nixpkgs

When you login with lightdm, usually (on other distros) lightdm saves your choice and when you type username next time, session will be switched to your previous choice and after entering the password it will login to that session.

In nixos (tested on 16.03) lightdm ignores all previous choices and login always to first session.

Most helpful comment

FWIW I accidentally triggered the issue of username not being saved, in my specific case it was because of the user's shell not being listed in /etc/shells I had:

  users.extraUsers.pbogdan = {
     ...
     shell = pkgs.zsh;
  };

without programs.zsh.enable = true; set (which adds zsh to /etc/shells), and the accounts service daemon (that lightdm appears to use to query users) would no longer consider my user "human".
Forcefully disabling the accounts service also seems to work for this case as it makes lightdm fall back to querying /etc/passwd with slightly different logic that doesn't include validating the shell to the extent that accounts service does.

All 37 comments

I actually have two installations (fresh, installed few days ago, two different machines). On one machine it saves the choice and doesn't on the other, I'll try to look more into it, if someone could confirm that or deny, would be nice.

Confirmed for me on channel nixos-15.09 here. Installed just a few days ago here, too..

On my unstable NixOS system lightdm is always pre-selecting the first entry in the sessions menu, and never remembers my last choice,

Just a blind guess.
What's your setup for:

users.mutableUsers = true; - this is mine (at least on the machine which
preserve selected session)

2016-03-22 11:58 GMT+00:00 José Romildo Malaquias [email protected]
:

On my unstable NixOS system lightdm is always pre-selecting the first
entry in the sessions menu, and never remembers my last choice,

—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/NixOS/nixpkgs/issues/10349#issuecomment-199778334

Tomasz Czyż

On my configuration users.mutableUsers is not explicitly set, but according to the documentation, true is the default value.

Do you use any "proper" xsession manager? I'm using xfce session with
awesome window manager and the choice is preserved.
I can try later to test other options and report what's happening without
session manager (xterm, awesome).

Reference:
http://askubuntu.com/questions/65753/login-screen-doesnt-remember-my-choice-of-desktop-enviroment

2016-03-22 13:13 GMT+00:00 José Romildo Malaquias [email protected]
:

On my configuration users.mutableUsers is not explicitly set, but
according to the documentation, true is the default value.

—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/NixOS/nixpkgs/issues/10349#issuecomment-199806602

Tomasz Czyż

Currently I am using mainly xfce, and lightdm is not remembering latest session between reboots. But I think it should work without a session manager, as it does on other linux distributions. For instance in Gentoo Linux sometimes I use fluxbox or openbox or awesome, among others, without a session manager and lightdm remembers the latest session between reboots.

Maybe directory where lightdm user preferences are saved has wrong
permissions?

2016-03-22 14:56 GMT+00:00 José Romildo Malaquias [email protected]
:

Currently I am using mainly xfce, and lightdm is not remembering latest
session between reboots. But I think it should work without a session
manager, as it does on other linux distributions. For instance in Gentoo
Linux sometimes I use fluxbox or openbox or awesome, among others,
without a session manager and lightdm remembers the latest session
between reboots.

—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/NixOS/nixpkgs/issues/10349#issuecomment-199852336

Tomasz Czyż

Where would lightdm save user preferences? There is no file or directory with lightdm in its name on $HOME:

$ find $HOME -iname "*lightdm*" -or -iname ".*lightdm*"

No file is found.

On Gentoo Linux also there is no such file.

That's how it looks like on my box:

cd /var/lib/lightdm-data/ && ls -al

total 23
drwx------ 5 lightdm lightdm 6 Mar 22 15:24 .
drwxr-xr-x 18 root root 18 Dec 15 17:53 ..
drwxr-xr-x 4 lightdm lightdm 4 Mar 16 12:27 .cache
drwxrwx--- 2 lightdm lightdm 2 Mar 16 12:27 lightdm
drwxrwx--- 2 spinus lightdm 2 Oct 29 09:23 spinus
-rw------- 1 lightdm lightdm 52 Mar 16 12:27 .Xauthority

2016-03-22 15:07 GMT+00:00 José Romildo Malaquias [email protected]
:

Where would lightdm save user preferences? There is no file or directory
with lightdm in its name on $HOME:

$ find $HOME -iname "_lightdm_" -or -iname "._lightdm_"

No file is found.

—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/NixOS/nixpkgs/issues/10349#issuecomment-199857381

Tomasz Czyż

On my system there is:

# ls -Al /var/lib/lightdm-data/
total 24
drwxr-xr-x 4 lightdm lightdm 4096 Mar 22 11:46 .cache
drwx------ 2 lightdm lightdm 4096 Mar 22 11:46 .emacs.d
drwxrwx--- 2 lightdm lightdm 4096 Mar 22 11:46 lightdm
drwxrwx--- 2 mike    lightdm 4096 Mar  9 18:16 mike
drwxrwx--- 2 romildo lightdm 4096 Apr 10  2015 romildo
-rw------- 1 lightdm lightdm   58 Mar 22 11:46 .Xauthority

Permissions seems to be the same as in your system.

I had this problem on 16.03. It seemed to be working 16.09, but after I switched to nixos-unstable it's happening again.

@cumber is still an issue for you? If so what do permissions and content look like on /var/lib/lightdm-data/.cache/lightdm-gtk-greeter/state as it seems that's where the session settings are stored.

I think there are some new problems there due to removal of patches. I'm getting failures to execute /bin/rm which might be related to lightdm clearing the state data.

@vcunat I couldn't quite figure out the state management - at a cursory glance lightdm process wants to clear out what it considers "stale" paths under /var/lib/lightdm-data/, including that .cache folder where the greeter wants to store its settings.. which sounds at odds with each other.
Wonder if perhaps that removal of patches actually fixes the issue here :smile:

I'm not sure if it's related, but since recently I have to write out my username instead of it being pre-selected in a combobox.

@pbogdan No, it hasn't been bothering me for a while, but I redid how my session was configured a while ago, so I might only have the one option now... I'll see if I can verify

@vcunat hmm not sure - anything of interest in /var/log/seat?-greeter.log? what's your config look like?

I don't think I did any config at all. I just use one user from lightdm and one session; exceptions to that are very rare.

Could you check the contents of /var/lib/lightdm-data/.cache/lightdm-gtk-greeter/state when you are at lightdm's login prompt and see if your username is under the last-user key? If not what value do you get under that key?

Yes, it is there. Still, the UI only shows a plain input field for the username, without any hint of offering choice. (unstable+ NixOS)

And that's without any graphical sessions active - just lightdm sitting at the login prompt and inspecting the file via tty??

Yeah, it's working fine for me (shows my name in the drop down box, and remembers which session I last used), on both my nixos-17.03 machine and my nixos-unstable ones.

I used to use services.xserver.windowManager.xmonad to have xmonad as my window manager when this was a problem, relying on the builtin session configuration, but I've switched to installing my specific xmonad configuration to the store, and using:

  displayManager.session = [
    {
      manage = "window";
      name = "xmonad-custom";
      start = ''
        xmonad-custom &
        waitPID=$!
      '';
    }
  ];

I don't recall if making that switch was at the same time that it started working again.

@pbogdan: it has the GTK GUI, but it makes me just write the user name anyway. (No other graphical stuff is running.)

And this issue is back to affecting me too, now. It does give me a choice box, it's just sitting on "Other" (and there are no more options when I click on it), displaying a typeable username field underneath.

I just upgraded a machine from 17.03 to 17.09. That machine was remembering the session/user fine on 17.03, but now it always requires me to type my user name in.

(My earlier comment was about my nixos-unstable machines; I presume whatever changed happened sometime earlier and has just made it into the stable release).

I think we probably can close this if was solved in latest stable and older versions are not supported anymore.

@spinus It's the other way around, sadly. It worked correctly on 17.03, and has regressed sometime before 17.09.

The original bug I opened was about session choice, not necessarily about user selection. Actually I think in lightdm I always had to type the name (but I think this is because theme and has nothing to do with selection saving).

@cumber is the session selection preserved after you type the username?

@spinus Hmm, I had assumed it was the same mechanism for remembering both session and user that was failing.

I have only a single session configured now, so I can't tell. I could set up another as a test. Back when I had this issue previously (16.03?) it was definitely affecting both user and session.

I confirm that. On one machine lightdm (still) requires me to always type the user name. That started probably somewhere between 17.03 and 17.09.

FWIW I accidentally triggered the issue of username not being saved, in my specific case it was because of the user's shell not being listed in /etc/shells I had:

  users.extraUsers.pbogdan = {
     ...
     shell = pkgs.zsh;
  };

without programs.zsh.enable = true; set (which adds zsh to /etc/shells), and the accounts service daemon (that lightdm appears to use to query users) would no longer consider my user "human".
Forcefully disabling the accounts service also seems to work for this case as it makes lightdm fall back to querying /etc/passwd with slightly different logic that doesn't include validating the shell to the extent that accounts service does.

Ah, that's probably what's going on with me too, thanks @pbogdan! I have a custom build of zsh in my user level nix configuration, and my nixos configuration lists /home/cumber/.nix-profile/bin/zsh as my shell.

I can confirm adding environment.shells = [ "/home/cumber/.nix-profile/bin/zsh" ]; to my nixos configuration fixes the problem.

The problem is solved for me as well when adding programs.fish.enable = true; in addition to setting the shell of the user for exactly the reason @pbogdan explained. Thanks!
(NixOS 17.09)

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

We could/should add all of the shells that are set for users to environment.shells. Then people wouldn't have to remember to add it there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

spacekitteh picture spacekitteh  Â·  3Comments

ob7 picture ob7  Â·  3Comments

tomberek picture tomberek  Â·  3Comments

ayyess picture ayyess  Â·  3Comments

copumpkin picture copumpkin  Â·  3Comments