NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.63k stars 13.78k forks source link

Lightdm does not "remember" user session #10349

Open spinus opened 8 years ago

spinus commented 8 years ago

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.

spinus commented 8 years ago

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.

fps commented 8 years ago

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

romildo commented 8 years ago

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

spinus commented 8 years ago

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 notifications@github.com :

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ż

romildo commented 8 years ago

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

spinus commented 8 years ago

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 notifications@github.com :

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ż

romildo commented 8 years ago

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.

spinus commented 8 years ago

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

2016-03-22 14:56 GMT+00:00 José Romildo Malaquias notifications@github.com :

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ż

romildo commented 8 years ago

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.

spinus commented 8 years ago

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 notifications@github.com :

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ż

romildo commented 8 years ago

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.

cumber commented 7 years ago

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.

pbogdan commented 7 years ago

@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.

vcunat commented 7 years ago

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.

pbogdan commented 7 years ago

@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:

vcunat commented 7 years ago

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.

cumber commented 7 years ago

@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

pbogdan commented 7 years ago

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

vcunat commented 7 years ago

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.

pbogdan commented 7 years ago

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?

vcunat commented 7 years ago

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

pbogdan commented 7 years ago

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

cumber commented 7 years ago

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.

vcunat commented 7 years ago

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

cumber commented 7 years ago

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.

cumber commented 6 years ago

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).

spinus commented 6 years ago

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

cumber commented 6 years ago

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

spinus commented 6 years ago

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?

cumber commented 6 years ago

@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.

vcunat commented 6 years ago

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.

pbogdan commented 6 years ago

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.

cumber commented 6 years ago

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.

cumber commented 6 years ago

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

JohnAZoidberg commented 6 years ago

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)

stale[bot] commented 4 years ago

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.
JohnAZoidberg commented 4 years ago

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.

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

fps commented 3 years ago

Just a note: It seems this bug is fixed on a current 20.03 system. I tried selecting several different windowmanagers in lightdm and it worked as expected (remembered the session choice across logouts.) So I guess this issue can be closed if some other reporters confirm as well.

oberblastmeister commented 3 years ago

I still have to add programs.zsh.enable = true for lightdm to remember my user.