OS: Ubuntu 19.10
I could reproduce the issue in the below case.
if the file /etc/systemd/logind.conf
is untouched and the gsettings values are also untouched
gsettings list-recursively | grep "ac-action \|e-battery-action '"
org.gnome.settings-daemon.plugins.power lid-close-ac-action 'suspend'
org.gnome.settings-daemon.plugins.power lid-close-battery-action 'suspend'
Workaround:
edit the file /etc/systemd/logind.conf
and change the line
#HandleLidSwitch=.....
to HandleLidSwitch=lock
not sure reboot is required or this command systemctl restart systemd-logind.service
. I did reboot and works as intended.
Reference:
http://tipsonubuntu.com/2018/04/28/change-lid-close-action-ubuntu-18-04-lts/
http://manpages.ubuntu.com/manpages/eoan/man5/logind.conf.5.html
some of the content from above link
HandlePowerKey=, HandleSuspendKey=, HandleHibernateKey=, HandleLidSwitch=,
HandleLidSwitchExternalPower=, HandleLidSwitchDocked=
Controls how logind shall handle the system power and sleep keys and the lid switch to
trigger actions such as system power-off or suspend. Can be one of "ignore",
"poweroff", "reboot", "halt", "kexec", "suspend", "hibernate", "hybrid-sleep",
"suspend-then-hibernate", and "lock".