Fix Can't Login After Logout With Gnome / GDM3 On Ubuntu
I've had an issue for some time: after logging out, I was unable to login to the default Ubuntu (Gnome) session. After some digging, I managed to find a fix for this issue, so here's a solution in case you too are experiencing this "can't login again after logout" problem.
The "can't login after logout" issue seems to happen on Gnome desktop environments using GDM 3 on Xorg, with computers using Nvidia graphics using proprietary drivers, though I'm not 100% sure about this last part. Also, the issue happens most of the time, but not always.
And it's not just Ubuntu, as I have seen reports with the same issue for Fedora too (it's marked as fixed, though there are still users looking for a solution), but oddly it seems to happen with Wayland, and not Xorg, which is what my computer uses when running into this. That might be a different issue though, that's why I only mentioned Ubuntu in the title, but you can try this on any Linux distribution.
It also worth noting that this happens with both a single user (having only one user on the system), and on systems with multiple users, regardless if you try to login using the same user, or switch to a different user.
I've experienced this bug with Ubuntu 18.04, 18.10 19.04, so it's not new, but it seems to have escaped the developers. The bug might be even older, but I didn't use Gnome prior to Ubuntu 18.04.
Display Manager related: How To Change The Default Display Manager (Switch To GDM, LightDM, SDDM, Or LXDM) In Debian, Ubuntu Or Linux Mint
It looks like you can't login again after a logout on Gnome (with Xorg in my case) because the session is not properly closed / something hangs. The solution is to make sure no processes for the logged out user remain running, by executing
To apply this solution to fix the "can't login after logout" issue, the command I mentioned needs to run after you select to logout from the Gnome System menu. You can run a command after a session has completed by adding it to the
So let's edit this file with Nano command line text editor:
Above the
Now save the file and exit Nano (to save the file using Nano command line text editor press
The issue with new logins not working after a logout should now be fixed, and you can give it a try by logging out and logging back in (there's no need for a reboot). I tested this to make sure it works quite a few times (and it worked every time), but only on Ubuntu 19.04 since I only have a computer to try it on, and it doesn't seem to happen in a virtual machine.
In case you're aware of a different, better solution, please let me know in the comments section.
The "can't login after logout" issue seems to happen on Gnome desktop environments using GDM 3 on Xorg, with computers using Nvidia graphics using proprietary drivers, though I'm not 100% sure about this last part. Also, the issue happens most of the time, but not always.
And it's not just Ubuntu, as I have seen reports with the same issue for Fedora too (it's marked as fixed, though there are still users looking for a solution), but oddly it seems to happen with Wayland, and not Xorg, which is what my computer uses when running into this. That might be a different issue though, that's why I only mentioned Ubuntu in the title, but you can try this on any Linux distribution.
It also worth noting that this happens with both a single user (having only one user on the system), and on systems with multiple users, regardless if you try to login using the same user, or switch to a different user.
I've experienced this bug with Ubuntu 18.04, 18.10 19.04, so it's not new, but it seems to have escaped the developers. The bug might be even older, but I didn't use Gnome prior to Ubuntu 18.04.
Display Manager related: How To Change The Default Display Manager (Switch To GDM, LightDM, SDDM, Or LXDM) In Debian, Ubuntu Or Linux Mint
It looks like you can't login again after a logout on Gnome (with Xorg in my case) because the session is not properly closed / something hangs. The solution is to make sure no processes for the logged out user remain running, by executing
killall -9 -u $USER
after logging out, for the user that just logged out.To apply this solution to fix the "can't login after logout" issue, the command I mentioned needs to run after you select to logout from the Gnome System menu. You can run a command after a session has completed by adding it to the
/etc/gdm3/PostSession/Default
file - from the GDM3 man page: "When the session has completed, gdm attempts to run /etc/gdm3/PostSession/display
, or /etc/gdm3/PostSession/Default
". If you're trying to use this on a Linux distribution other than Ubuntu or Debian, note that the path to the GDM3 PostSession/Default file might be different! So let's edit this file with Nano command line text editor:
sudo nano /etc/gdm3/PostSession/Default
Above the
exit 0
(last) line, add this command:killall -9 -u $USER
Now save the file and exit Nano (to save the file using Nano command line text editor press
Ctrl + o
, then Enter
; after saving, exit using Ctrl + x
).The issue with new logins not working after a logout should now be fixed, and you can give it a try by logging out and logging back in (there's no need for a reboot). I tested this to make sure it works quite a few times (and it worked every time), but only on Ubuntu 19.04 since I only have a computer to try it on, and it doesn't seem to happen in a virtual machine.
In case you're aware of a different, better solution, please let me know in the comments section.