Make Linux lock on lid close

less than 1 minute read

Some modern hardware (such as Microsoft Surface Book or Surface Pro) with “Connected Standby” or “Modern Standby” is not well supported in Suspend/Sleep with Linux yet.

There are two categories of workaround behavior on lid close:

  1. hibernate
  2. lock

Why lock instead of hibernate on lid close?

I didn’t want to have the laptop constantly hibernating and resuming because this takes too long and causes excessive SSD wear. For better security, I shut my laptop down while in transit. If I’m just going between offices/lab on campus, locking screen with screen turned off gives me sufficient power savings for short walks.

Force Linux lock on lid close

This assumes a systemd-based system such as Ubuntu ≥ 15.04, including Ubuntu 17.10.

  1. modify /etc/systemd/login.conf, with uncommented line
  2. reboot laptop and verify lock behavior on lid close.

This does not work on some laptops, or may work once and then not work again until reboot. This is unfortunate, but on Ubuntu one can get in the habit of hitting Win L and/or setting a short inactivity screen lock timer.


Leave a Comment