🔍 See Original Answer on Ask Ubuntu 🔗
Ubuntu 16.04 usually suspends before login and while logout
September 27, 2016
Edited: April 13, 2017
November 24, 2022
Copy to clipboard: false
Although you didn’t say your laptop was docked the symptoms you describe can be found in bug reports posted by other users experiencing errors when logging out whilst docked.
There is a bug report on this for
Lenovo ThinkPad T400 suspends upon log-out from GNOME when docked and lid closed when using Fedora 25 https://bugzilla.redhat.com/show_bug.cgi?id=1365719.
There is a problem reported under Ubuntu 15.10 where the system logs out when resuming from suspend: Logged out on resume from sleep ubuntu 15.10. The interesting point is it happens most of the time but not all the time, such as yourself.
This is the closet I’ve found to your problem: Ubuntu 16.04: Logout cause the PC to suspend/sleep which references another user with the same problem: Ubuntu 16.04 sleeps / suspend before login screen.
It would appear your laptop is docked and the lid is closed when you log out which causes the system to suspend. To prevent this enter the
Terminal by pressing Ctrl+Alt+T and then typing:
gksu gedit /etc/systemd/logind.conf
Search for these lines and make them look like this (possibly by removing
# in front or replacing
Save the file and quit
gedit. Reboot your laptop.
Via comments the OP confirms the recommended changes solves the problem. A comment asks “Why isn’t this available in GUI?” The
logind.conf file is part of systemd which Ubuntu has only recently embraced. Conversion from the old programs to the new programs with full GUI support takes time.
There are GUI’s already for Suspending, Hibernating or “Doing nothing” when lid is closed but additional options need to be added for when docked or when plugged into an HDMI monitor.
Suspend was already complicated with Kernel methods (Freeze, Standby and Memory/STR (Save To Ram), ACPI Events, acpid, PM, APM and gnome-settings (sorry for typo’s I’m going off memory) and systemd adds another level of complexity for all the Linux programmers out there tips hat