How to lock screen on suspend?

@moocan thanks for this. I tried it and after a restart it seems to work well. :joy:

I didn’t expect someone to answer this thread after two months.

I have the same problem this should be fixed :smile:
So i installed it, i will be reporting back.

@moocan thanks for this

I tried adding the systemd file as described. Now the screen locks when the screensaver fires off! However it still doesn’t lock when I manually suspend the laptop. It just comes back to life with no lock on, even when the delay for the screensaver has been exceeded.

I wouldn’t mind so much if I could lock the screen with CTRL-ALT-L and then suspend from there, but there’s no option to suspend from the lock screen. So, still broken for me I’m afraid.

1 Like

I’m not sure if this is related, but I was checking the settings in the Power Manager, and I tried setting the Action on pressing the Power Button to Suspend. But pressing the power button doesn’t do anything whatever its set to; it just cuts the power after a 3 second delay.

Seems to work properly, although i had one occasion where it did not work.
But that event was a bit sketchy.

@moocan Thanks :smile:

Hello,

I’m sorry because I did not provide an explanation.

This little loginctl--lock-sessions.service systemd unit is only invoked when computer reached the systemd sleep.target which is called when computer goes to sleep, suspend, hibernate, and hybrid-sleep using systemd.

loginctl--lock-sessions.service is never invoked by the screensaver.
You can rename the loginctl--lock-sessions.service by using the name you want.

loginctl--lock-sessions.service rely only on systemd mechanism and just launch logger and loginctl lock-sessions. Unit is invoked by the sleep.target which is called by systemd-hibernate.service, systemd-suspend.service, systemd-hybrid-sleep.service … without additional package … only the base system.

As example: systemd-hibernate.service

This file is part of systemd.

systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

[Unit]
Description=Hibernate
Documentation=man:systemd-suspend.service(8)
DefaultDependencies=no
Requires=sleep.target
After=sleep.target

[Service]
Type=oneshot
ExecStart=/lib/systemd/systemd-sleep hibernate

This unit do the following actions:
First one :

ExecStartPre=/usr/bin/logger --tag “loginctl” --priority auth.info “Session: Locking all user sessions”

This will cause logger to write to the journal log an event:

juil. 05 04:46:46 … loginctl[20960]: Session: Locking all user sessions

Second one:

ExecStart=/bin/loginctl lock-sessions

loginctl --help

lock-sessions Screen lock all current sessions

So after restoring your computer from suspend or hibernate you can search in journal log if loginctl--lock-sessions.service has been launched by the sleep.target and if the sleep.target has been invoked … using journalctl

Using the logger tag:

$ journalctl -t loginctl

Using the systemd unit name:

$ journalctl -u loginctl–lock-sessions.service

This is only a little workaround to force screen to be locked on sleep.
You can replace loginctl lock-sessions with whatever you want coming from additional screen locking tools.

Regarding the mate screensaver (inactivity screensaver), i don’t know what to say … because I have troubles with it … sometimes screen is well locked and sometimes not :frowning: … so now WIN+L is a reflex !

Kr,

2 Likes

Hello,

Try to make a test using systemctl

$ sudo systemctl hibernate
$ sudo systemctl suspend

After restoring try to investigate using journalctl

journalctl --since YYYY-MM-DD HH:MM:SS

When you manually suspend your laptop, try to investigate too using journalctl to see if same steps are encountered.

Kr,

Good plan. OK I did a suspend via systemctl. The result was exactly the same as manually activating a suspend through the menu items. Here is the log. I added the ----- suspend ----- and -----resume----- lines myself for clarity.

user1@machine1:~$ date
Wed Aug  8 14:25:18 +08 2018

user1@machine1:~$ sudo systemctl suspend

user1@machine1:~$ journalctl --since 14:25

------  suspending ------------
Aug 08 14:25:39 machine1 sudo[20433]:    user1 : TTY=pts/0 ; PWD=/home/user1 ; USER=root ; COMMAND=/bin/systemctl suspend
Aug 08 14:25:39 machine1 sudo[20433]: pam_unix(sudo:session): session opened for user root by (uid=0)
Aug 08 14:25:39 machine1 NetworkManager[904]: <info>  [1533709539.3862] manager: sleep: sleep requested (sleeping: no  enabled: yes)
Aug 08 14:25:39 machine1 NetworkManager[904]: <info>  [1533709539.3866] manager: NetworkManager state is now ASLEEP
Aug 08 14:25:39 machine1 sudo[20433]: pam_unix(sudo:session): session closed for user root
Aug 08 14:25:39 machine1 NetworkManager[904]: <info>  [1533709539.3875] device (wlp2s0): state change: activated -> deactivating (reason 'sleeping', sys-iface-state: 'man
Aug 08 14:25:39 machine1 whoopsie[1348]: [14:25:39] offline
Aug 08 14:25:39 machine1 dbus-daemon[891]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Aug 08 14:25:39 machine1 NetworkManager[904]: <info>  [1533709539.3985] device (wlp2s0): state change: deactivating -> disconnected (reason 'sleeping', sys-iface-state: '
Aug 08 14:25:39 machine1 avahi-daemon[885]: Withdrawing address record for fd89:9bdb:a20f::ba9 on wlp2s0.
Aug 08 14:25:39 machine1 systemd[1]: Starting Network Manager Script Dispatcher Service...
Aug 08 14:25:39 machine1 avahi-daemon[885]: Withdrawing address record for fd89:9bdb:a20f:0:e86b:e657:7531:55c3 on wlp2s0.
Aug 08 14:25:39 machine1 avahi-daemon[885]: Withdrawing address record for fd89:9bdb:a20f:0:156c:455d:51f9:6d4 on wlp2s0.
Aug 08 14:25:39 machine1 avahi-daemon[885]: Leaving mDNS multicast group on interface wlp2s0.IPv6 with address fd89:9bdb:a20f:0:156c:455d:51f9:6d4.
Aug 08 14:25:39 machine1 avahi-daemon[885]: Joining mDNS multicast group on interface wlp2s0.IPv6 with address fe80::68f:2bd5:ff6a:fe34.
Aug 08 14:25:39 machine1 avahi-daemon[885]: Registering new address record for fe80::68f:2bd5:ff6a:fe34 on wlp2s0.*.
Aug 08 14:25:39 machine1 avahi-daemon[885]: Withdrawing address record for fe80::68f:2bd5:ff6a:fe34 on wlp2s0.
Aug 08 14:25:39 machine1 avahi-daemon[885]: Leaving mDNS multicast group on interface wlp2s0.IPv6 with address fe80::68f:2bd5:ff6a:fe34.
Aug 08 14:25:39 machine1 avahi-daemon[885]: Interface wlp2s0.IPv6 no longer relevant for mDNS.
Aug 08 14:25:39 machine1 dbus-daemon[891]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Aug 08 14:25:39 machine1 systemd[1]: Started Network Manager Script Dispatcher Service.
Aug 08 14:25:39 machine1 nm-dispatcher[20435]: req:1 'connectivity-change': new request (1 scripts)
Aug 08 14:25:39 machine1 nm-dispatcher[20435]: req:1 'connectivity-change': start running ordered scripts...
Aug 08 14:25:39 machine1 NetworkManager[904]: <info>  [1533709539.4395] dhcp4 (wlp2s0): canceled DHCP transaction, DHCP client pid 19989
Aug 08 14:25:39 machine1 NetworkManager[904]: <info>  [1533709539.4395] dhcp4 (wlp2s0): state changed bound -> done
Aug 08 14:25:39 machine1 NetworkManager[904]: <info>  [1533709539.4411] dhcp6 (wlp2s0): canceled DHCP transaction, DHCP client pid 19997
Aug 08 14:25:39 machine1 NetworkManager[904]: <info>  [1533709539.4412] dhcp6 (wlp2s0): state changed bound -> done
Aug 08 14:25:39 machine1 kernel: wlp2s0: deauthenticating from 54:36:9b:4b:50:46 by local choice (Reason: 3=DEAUTH_LEAVING)
Aug 08 14:25:39 machine1 wpa_supplicant[905]: wlp2s0: CTRL-EVENT-DISCONNECTED bssid=54:36:9b:4b:50:46 reason=3 locally_generated=1
Aug 08 14:25:39 machine1 avahi-daemon[885]: Withdrawing address record for 10.50.50.104 on wlp2s0.
Aug 08 14:25:39 machine1 avahi-daemon[885]: Leaving mDNS multicast group on interface wlp2s0.IPv4 with address 10.50.50.104.
Aug 08 14:25:39 machine1 avahi-daemon[885]: Interface wlp2s0.IPv4 no longer relevant for mDNS.
Aug 08 14:25:39 machine1 wpa_supplicant[905]: wlp2s0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Aug 08 14:25:39 machine1 whoopsie[1348]: [14:25:39] Cannot reach: https://daisy.ubuntu.com
Aug 08 14:25:39 machine1 nm-dispatcher[20435]: req:2 'down' [wlp2s0]: new request (1 scripts)
Aug 08 14:25:39 machine1 NetworkManager[904]: <warn>  [1533709539.4591] sup-iface[0x561283037da0,wlp2s0]: connection disconnected (reason -3)
Aug 08 14:25:39 machine1 nm-dispatcher[20435]: req:2 'down' [wlp2s0]: start running ordered scripts...
Aug 08 14:25:39 machine1 NetworkManager[904]: <info>  [1533709539.4595] device (wlp2s0): supplicant interface state: completed -> disconnected
Aug 08 14:25:39 machine1 NetworkManager[904]: <info>  [1533709539.4607] device (wlp2s0): state change: disconnected -> unmanaged (reason 'sleeping', sys-iface-state: 'man
Aug 08 14:25:39 machine1 systemd[1]: Starting loginctl lock-sessions on sleep...
Aug 08 14:25:39 machine1 loginctl[20452]: Session: Locking all user sessions
Aug 08 14:25:39 machine1 wpa_supplicant[905]: nl80211: deinit ifname=wlp2s0 disabled_11b_rates=0
Aug 08 14:25:39 machine1 systemd[1]: Started loginctl lock-sessions on sleep.
Aug 08 14:25:39 machine1 systemd[1]: Reached target Sleep.
Aug 08 14:25:39 machine1 systemd[1]: Starting Suspend...
Aug 08 14:25:39 machine1 systemd[1]: Starting Restart Syncthing after resume...
Aug 08 14:25:39 machine1 systemd-sleep[20458]: Suspending system...
Aug 08 14:25:39 machine1 kernel: PM: suspend entry (deep)


------- resuming ---------
Aug 08 14:31:19 machine1 kernel: PM: Syncing filesystems ... done.
Aug 08 14:31:19 machine1 kernel: Freezing user space processes ... (elapsed 0.002 seconds) done.
Aug 08 14:31:19 machine1 kernel: OOM killer disabled.
Aug 08 14:31:19 machine1 kernel: Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
Aug 08 14:31:19 machine1 kernel: Suspending console(s) (use no_console_suspend to debug)
Aug 08 14:31:19 machine1 kernel: sd 0:0:0:0: [sda] Synchronizing SCSI cache
Aug 08 14:31:19 machine1 kernel: sd 0:0:0:0: [sda] Stopping disk
Aug 08 14:31:19 machine1 kernel: ACPI: EC: interrupt blocked
Aug 08 14:31:19 machine1 kernel: ACPI: Preparing to enter system sleep state S3
Aug 08 14:31:19 machine1 kernel: ACPI: EC: event blocked
Aug 08 14:31:19 machine1 kernel: ACPI: EC: EC stopped
Aug 08 14:31:19 machine1 kernel: PM: Saving platform NVS memory
Aug 08 14:31:19 machine1 kernel: Disabling non-boot CPUs ...
Aug 08 14:31:19 machine1 kernel: smpboot: CPU 1 is now offline
Aug 08 14:31:19 machine1 kernel: IRQ 118: no longer affine to CPU2
Aug 08 14:31:19 machine1 kernel: smpboot: CPU 2 is now offline
Aug 08 14:31:19 machine1 kernel: IRQ 121: no longer affine to CPU3
Aug 08 14:31:19 machine1 kernel: smpboot: CPU 3 is now offline
Aug 08 14:31:19 machine1 kernel: ACPI: Low-level resume complete
Aug 08 14:31:19 machine1 kernel: ACPI: EC: EC started
Aug 08 14:31:19 machine1 kernel: PM: Restoring platform NVS memory
Aug 08 14:31:19 machine1 kernel: Enabling non-boot CPUs ...
Aug 08 14:31:19 machine1 kernel: x86: Booting SMP configuration:
Aug 08 14:31:19 machine1 kernel: smpboot: Booting Node 0 Processor 1 APIC 0x2
Aug 08 14:31:19 machine1 kernel:  cache: parent cpu1 should not be sleeping
Aug 08 14:31:19 machine1 kernel: CPU1 is up
Aug 08 14:31:19 machine1 kernel: smpboot: Booting Node 0 Processor 2 APIC 0x4
Aug 08 14:31:19 machine1 kernel:  cache: parent cpu2 should not be sleeping
Aug 08 14:31:19 machine1 kernel: CPU2 is up
Aug 08 14:31:19 machine1 kernel: smpboot: Booting Node 0 Processor 3 APIC 0x6
Aug 08 14:31:19 machine1 kernel:  cache: parent cpu3 should not be sleeping
Aug 08 14:31:19 machine1 kernel: CPU3 is up
Aug 08 14:31:19 machine1 kernel: ACPI: Waking up from system sleep state S3
Aug 08 14:31:19 machine1 kernel: ACPI: EC: interrupt unblocked
Aug 08 14:31:19 machine1 kernel: ACPI: EC: event unblocked
Aug 08 14:31:19 machine1 kernel: rtlwifi: rtlwifi: wireless switch is on
Aug 08 14:31:19 machine1 kernel: sd 0:0:0:0: [sda] Starting disk
Aug 08 14:31:19 machine1 kernel: r8169 0000:03:00.0 enp3s0: link down
Aug 08 14:31:19 machine1 kernel: usb 1-4: reset full-speed USB device number 4 using xhci_hcd
Aug 08 14:31:19 machine1 kernel: ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
Aug 08 14:31:19 machine1 kernel: ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
Aug 08 14:31:19 machine1 kernel: ata2.00: configured for UDMA/133
Aug 08 14:31:19 machine1 kernel: ata1.00: configured for UDMA/133
Aug 08 14:31:19 machine1 kernel: usb 1-5: reset high-speed USB device number 5 using xhci_hcd
Aug 08 14:31:19 machine1 kernel: usb 1-3: reset high-speed USB device number 3 using xhci_hcd
Aug 08 14:31:19 machine1 kernel: psmouse serio1: synaptics: queried max coordinates: x [..5702], y [..4886]
Aug 08 14:31:19 machine1 kernel: psmouse serio1: synaptics: queried min coordinates: x [1240..], y [964..]
Aug 08 14:31:19 machine1 kernel: acpi LNXPOWER:00: Turning OFF
Aug 08 14:31:19 machine1 kernel: OOM killer enabled.
Aug 08 14:31:19 machine1 kernel: Restarting tasks ... done.
Aug 08 14:31:19 machine1 bluetoothd[858]: Endpoint unregistered: sender=:1.42 path=/MediaEndpoint/A2DPSource
Aug 08 14:31:19 machine1 systemd[1]: Started Restart Syncthing after resume.
Aug 08 14:31:19 machine1 bluetoothd[858]: Endpoint unregistered: sender=:1.42 path=/MediaEndpoint/A2DPSink
Aug 08 14:31:19 machine1 NetworkManager[904]: <info>  [1533709879.3078] bluez5: NAP: removed interface C8:3D:D4:9F:2F:5E
Aug 08 14:31:19 machine1 bluetoothd[858]: Endpoint unregistered: sender=:1.123 path=/MediaEndpoint/A2DPSource
Aug 08 14:31:19 machine1 systemd[1]: Starting Load/Save RF Kill Switch Status...
Aug 08 14:31:19 machine1 bluetoothd[858]: Endpoint unregistered: sender=:1.123 path=/MediaEndpoint/A2DPSink
Aug 08 14:31:19 machine1 dbus-daemon[1683]: [session uid=1000 pid=1683] Activating service name='org.freedesktop.Notifications' requested by ':1.207' (uid=1000 pid=23541 
Aug 08 14:31:19 machine1 kernel: Bluetooth: hci0: rtl: examining hci_ver=06 hci_rev=000a lmp_ver=06 lmp_subver=8821
Aug 08 14:31:19 machine1 kernel: Bluetooth: hci0: rtl: loading rtl_bt/rtl8821a_config.bin
Aug 08 14:31:19 machine1 kernel: bluetooth hci0: Direct firmware load for rtl_bt/rtl8821a_config.bin failed with error -2
Aug 08 14:31:19 machine1 kernel: Bluetooth: hci0: rtl: loading rtl_bt/rtl8821a_fw.bin
Aug 08 14:31:19 machine1 kernel: Bluetooth: hci0: rom_version status=0 version=1
Aug 08 14:31:19 machine1 kernel: Bluetooth: hci0: cfg_sz 0, total size 17428
Aug 08 14:31:19 machine1 systemd-rfkill[20511]: Failed to open device rfkill16: No such device
Aug 08 14:31:19 machine1 dbus-daemon[891]: [system] Rejected send message, 1 matched rules; type="error", sender=":1.123" (uid=1001 pid=19094 comm="/usr/bin/pulseaudio --
Aug 08 14:31:19 machine1 dbus-daemon[891]: [system] Rejected send message, 1 matched rules; type="error", sender=":1.123" (uid=1001 pid=19094 comm="/usr/bin/pulseaudio --
Aug 08 14:31:19 machine1 dbus-daemon[891]: [system] Rejected send message, 1 matched rules; type="error", sender=":1.123" (uid=1001 pid=19094 comm="/usr/bin/pulseaudio --
Aug 08 14:31:19 machine1 dbus-daemon[891]: [system] Rejected send message, 1 matched rules; type="error", sender=":1.123" (uid=1001 pid=19094 comm="/usr/bin/pulseaudio --
Aug 08 14:31:19 machine1 dbus-daemon[891]: [system] Rejected send message, 1 matched rules; type="error", sender=":1.42" (uid=1000 pid=1933 comm="/usr/bin/pulseaudio --st
Aug 08 14:31:19 machine1 dbus-daemon[891]: [system] Rejected send message, 1 matched rules; type="error", sender=":1.42" (uid=1000 pid=1933 comm="/usr/bin/pulseaudio --st
Aug 08 14:31:19 machine1 dbus-daemon[891]: [system] Rejected send message, 1 matched rules; type="error", sender=":1.42" (uid=1000 pid=1933 comm="/usr/bin/pulseaudio --st
Aug 08 14:31:19 machine1 dbus-daemon[891]: [system] Rejected send message, 1 matched rules; type="error", sender=":1.42" (uid=1000 pid=1933 comm="/usr/bin/pulseaudio --st
Aug 08 14:31:19 machine1 upowerd[1290]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.1
Aug 08 14:31:19 machine1 systemd[1]: bluetooth.target: Unit not needed anymore. Stopping.
Aug 08 14:31:19 machine1 systemd[1]: Stopped target Bluetooth.
Aug 08 14:31:19 machine1 upowerd[1290]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.1
Aug 08 14:31:19 machine1 upowerd[1290]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0
Aug 08 14:31:19 machine1 systemd[1]: Reached target Bluetooth.
Aug 08 14:31:19 machine1 systemd[1]: Started Load/Save RF Kill Switch Status.
Aug 08 14:31:19 machine1 upowerd[1290]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0
Aug 08 14:31:19 machine1 systemd-sleep[20458]: System resumed.
Aug 08 14:31:19 machine1 kernel: PM: suspend exit
Aug 08 14:31:19 machine1 dbus-daemon[1683]: [session uid=1000 pid=1683] Successfully activated service 'org.freedesktop.Notifications'
Aug 08 14:31:19 machine1 systemd[1]: Started Suspend.
Aug 08 14:31:19 machine1 systemd[1]: sleep.target: Unit not needed anymore. Stopping.
Aug 08 14:31:19 machine1 systemd[1]: Stopped target Sleep.
Aug 08 14:31:19 machine1 systemd[1]: Reached target Suspend.
Aug 08 14:31:19 machine1 systemd[1]: suspend.target: Unit not needed anymore. Stopping.
Aug 08 14:31:19 machine1 systemd[1]: Stopped target Suspend.
Aug 08 14:31:19 machine1 systemd-logind[865]: Operation 'sleep' finished.
Aug 08 14:31:19 machine1 NetworkManager[904]: <info>  [1533709879.5311] manager: sleep: wake requested (sleeping: yes  enabled: yes)
Aug 08 14:31:19 machine1 NetworkManager[904]: <info>  [1533709879.5312] device (enp3s0): state change: unavailable -> unmanaged (reason 'sleeping', sys-iface-state: 'mana
Aug 08 14:31:19 machine1 NetworkManager[904]: <info>  [1533709879.5542] device (enp3s0): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'manag
Aug 08 14:31:19 machine1 kernel: IPv6: ADDRCONF(NETDEV_UP): enp3s0: link is not ready
Aug 08 14:31:19 machine1 NetworkManager[904]: <info>  [1533709879.7348] device (wlp2s0): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'manag
Aug 08 14:31:19 machine1 kernel: r8169 0000:03:00.0 enp3s0: link down
Aug 08 14:31:19 machine1 kernel: IPv6: ADDRCONF(NETDEV_UP): enp3s0: link is not ready
Aug 08 14:31:19 machine1 kernel: IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
Aug 08 14:31:20 machine1 kernel: IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
Aug 08 14:31:20 machine1 NetworkManager[904]: <info>  [1533709880.0158] manager: NetworkManager state is now DISCONNECTED
Aug 08 14:31:20 machine1 wpa_supplicant[905]: dbus: fill_dict_with_properties dbus_interface=fi.w1.wpa_supplicant1.Interface dbus_property=Stations getter failed
Aug 08 14:31:20 machine1 wpa_supplicant[905]: dbus: wpa_dbus_get_object_properties: failed to get object properties: (none) none
Aug 08 14:31:20 machine1 wpa_supplicant[905]: dbus: Failed to construct signal
Aug 08 14:31:20 machine1 wpa_supplicant[905]: dbus: fill_dict_with_properties dbus_interface=fi.w1.wpa_supplicant1.Interface dbus_property=Stations getter failed
Aug 08 14:31:20 machine1 NetworkManager[904]: <info>  [1533709880.0784] device (wlp2s0): supplicant interface state: starting -> ready
Aug 08 14:31:20 machine1 NetworkManager[904]: <info>  [1533709880.0786] device (wlp2s0): state change: unavailable -> disconnected (reason 'supplicant-available', sys-ifa
Aug 08 14:31:20 machine1 kernel: IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
Aug 08 14:31:20 machine1 bluetoothd[858]: RFCOMM server failed for Headset Voice gateway: rfcomm_bind: Address already in use (98)
Aug 08 14:31:20 machine1 bluetoothd[858]: RFCOMM server failed for :1.123/Profile/HSPHSProfile/00001108-0000-1000-8000-00805f9b34fb: rfcomm_bind: Address already in use (
Aug 08 14:31:20 machine1 bluetoothd[858]: RFCOMM server failed for Message Notification: rfcomm_bind: Address already in use (98)
Aug 08 14:31:20 machine1 bluetoothd[858]: RFCOMM server failed for Message Access: rfcomm_bind: Address already in use (98)
Aug 08 14:31:20 machine1 bluetoothd[858]: RFCOMM server failed for Phone Book Access: rfcomm_bind: Address already in use (98)
Aug 08 14:31:20 machine1 bluetoothd[858]: RFCOMM server failed for Synchronization: rfcomm_bind: Address already in use (98)
Aug 08 14:31:20 machine1 bluetoothd[858]: RFCOMM server failed for File Transfer: rfcomm_bind: Address already in use (98)
Aug 08 14:31:20 machine1 bluetoothd[858]: RFCOMM server failed for Object Push: rfcomm_bind: Address already in use (98)
Aug 08 14:31:20 machine1 bluetoothd[858]: Endpoint registered: sender=:1.123 path=/MediaEndpoint/A2DPSource
Aug 08 14:31:20 machine1 NetworkManager[904]: <info>  [1533709880.2444] bluez5: NAP: added interface C8:3D:D4:9F:2F:5E
Aug 08 14:31:20 machine1 bluetoothd[858]: Endpoint registered: sender=:1.123 path=/MediaEndpoint/A2DPSink
Aug 08 14:31:20 machine1 bluetoothd[858]: Endpoint registered: sender=:1.42 path=/MediaEndpoint/A2DPSource
Aug 08 14:31:20 machine1 bluetoothd[858]: Endpoint registered: sender=:1.42 path=/MediaEndpoint/A2DPSink
Aug 08 14:31:22 machine1 ModemManager[887]: <info>  Couldn't check support for device at '/sys/devices/pci0000:00/0000:00:1c.2/0000:02:00.0': not supported by any plugin
Aug 08 14:31:22 machine1 ModemManager[887]: <info>  Couldn't check support for device at '/sys/devices/pci0000:00/0000:00:1c.3/0000:03:00.0': not supported by any plugin
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.2184] policy: auto-activating connection 'AP1'
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.2206] device (wlp2s0): Activation: starting connection 'AP1' (5021b605-7bc9-4c4a-8b45-f
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.2212] device (wlp2s0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.2216] manager: NetworkManager state is now CONNECTING
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.2227] device (wlp2s0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.2232] device (wlp2s0): Activation: (wifi) access point 'AP1' has security, but secrets 
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.2233] device (wlp2s0): state change: config -> need-auth (reason 'none', sys-iface-state: 'managed')
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.2304] device (wlp2s0): state change: need-auth -> prepare (reason 'none', sys-iface-state: 'managed')
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.2311] device (wlp2s0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.2317] device (wlp2s0): Activation: (wifi) connection 'AP1' has security, and secrets ex
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.2318] Config: added 'ssid' value 'AP1'
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.2319] Config: added 'scan_ssid' value '1'
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.2319] Config: added 'bgscan' value 'simple:30:-80:86400'
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.2320] Config: added 'key_mgmt' value 'WPA-PSK'
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.2320] Config: added 'auth_alg' value 'OPEN'
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.2320] Config: added 'psk' value '<hidden>'
Aug 08 14:31:23 machine1 wpa_supplicant[905]: wlp2s0: SME: Trying to authenticate with 54:36:9b:4b:50:46 (SSID='AP1' freq=2447 MHz)
Aug 08 14:31:23 machine1 kernel: wlp2s0: authenticate with 54:36:9b:4b:50:46
Aug 08 14:31:23 machine1 kernel: wlp2s0: send auth to 54:36:9b:4b:50:46 (try 1/3)
Aug 08 14:31:23 machine1 wpa_supplicant[905]: wlp2s0: Trying to associate with 54:36:9b:4b:50:46 (SSID='AP1' freq=2447 MHz)
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.2696] device (wlp2s0): supplicant interface state: ready -> authenticating
Aug 08 14:31:23 machine1 kernel: wlp2s0: authenticated
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.2750] device (wlp2s0): supplicant interface state: authenticating -> associating
Aug 08 14:31:23 machine1 kernel: wlp2s0: associate with 54:36:9b:4b:50:46 (try 1/3)
Aug 08 14:31:23 machine1 kernel: wlp2s0: RX AssocResp from 54:36:9b:4b:50:46 (capab=0x431 status=0 aid=4)
Aug 08 14:31:23 machine1 wpa_supplicant[905]: wlp2s0: Associated with 54:36:9b:4b:50:46
Aug 08 14:31:23 machine1 wpa_supplicant[905]: wlp2s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Aug 08 14:31:23 machine1 kernel: wlp2s0: associated
Aug 08 14:31:23 machine1 wpa_supplicant[905]: wlp2s0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=PH
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.2929] device (wlp2s0): supplicant interface state: associating -> 4-way handshake
Aug 08 14:31:23 machine1 wpa_supplicant[905]: wlp2s0: WPA: Key negotiation completed with 54:36:9b:4b:50:46 [PTK=CCMP GTK=CCMP]
Aug 08 14:31:23 machine1 wpa_supplicant[905]: wlp2s0: CTRL-EVENT-CONNECTED - Connection to 54:36:9b:4b:50:46 completed [id=0 id_str=]
Aug 08 14:31:23 machine1 wpa_supplicant[905]: bgscan simple: Failed to enable signal strength monitoring
Aug 08 14:31:23 machine1 kernel: IPv6: ADDRCONF(NETDEV_CHANGE): wlp2s0: link becomes ready
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.3075] device (wlp2s0): supplicant interface state: 4-way handshake -> completed
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.3078] device (wlp2s0): Activation: (wifi) Stage 2 of 5 (Device Configure) successful.  Connected to wire
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.3095] device (wlp2s0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.3107] dhcp4 (wlp2s0): activation: beginning transaction (timeout in 45 seconds)
Aug 08 14:31:23 machine1 NetworkManager[904]: <info>  [1533709883.3177] dhcp4 (wlp2s0): dhclient started with pid 20543
Aug 08 14:31:23 machine1 dhclient[20543]: DHCPREQUEST of 10.50.50.104 on wlp2s0 to 255.255.255.255 port 67 (xid=0x1a5b2b0)
Aug 08 14:31:25 machine1 avahi-daemon[885]: Joining mDNS multicast group on interface wlp2s0.IPv6 with address fe80::68f:2bd5:ff6a:fe34.
Aug 08 14:31:25 machine1 avahi-daemon[885]: New relevant interface wlp2s0.IPv6 for mDNS.
Aug 08 14:31:25 machine1 avahi-daemon[885]: Registering new address record for fe80::68f:2bd5:ff6a:fe34 on wlp2s0.*.
Aug 08 14:31:25 machine1 NetworkManager[904]: <info>  [1533709885.6555] dhcp6 (wlp2s0): activation: beginning transaction (timeout in 45 seconds)
Aug 08 14:31:25 machine1 NetworkManager[904]: <info>  [1533709885.6616] dhcp6 (wlp2s0): dhclient started with pid 20550
Aug 08 14:31:26 machine1 dhclient[20543]: DHCPREQUEST of 10.50.50.104 on wlp2s0 to 255.255.255.255 port 67 (xid=0x1a5b2b0)
Aug 08 14:31:26 machine1 dhclient[20550]: XMT: Confirm on wlp2s0, interval 1030ms.
Aug 08 14:31:26 machine1 dhclient[20550]: RCV: Reply message on wlp2s0 from fe80::5636:9bff:fe4b:5046.
Aug 08 14:31:26 machine1 dhclient[20550]: message status code NotOnLink.
Aug 08 14:31:26 machine1 dhclient[20543]: DHCPACK of 10.50.50.104 from 10.50.50.1
Aug 08 14:31:26 machine1 NetworkManager[904]: <info>  [1533709886.6877] dhcp4 (wlp2s0):   address 10.50.50.104
Aug 08 14:31:26 machine1 NetworkManager[904]: <info>  [1533709886.6878] dhcp4 (wlp2s0):   plen 24 (255.255.255.0)
Aug 08 14:31:26 machine1 NetworkManager[904]: <info>  [1533709886.6878] dhcp4 (wlp2s0):   gateway 10.50.50.1
Aug 08 14:31:26 machine1 NetworkManager[904]: <info>  [1533709886.6879] dhcp4 (wlp2s0):   lease time 43200
Aug 08 14:31:26 machine1 NetworkManager[904]: <info>  [1533709886.6879] dhcp4 (wlp2s0):   hostname 'machine1'
Aug 08 14:31:26 machine1 avahi-daemon[885]: Joining mDNS multicast group on interface wlp2s0.IPv4 with address 10.50.50.104.
Aug 08 14:31:26 machine1 NetworkManager[904]: <info>  [1533709886.6879] dhcp4 (wlp2s0):   nameserver '10.50.50.1'
Aug 08 14:31:26 machine1 avahi-daemon[885]: New relevant interface wlp2s0.IPv4 for mDNS.
Aug 08 14:31:26 machine1 NetworkManager[904]: <info>  [1533709886.6880] dhcp4 (wlp2s0):   domain name 'lan'
Aug 08 14:31:26 machine1 avahi-daemon[885]: Registering new address record for 10.50.50.104 on wlp2s0.IPv4.
Aug 08 14:31:26 machine1 NetworkManager[904]: <info>  [1533709886.6880] dhcp4 (wlp2s0): state changed unknown -> bound
Aug 08 14:31:26 machine1 NetworkManager[904]: <info>  [1533709886.6928] device (wlp2s0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
Aug 08 14:31:26 machine1 NetworkManager[904]: <info>  [1533709886.6947] device (wlp2s0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Aug 08 14:31:26 machine1 NetworkManager[904]: <info>  [1533709886.6962] device (wlp2s0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed'
Aug 08 14:31:26 machine1 NetworkManager[904]: <info>  [1533709886.6971] manager: NetworkManager state is now CONNECTED_LOCAL
Aug 08 14:31:26 machine1 NetworkManager[904]: <info>  [1533709886.7040] manager: NetworkManager state is now CONNECTED_SITE
Aug 08 14:31:26 machine1 NetworkManager[904]: <info>  [1533709886.7042] policy: set 'AP1' (wlp2s0) as default for IPv4 routing and DNS
Aug 08 14:31:26 machine1 NetworkManager[904]: <info>  [1533709886.7050] device (wlp2s0): Activation: successful, device activated.
Aug 08 14:31:26 machine1 dhclient[20543]: bound to 10.50.50.104 -- renewal in 19884 seconds.
Aug 08 14:31:26 machine1 NetworkManager[904]: <info>  [1533709886.7088] manager: NetworkManager state is now CONNECTED_GLOBAL
Aug 08 14:31:26 machine1 nm-dispatcher[20435]: req:3 'up' [wlp2s0]: new request (1 scripts)
Aug 08 14:31:26 machine1 nm-dispatcher[20435]: req:3 'up' [wlp2s0]: start running ordered scripts...
Aug 08 14:31:26 machine1 nm-dispatcher[20435]: req:4 'connectivity-change': new request (1 scripts)
Aug 08 14:31:26 machine1 whoopsie[1348]: [14:31:26] The default IPv4 route is: /org/freedesktop/NetworkManager/ActiveConnection/15
Aug 08 14:31:26 machine1 whoopsie[1348]: [14:31:26] Not a paid data plan: /org/freedesktop/NetworkManager/ActiveConnection/15
Aug 08 14:31:26 machine1 whoopsie[1348]: [14:31:26] Found usable connection: /org/freedesktop/NetworkManager/ActiveConnection/15
Aug 08 14:31:26 machine1 whoopsie[1348]: [14:31:26] online
Aug 08 14:31:26 machine1 avahi-daemon[885]: Leaving mDNS multicast group on interface wlp2s0.IPv6 with address fe80::68f:2bd5:ff6a:fe34.
Aug 08 14:31:26 machine1 avahi-daemon[885]: Joining mDNS multicast group on interface wlp2s0.IPv6 with address fd89:9bdb:a20f:0:156c:455d:51f9:6d4.
Aug 08 14:31:26 machine1 avahi-daemon[885]: Registering new address record for fd89:9bdb:a20f:0:156c:455d:51f9:6d4 on wlp2s0.*.
Aug 08 14:31:26 machine1 avahi-daemon[885]: Withdrawing address record for fe80::68f:2bd5:ff6a:fe34 on wlp2s0.
Aug 08 14:31:26 machine1 systemd[1]: Reloading OpenBSD Secure Shell server.
Aug 08 14:31:26 machine1 sshd[1080]: Received SIGHUP; restarting.
Aug 08 14:31:26 machine1 systemd[1]: Reloaded OpenBSD Secure Shell server.
Aug 08 14:31:26 machine1 sshd[1080]: Server listening on 0.0.0.0 port 222.
Aug 08 14:31:26 machine1 sshd[1080]: Server listening on :: port 222.
Aug 08 14:31:26 machine1 systemd[1]: Reloading OpenBSD Secure Shell server.
Aug 08 14:31:26 machine1 nm-dispatcher[20435]: req:4 'connectivity-change': start running ordered scripts...
Aug 08 14:31:27 machine1 sshd[1080]: Received SIGHUP; restarting.
Aug 08 14:31:27 machine1 systemd[1]: Reloaded OpenBSD Secure Shell server.
Aug 08 14:31:27 machine1 sshd[1080]: Server listening on 0.0.0.0 port 222.
Aug 08 14:31:27 machine1 sshd[1080]: Server listening on :: port 222.
Aug 08 14:31:27 machine1 dhclient[20550]: XMT: Solicit on wlp2s0, interval 1090ms.
Aug 08 14:31:27 machine1 dhclient[20550]: RCV: Advertise message on wlp2s0 from fe80::5636:9bff:fe4b:5046.
Aug 08 14:31:27 machine1 avahi-daemon[885]: Registering new address record for fd89:9bdb:a20f:0:e86b:e657:7531:55c3 on wlp2s0.*.
Aug 08 14:31:28 machine1 dhclient[20550]: XMT: Request on wlp2s0, interval 990ms.
Aug 08 14:31:28 machine1 dhclient[20550]: RCV: Reply message on wlp2s0 from fe80::5636:9bff:fe4b:5046.
Aug 08 14:31:28 machine1 NetworkManager[904]: <info>  [1533709888.4586] dhcp6 (wlp2s0):   valid_lft 4294967295
Aug 08 14:31:28 machine1 NetworkManager[904]: <info>  [1533709888.4588] dhcp6 (wlp2s0):   preferred_lft 4294967295
Aug 08 14:31:28 machine1 NetworkManager[904]: <info>  [1533709888.4589] dhcp6 (wlp2s0):   address fd89:9bdb:a20f::ba9
Aug 08 14:31:28 machine1 NetworkManager[904]: <info>  [1533709888.4591] dhcp6 (wlp2s0):   nameserver 'fd89:9bdb:a20f::1'
Aug 08 14:31:28 machine1 NetworkManager[904]: <info>  [1533709888.4593] dhcp6 (wlp2s0): state changed unknown -> bound, event ID="d4:9f:2f:5d|1533709888"
Aug 08 14:31:28 machine1 nm-dispatcher[20435]: req:5 'dhcp6-change' [wlp2s0]: new request (1 scripts)
Aug 08 14:31:28 machine1 nm-dispatcher[20435]: req:5 'dhcp6-change' [wlp2s0]: start running ordered scripts...
Aug 08 14:31:29 machine1 avahi-daemon[885]: Registering new address record for fd89:9bdb:a20f::ba9 on wlp2s0.*.

Hi everybody. Is there any news on this issue?

I am experiencing the same behavior reported: screen doesn't lock on resume if I "Suspend" from either the Menu "Suspend" Button or typing in the shell:

sudo systemctl suspend

However it does lock if I suspend my laptop with the power button.

How can I check which command is called when the power button is pressed?
In principle if one could replace the command run when clicking "Suspend" in the menu to the one that is run when clicking on the Power Button the issue would be fixed no?

Can anybody help me with this?

Cheers,
Luca

I found a work around this problem which works when suspending via:

  • command line
  • closing the laptop lid
  • suspend via indicator app or mate-menu

The work around is to install xss-lock and add it two the start applications:

xss-lock -- mate-screensaver-command --lock
3 Likes

Thank you @oz123. Your solution is the simplest one and it works for me on 20.04.

Hello,

Does anyone have news about screen locking on suspend ?
Seems this issue is not yet resolved.

But no password prompt or screen lock when suspending from systemctl suspend or even from wheel menu > suspend.
This only work if I suspend by closing the lid.

Same issue in Ubuntu Mate 20.04 and 21.04.

From Ubuntu Mate 19.10 Release Notes

Upstream MATE Desktop recently released 1.22.2. All the updates are present in Ubuntu MATE 19.10 plus I’ve cherry :cherries: picked a good deal of fixes from MATE Desktop development snapshots. In total, 67 additional patches have been applied to the MATE Desktop packages in Ubuntu MATE 19.10 to finesse this release prior to launch day :rocket: Included in those patches are fixes for locking the screen on resume from suspend [...]

Regards

I'm on 21.04 and MATE desktop version is stated as 1.24.1, however I'm still experiencing this!

@moocan I tried your solution and when I run the command sudo systemctl enable loginctl–lock-sessions.service I get the following:

Invalid unit name "loginctl–lock-sessions.service" escaped as "loginctl\xe2\x80\x93lock-sessions.service" (maybe you should use systemd-escape?).
Failed to enable unit: Unit file loginctl\xe2\x80\x93lock-sessions.service does not exist.

The forum software changed the double-dash ("--")in the filename to a Unicode emdash ( "–", \xe2\x80\x93). If you look real close, you will see that the dash between loginctl and lock is slighty wider than the dash separating lock and sessions. Systemctl doesn't like Unicode dashes.

If you name the file /etc/systemd/system/loginctl--lock-sessions.service, and enable it using systemctl enable loginctl--lock-sessions.service it will work.

2 Likes

Big thanx !!!
Worked for me on 20.04 too.
U R The Boss :pray:

Same issue on UM 22.04.
Your solution works great!
Thank you!
tatanka

How to Invoke a Locking Suspend When Using Ubuntu MATE 22.04 LTS on a Desktop

With Ubuntu MATE 22.04 LTS, there are three possible ways to suspend a desktop computer:

(1) A non-locking suspend: Menu -> Turn off the device -> Suspend

(2) A Switch-User Locking Suspend: Menu -> End the current session -> Switch User -> Suspend

(3) A Power-Management Locking Suspend: Menu -> Preferences -> Power Management -> On AC Power -> Put the computer to sleep when inactive for 10 minutes -> Minimize -> Menu -> Lock the screen

N.B: All of this is necessary for the simple reason that there is no suspend button on the lock screen. . . .

N.B: Even when the keyboard's physical suspend button is assigned to suspend, it will not respond when the screen is locked. Therefore, you will need to set power management to put the computer to sleep when inactive for the shortest amount of time, which, these days, happens to be 10 minutes. . . .

2 Likes

Welcome @JCS to the community!

On a previous occasion, I posted a description of the built-in methods for getting a locking suspend on Ubuntu MATE 22.04 LTS:

Since then, I have found the BEST SOLUTION YET for getting a proper, reliable locking suspend on Ubuntu MATE 22.04 LTS:

There's a cute little program sitting in the Ubuntu repository called "qshutdown." Use your favorite package manager to install it. Launch it, get to know it, and set its preferences. (You'll be able to do this fairly quickly.) Then, all you'll need to do to have a proper locking suspend IN SIXTY SECONDS (instead of in ten minutes) is Menu -> qshutdown, Menu -> Lock the screen.

You can use qshutdown for one-minute locking suspends and continue to use the MATE menu for shutdown, restart, log out, and switch user. You'll no longer need to use the built-in MATE methods for getting locking suspends.

Problem solved.

2 Likes

Was getting irritated by this, so searched for a solution ... only to find I'd found the same thread 5 years ago. Still not fixed then.