IdleAction=suspend specified in logind.conf must systematically be inhibited during user interaction

Bug #1504254 reported by Etienne URBAH
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
systemd
New
Undecided
Unassigned
systemd (Ubuntu)
Invalid
Medium
Unassigned

Bug Description

I want my computer to suspend when there is NO opened user session.

So, I have activated following lines inside '/etc/systemd/logind.conf' :
IdleAction=suspend
IdleActionSec=15min

- Systematically , under Ubuntu Vivid (15.04), this works correctly :
   During user interaction, the computer does NOT automatically suspend, but stays continuously alive.
   Once all users have closed their session, the computer automatically suspends after 15 min.

- But systematically , under Ubuntu Wily (15.10 beta2), the computer automatically suspends after 15 min EVEN during user interaction.
   Hitting the keyboard makes the computer resume without data loss, but this is still annoying.
   In fact, 'IdleAction=suspend' specified in '/etc/systemd/logind.conf' must systematically be inhibited during user interaction.

ProblemType: Bug
DistroRelease: Ubuntu 15.10
Package: linux-image-4.2.0-14-generic 4.2.0-14.16
ProcVersionSignature: Ubuntu 4.2.0-14.16-generic 4.2.2
Uname: Linux 4.2.0-14-generic x86_64
ApportVersion: 2.19-0ubuntu1
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: z_admin 1665 F.... pulseaudio
 /dev/snd/controlC1: z_admin 1665 F.... pulseaudio
CurrentDesktop: GNOME
Date: Thu Oct 8 19:26:59 2015
HibernationDevice: RESUME=UUID=ccecc437-66d2-4e39-ac56-76ab11e18140
InstallationDate: Installed on 2015-09-27 (10 days ago)
InstallationMedia: Ubuntu-GNOME 15.10 "Wily Werewolf" - Alpha amd64 (20150924)
IwConfig:
 enp2s0 no wireless extensions.

 lo no wireless extensions.
MachineType: To be filled by O.E.M. To be filled by O.E.M.
ProcFB: 0 radeondrmfb
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-4.2.0-14-generic root=UUID=a5c156d8-eac3-47fa-835c-b2c4ebda969d ro quiet splash vt.handoff=7
RelatedPackageVersions:
 linux-restricted-modules-4.2.0-14-generic N/A
 linux-backports-modules-4.2.0-14-generic N/A
 linux-firmware 1.149
RfKill:

SourcePackage: linux
UdevLog: Error: [Errno 2] No such file or directory: '/var/log/udev'
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 04/07/2014
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: 2501
dmi.board.asset.tag: To be filled by O.E.M.
dmi.board.name: M5A97 R2.0
dmi.board.vendor: ASUSTeK COMPUTER INC.
dmi.board.version: Rev 1.xx
dmi.chassis.asset.tag: To Be Filled By O.E.M.
dmi.chassis.type: 3
dmi.chassis.vendor: To Be Filled By O.E.M.
dmi.chassis.version: To Be Filled By O.E.M.
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvr2501:bd04/07/2014:svnTobefilledbyO.E.M.:pnTobefilledbyO.E.M.:pvrTobefilledbyO.E.M.:rvnASUSTeKCOMPUTERINC.:rnM5A97R2.0:rvrRev1.xx:cvnToBeFilledByO.E.M.:ct3:cvrToBeFilledByO.E.M.:
dmi.product.name: To be filled by O.E.M.
dmi.product.version: To be filled by O.E.M.
dmi.sys.vendor: To be filled by O.E.M.

Revision history for this message
Etienne URBAH (eurbah) wrote :
Revision history for this message
Brad Figg (brad-figg) wrote : Status changed to Confirmed

This change was made by a bot.

Changed in linux (Ubuntu):
status: New → Confirmed
penalvch (penalvch)
affects: linux (Ubuntu) → systemd (Ubuntu)
Changed in systemd (Ubuntu):
status: Confirmed → New
tags: added: regression-release
Changed in systemd (Ubuntu):
importance: Undecided → Medium
Changed in systemd (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
Revision history for this message
Etienne URBAH (eurbah) wrote :

This bug is still present in systemd version 229-2ubuntu1 from 'Ubuntu 16.04 Xenial Beta1'.

tags: added: xenial
Revision history for this message
Etienne URBAH (eurbah) wrote :

This bug is still present in systemd version 229-4ubuntu4 from 'Ubuntu 16.04 Xenial'

Revision history for this message
Etienne URBAH (eurbah) wrote :

IdleAction=suspend DOES NOT WORK AT ALL in systemd version 231-6git1 from Ubuntu 16.10 Yakkety Beta.

Revision history for this message
Etienne URBAH (eurbah) wrote :

The attached 'login-screen-suspend.sh' script contains a workaround daemon permitting to automatically suspend the computer after NO user has been active during the time specified in '/etc/systemd/logind.conf'.

It is possible to install this script in '/usr/local/bin/login-screen-suspend.sh', and launch this daemon by adding following lines at the beginning of '/etc/rc.local' :

LOGIN_SCREEN_SUSPEND='/usr/local/bin/login-screen-suspend.sh'
if [ -f "$LOGIN_SCREEN_SUSPEND" ] && \
    [ -x "$LOGIN_SCREEN_SUSPEND" ]; then
  $LOGIN_SCREEN_SUSPEND >> /var/log/login-screen-suspend.log 2>&1 &
fi

This workaround is probably NOT bulletproof, but it works correctly for me.

In the hope that it may be useful.

Revision history for this message
Etienne URBAH (eurbah) wrote :

IdleAction=suspend still DOES NOT WORK AT ALL in systemd version 231-9git1 from Ubuntu 16.10 Yakkety Beta.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in systemd (Ubuntu):
status: New → Confirmed
Martin Pitt (pitti)
Changed in systemd (Ubuntu):
assignee: Martin Pitt (pitti) → nobody
Revision history for this message
Etienne URBAH (eurbah) wrote :

In systemd version 232-21ubuntu2 from Ubuntu 17.04 Zesty, this bug seems to be corrected :

With 'IdleAction=suspend' and 'IdleActionSec=2min', systemd now does suspend my computer, but only when there is NO opened user session.

Revision history for this message
Etienne URBAH (eurbah) wrote :

I apologize, but my comment #9 was wrong :

After more precise testing of 'systemd' version 232-21ubuntu2 from Ubuntu 17.04 Zesty with 'IdleAction=suspend' and 'IdleActionSec=2min' :

'systemd' does NOT unduly suspend my computer when there is an opened user session (OK).

But 'systemd' does NOT systematically suspend my computer 2mn after the last opened user session has been closed.

As a workaround, I am using the attached 'login-screen-suspend.sh' script.
Since '/etc/rc.local' seems to be deprecated, I am starting my script as a 'systemd' service whose '/etc/systemd/system/login-screen-suspend.service' file has following content :

[Unit]
Description=login screen suspend daemon
After=systemd-user-sessions.service

[Service]
Environment="LOGFILE=/var/log/login-screen-suspend.log"
ExecStart=/bin/sh -c "/usr/local/sbin/login-screen-suspend.sh >> $LOGFILE 2>&1"

[Install]
WantedBy=multi-user.target

Revision history for this message
Kai-Heng Feng (kaihengfeng) wrote :

https://www.freedesktop.org/software/systemd/man/logind.conf.html

IdleAction=
Configures the action to take when the system is idle. Takes one of "ignore", "poweroff", "reboot", "halt", "kexec", "suspend", "hibernate", "hybrid-sleep", and "lock". Defaults to "ignore".

Note that this requires that user sessions correctly report the idle status to the system. The system will execute the action after all sessions report that they are idle, no idle inhibitor lock is active, and subsequently, the time configured with IdleActionSec= (see below) has expired.

...so this is an expected behavior.

Revision history for this message
amk (9-launchpad-mikus-sk) wrote :

Now found this bug, I think it is the lightdm who is not reporting idle status to the system. See https://bugs.launchpad.net/ubuntu/+source/lightdm/+bug/1730606 for a script I run via cron every 15 minutes that overrides active status of login screens or closing sessions. It also takes care of commands running under sleep inhibitor.

Revision history for this message
Etienne URBAH (eurbah) wrote :

With 'systemd' version 237-3ubuntu7 from Ubuntu 18.04 Bionic Beta2 :

- The 'pm-utils' package is NOT installed by default, and 'systemd' does NOT systematically suspend my computer 2mn after the last opened user session has been closed.

- After manual installation of the 'pm-utils' package, 'systemd' DID suspend my computer 2mn after the last opened user session has been closed.

I have to perform further tests to check if the good behavior of 'systemd' systematically comes from the presence of the 'pm-utils' package.

tags: added: artful bionic
Dan Streetman (ddstreet)
Changed in systemd (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.