Ubuntu 16.04 usually suspends before login and while logout

Since I went to 16.04 my laptop likes to suspend when the boot procedure ends and when I logout from my user account. It's a ~4 years old Asus K53SD machine and I thought it's a special case but now I got another laptop which is a Dell Vostro 3558 and did a fresh install. This Dell behaves the same. Both machine based on Intel Core i3 and both have discrete NVIDIA cards but these are the only common things I guess. Both up to date. Another side effect is that the WLAN driver stucks(?) and cannot see wifi signals.


Solution 1:

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 suspend with ignore):

HandleLidSwitch=ignore
HandleLidSwitchDocked=ignore

Save the file and quit gedit. Reboot your laptop.

Edit 1

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