canonical / lightdm

Display Manager
GNU General Public License v3.0
827 stars 138 forks source link

when a user login with lightdm with any greeter and type last, it will show "gone - no logout" #239

Open jgao1025 opened 2 years ago

jgao1025 commented 2 years ago

I tested this on focal 20.4.4 LTS. I used lightdm version 1.30.0-0ubuntu4~20.04.2.

How to reproduce.

  1. install ubuntu 20.04.4 LTS and use lightdm.
  2. login through lighdm
  3. type last

I will see

user tty7    :0    Fri Mar 18 14:14    gone - no logout

Something else

I am still not sure if this needs to be addressed in lightdm or last. In the last program, when it comes to decide if this is a phantom or not, it will check pw->pw_uid (from getpwnam) and /proc/pid/loginuid and if they are not the same, last will say this is a phantom process [1].

I found the pid of lightdm from using ps -ef | grep lightdm or extract pid in /var/log/wtmp, and manually compare it with a test program where I used getpwnam. The value of getpwnam is correct, but the value of /proc/pid/loginuids is a very big number. I guess this is because the owner of lightdm process is root on my machine, and whilst I used gdm3, it is the normal user.

[1] https://github.com/util-linux/util-linux/blob/master/login-utils/last.c#L635