You are not logged in.
Hello,
I am trying to prevent my laptop (a System76 Lemur Ultra 3) from suspending when the lid is closed. No matter what I change in the configuration, the laptop always suspends when the lid is closed. The output of journalctl is as follows after this happens:
Feb 21 04:35:32 hostname systemd-logind[196]: Lid closed.
Feb 21 04:35:32 hostname systemd-logind[196]: Suspending...
Feb 21 04:35:32 hostname systemd[1]: Starting Sleep.
Feb 21 04:35:32 hostname systemd[1]: Reached target Sleep.
Feb 21 04:35:32 hostname systemd[1]: Starting Suspend...
Feb 21 04:35:33 hostname systemd-sleep[2001]: Suspending system...
Feb 21 04:35:33 hostname kernel: PM: Syncing filesystems ... done.
Feb 21 04:35:33 hostname kernel: PM: Preparing system for mem sleep
Feb 21 04:35:43 hostname kernel: Freezing user space processes ... (elapsed 0.06 seconds) done.
Feb 21 04:35:43 hostname kernel: Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.
Feb 21 04:35:43 hostname systemd[1]: Time has been changed
Feb 21 04:35:43 hostname systemd[1]: systemd-tmpfiles-clean.timer: time change, recalculating next elapse.
Feb 21 04:35:43 hostname systemd-logind[196]: Lid opened.
Feb 21 04:35:43 hostname acpid[190]: client 1812[0:100] has disconnected
Feb 21 04:35:43 hostname kernel: PM: Entering mem sleep
Feb 21 04:35:43 hostname kernel: Suspending console(s) (use no_console_suspend to debug)
Feb 21 04:35:43 hostname kernel: sd 0:0:0:0: [sda] Synchronizing SCSI cache
Feb 21 04:35:43 hostname kernel: sd 0:0:0:0: [sda] Stopping disk
Feb 21 04:35:43 hostname kernel: PM: suspend of devices complete after 1092.547 msecs
Feb 21 04:35:43 hostname kernel: PM: late suspend of devices complete after 0.556 msecs
Feb 21 04:35:43 hostname kernel: jme 0000:03:00.0: wake-up capability enabled by ACPI
Feb 21 04:35:43 hostname kernel: ehci_hcd 0000:00:1d.0: wake-up capability enabled by ACPI
Feb 21 04:35:43 hostname kernel: ehci_hcd 0000:00:1a.0: wake-up capability enabled by ACPI
Feb 21 04:35:43 hostname kernel: PM: noirq suspend of devices complete after 66.095 msecs
Feb 21 04:35:43 hostname kernel: ACPI: Preparing to enter system sleep state S3
Feb 21 04:35:43 hostname kernel: PM: Saving platform NVS memory
Feb 21 04:35:43 hostname kernel: Disabling non-boot CPUs ...
Feb 21 04:35:43 hostname kernel: smpboot: CPU 1 is now offline
Feb 21 04:35:43 hostname kernel: smpboot: CPU 2 is now offline
Feb 21 04:35:43 hostname kernel: smpboot: CPU 3 is now offline
Feb 21 04:35:43 hostname kernel: smpboot: CPU 4 is now offline
Feb 21 04:35:43 hostname kernel: smpboot: CPU 5 is now offline
Feb 21 04:35:43 hostname kernel: smpboot: CPU 6 is now offline
Feb 21 04:35:43 hostname kernel: smpboot: CPU 7 is now offline
Feb 21 04:35:43 hostname kernel: Extended CMOS year: 2000
Feb 21 04:35:43 hostname kernel: ACPI: Low-level resume complete
Feb 21 04:35:43 hostname kernel: PM: Restoring platform NVS memory
Feb 21 04:35:43 hostname kernel: Extended CMOS year: 2000
Feb 21 04:35:43 hostname kernel: Enabling non-boot CPUs ...
Feb 21 04:35:43 hostname systemd-sleep[2001]: System resumed.
Feb 21 04:35:43 hostname kernel: smpboot: Booting Node 0 Processor 1 APIC 0x2
Feb 21 04:35:43 hostname kernel: CPU1 is up
Feb 21 04:35:43 hostname kernel: smpboot: Booting Node 0 Processor 2 APIC 0x4
Feb 21 04:35:43 hostname kernel: CPU2 is up
Feb 21 04:35:43 hostname kernel: smpboot: Booting Node 0 Processor 3 APIC 0x6
Feb 21 04:35:43 hostname kernel: CPU3 is up
Feb 21 04:35:43 hostname kernel: smpboot: Booting Node 0 Processor 4 APIC 0x1
Feb 21 04:35:43 hostname kernel: CPU4 is up
Feb 21 04:35:43 hostname kernel: smpboot: Booting Node 0 Processor 5 APIC 0x3
Feb 21 04:35:43 hostname kernel: CPU5 is up
Feb 21 04:35:43 hostname kernel: smpboot: Booting Node 0 Processor 6 APIC 0x5
Feb 21 04:35:43 hostname kernel: CPU6 is up
Feb 21 04:35:43 hostname kernel: smpboot: Booting Node 0 Processor 7 APIC 0x7
Feb 21 04:35:43 hostname kernel: CPU7 is up
Feb 21 04:35:43 hostname kernel: ACPI: Waking up from system sleep state S3
Feb 21 04:35:43 hostname kernel: ehci_hcd 0000:00:1a.0: wake-up capability disabled by ACPI
Feb 21 04:35:43 hostname kernel: ehci_hcd 0000:00:1d.0: wake-up capability disabled by ACPI
Feb 21 04:35:43 hostname kernel: PM: noirq resume of devices complete after 133.251 msecs
Feb 21 04:35:43 hostname kernel: PM: early resume of devices complete after 0.425 msecs
The first thing I did was to disable systemd's acpi features by setting /etc/systemd/logind.conf as follows:
# 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.
#
# See logind.conf(5) for details
[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#Controllers=
#ResetControllers=cpu
#InhibitDelayMaxSec=5
HandlePowerKey=ignore
HandleSuspendKey=ignore
HandleHibernateKey=ignore
HandleLidSwitch=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
IdleAction=suspend
IdleActionSec=45min
However, the behavior was the same as before. I also tried setting
LidSwitchIgnoreInhibited=no
but after reading man 5 logind.conf it seems that this is unnecessary (and it had no effect when I tried it).
acpid is also installed but I have commented out the contents of /etc/acpi/handler.sh as well as all the scripts in /etc/acpi/actions. I noticed that there is also a UPower daemon which was installed as a dependency and thought that it might be triggering the suspend. I tried setting
IgnoreLid=true
in /etc/UPower/UPower.conf but this also had no effect.
systemctl list-units has the following output:
UNIT LOAD ACTIVE SUB DESCRIPTION
proc-sys-fs-binfmt_misc.automount loaded active waiting Arbitrary Executable File Formats File System Automount Point
sys-devices-pci0000:00-0000:00:1b.0-sound-card0.device loaded active plugged /sys/devices/pci0000:00/0000:00:1b.0/sound/card0
sys-devices-pci0000:00-0000:00:1c.2-0000:02:00.0-net-wlan0.device loaded active plugged /sys/devices/pci0000:00/0000:00:1c.2/0000:02:00.0/net/wlan0
sys-devices-pci0000:00-0000:00:1c.3-0000:03:00.0-net-eth0.device loaded active plugged /sys/devices/pci0000:00/0000:00:1c.3/0000:03:00.0/net/eth0
sys-devices-pci0000:00-0000:00:1d.0-usb2-2\x2d1-2\x2d1.2-2\x2d1.2.1-2\x2d1.2.1.1-2\x2d1.2.1.1.1-2\x2d1.2.1.1.1:1.2-sound-card1.device loaded active plugged 0819
sys-devices-pci0000:00-0000:00:1d.0-usb2-2\x2d1-2\x2d1.2-2\x2d1.2.1-2\x2d1.2.1.3.device loaded active plugged Deskjet_5400_series
sys-devices-pci0000:00-0000:00:1f.2-ata1-host0-target0:0:0-0:0:0:0-block-sda-sda1.device loaded active plugged ST9500420AS
sys-devices-pci0000:00-0000:00:1f.2-ata1-host0-target0:0:0-0:0:0:0-block-sda-sda2.device loaded active plugged ST9500420AS
sys-devices-pci0000:00-0000:00:1f.2-ata1-host0-target0:0:0-0:0:0:0-block-sda.device loaded active plugged ST9500420AS
sys-devices-pci0000:00-0000:00:1f.2-ata3-host2-target2:0:0-2:0:0:0-block-sr0.device loaded active plugged TSSTcorp_CDDVDW_SN-208AB
sys-devices-platform-serial8250-tty-ttyS0.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS0
sys-devices-platform-serial8250-tty-ttyS1.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS1
sys-devices-platform-serial8250-tty-ttyS2.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS2
sys-devices-platform-serial8250-tty-ttyS3.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS3
sys-module-configfs.device loaded active plugged /sys/module/configfs
sys-subsystem-net-devices-eth0.device loaded active plugged /sys/subsystem/net/devices/eth0
sys-subsystem-net-devices-wlan0.device loaded active plugged /sys/subsystem/net/devices/wlan0
-.mount loaded active mounted /
dev-hugepages.mount loaded active mounted Huge Pages File System
dev-mqueue.mount loaded active mounted POSIX Message Queue File System
media-usbhd\x2dsda1.mount loaded active mounted /media/usbhd-sda1
sys-kernel-config.mount loaded active mounted Configuration File System
sys-kernel-debug.mount loaded active mounted Debug File System
tmp.mount loaded active mounted Temporary Directory
cups.path loaded active waiting CUPS Printer Service Spool
systemd-ask-password-console.path loaded active waiting Dispatch Password Requests to Console Directory Watch
systemd-ask-password-wall.path loaded active waiting Forward Password Requests to Wall Directory Watch
acpid.service loaded active running ACPI event daemon
atd.service loaded active running ATD daemon
cronie.service loaded active running Periodic Command Scheduler
cups.service loaded active running CUPS Printing Service
dbus.service loaded active running D-Bus System Message Bus
getty@tty1.service loaded active running Getty on tty1
laptop-mode.service loaded active exited Laptop Mode Tools
polkit.service loaded active running Authorization Manager
postfix.service loaded active running Postfix Mail Transport Agent
systemd-journald.service loaded active running Journal Service
systemd-logind.service loaded active running Login Service
systemd-modules-load.service loaded active exited Load Kernel Modules
systemd-remount-fs.service loaded active exited Remount Root and Kernel File Systems
systemd-sysctl.service loaded active exited Apply Kernel Variables
systemd-tmpfiles-setup.service loaded active exited Recreate Volatile Files and Directories
systemd-udev-trigger.service loaded active exited udev Coldplug all Devices
systemd-udevd.service loaded active running udev Kernel Device Manager
systemd-user-sessions.service loaded active exited Permit User Sessions
systemd-vconsole-setup.service loaded active exited Setup Virtual Console
upower.service loaded active running Daemon for power management
wicd.service loaded active running Wicd a wireless and wired network manager for Linux
acpid.socket loaded active listening ACPID Listen Socket
cups.socket loaded active running CUPS Printing Service Sockets
dbus.socket loaded active running D-Bus System Message Bus Socket
dmeventd.socket loaded active listening Device-mapper event daemon FIFOs
lvmetad.socket loaded active listening LVM2 metadata daemon socket
systemd-initctl.socket loaded active listening /dev/initctl Compatibility Named Pipe
systemd-journald.socket loaded active running Journal Socket
systemd-shutdownd.socket loaded active listening Delayed Shutdown Socket
systemd-udevd-control.socket loaded active listening udev Control Socket
systemd-udevd-kernel.socket loaded active running udev Kernel Socket
basic.target loaded active active Basic System
cryptsetup.target loaded active active Encrypted Volumes
getty.target loaded active active Login Prompts
graphical.target loaded active active Graphical Interface
local-fs-pre.target loaded active active Local File Systems (Pre)
local-fs.target loaded active active Local File Systems
multi-user.target loaded active active Multi-User
network.target loaded active active Network
printer.target loaded active active Printer
remote-fs.target loaded active active Remote File Systems
sockets.target loaded active active Sockets
sound.target loaded active active Sound Card
suspend.target loaded active active Suspend
swap.target loaded active active Swap
sysinit.target loaded active active System Initialization
systemd-tmpfiles-clean.timer loaded active waiting Daily Cleanup of Temporary Directories
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.
74 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
Any ideas on what might be causing the system to suspend when the lid is closed would be appreciated.
Thanks
Last edited by Superposition (2013-02-21 15:48:06)
Offline
Hi, you should use [code ][/code ] blocks for readability!
There are laptops that have the ability to en-/disable this in the BIOS.
I don't know if yours does, but you can try (mine does!)
Offline
Have you read https://wiki.archlinux.org/index.php/Sy … management ?
Offline
Hi, you should use [code ][/code ] blocks for readability!
Fixed.
There are laptops that have the ability to en-/disable this in the BIOS.
I don't know if yours does, but you can try (mine does!)
Unfortunately, I need to do it in software. The ultimate goal is to handle lid/close open with acpid. What I really want is for the machine only to suspend when on battery power; I had this working before I switched to systemd. I figure disabling any/all daemons that handle lid close events is the logical first step.
Have you read https://wiki.archlinux.org/index.php/Sy … management ?
Yes, I tried disabling systemd's acpi handlers by setting Handle*=ignore; however, the behavior was still the same as before.
Edit 1: It does appear from the log that system-dlogind is causing the suspend. However, I would have thought it would be disabled given the logind.conf file in my original post. At least the wiki and man page seem to say it should.
Edit 2: I confirmed that systemd-logind is still triggering the suspend by temporarily disabling systemd-logind. This stopped the laptop from going into suspend.
Last edited by Superposition (2013-02-21 16:05:34)
Offline
Just to be sure, you did run
systemctl restart systemd-logind.service
after setting the switch to 'ignore'?
Offline
Just to be sure, you did run
systemctl restart systemd-logind.service
after setting the switch to 'ignore'?
Yes, I restarted systemd.logind after I changed those settings. There have also been a few reboots since then.
I'm sure I'm just overlooking something obvious somewhere. I am new to systemd and am probably making some stupid mistake.
Offline
Did you try acpi=off on kernel command line?
Also I have disabled it in a configuration file on my laptop. Try checking my account history where I asked about it
Offline
I don't want to disable acpi altogether. I actually want to handle lid close/open using acpid (which is how I had things set up before switching to systemd). I figure preventing systemd from suspending when I close the lid is the logical first step towards that.
Offline
You don't have to disable acpi!
Since you made the complete switch to systemd, why not let systemd handle this kind of events?
Why do you want/need acpid to handle the event?
I personally think things get easier when you let systemd handle this, but of course you can do what you like.)
Offline
I personally think things get easier when you let systemd handle this, but of course you can do what you like.)
Yes, it is easier, but my laptop should react differently depending on the power source. With AC power lid-switch locks the screen, in battery mode it suspends. That is impossible with systemd.
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Online
Yes, it is easier, but my laptop should react differently depending on the power source. With AC power lid-switch locks the screen, in battery mode it suspends. That is impossible with systemd.
Yes you need something like laptop-mode-tools for that, I know systemd will not do that, for now.
But that is not the issue here!, the issue here is that the llid-switch-button' shouldn't be used at all.
For as far as possible I would still recommend systemd to handle your events!, but it's your decision finally!
Last edited by qinohe (2013-02-22 11:48:52)
Offline
You don't have to disable acpi!
Since you made the complete switch to systemd, why not let systemd handle this kind of events?
I was referring to the suggestion of setting acpi=off on the kernel line. systemd can only run a few preset actions on events like lid close (e.g. suspend, poweroff, ignore, etc.). I need to run custom scripts. Also, for some reason I still do not fully understand, it was not working properly. The log in my original post seems to show that it was initiating the suspend.
progandy wrote:Yes, it is easier, but my laptop should react differently depending on the power source. With AC power lid-switch locks the screen, in battery mode it suspends. That is impossible with systemd.
Yes you need something like laptop-mode-tools for that, I know systemd will not do that, for now.
But that is not the issue here!, the issue here is that the llid-switch-button' shouldn't be used at all.
For as far as possible I would still recommend systemd to handle your events!, but it's your decision finally!
You need acpid for that not laptop-mode-tools. This is exactly what apcid is for --- running user scripts on ACPI events.
Anyway, I finally have this fixed though I still have no idea what the problem was. I ran out of ideas on how to fix it and #archlinux didn't know either so I went the painful but sure route. I did full reinstall and reinstalled all programs. logind was still behaving as this point (not ignoring it's logind.conf file as it seemed to be before the reinstall) after this so I concluded that the packages installed were not the problem at least with their default configs. After that, I gradually restored the config files I cared about while testing to see if logind still worked correctly. Contrary, to what I expected it never broke and I was able to restore all modified configs and get correct behavior.
I suspect there was some old out of date config file somewhere that was causing the problem but it's hard to say which one it was. I could probably figure it out with a bit more experimentation but have already spent enough time fixing this...
In case anyone else needs a similar configuration, the relevant files are as follows. This sets up the system to lock whenever systemd executes a suspend action. It also sets up acpid to suspend on lid close.
Make sure you have installed acpid and enabled it to run at startup.
/etc/systemd/logind.conf
# 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.
#
# See logind.conf(5) for details
[Login]
/etc/systemd/logind.conf
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#Controllers=
#ResetControllers=cpu
#InhibitDelayMaxSec=5
HandlePowerKey=ignore
HandleSuspendKey=ignore
HandleHibernateKey=ignore
HandleLidSwitch=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#IdleAction=ignore
#IdleActionSec=30min
/etc/acpi/handler.sh
#!/bin/bash
# Default acpi script that takes an entry for all actions
case "$1" in
button/power)
case "$2" in
PBTN|PWRF)
logger 'PowerButton pressed'
/usr/bin/systemctl poweroff
;;
*)
logger "ACPI action undefined: $2"
;;
esac
;;
button/sleep)
case "$2" in
SLPB|SBTN)
logger 'SleepButton pressed'
/usr/bin/systemctl suspend
;;
*)
logger "ACPI action undefined: $2"
;;
esac
;;
ac_adapter)
case "$2" in
AC|ACAD|ADP0)
case "$4" in
00000000)
logger 'AC unpluged'
/usr/sbin/laptop_mode auto
;;
00000001)
logger 'AC pluged'
/usr/sbin/laptop_mode auto
;;
esac
;;
*)
logger "ACPI action undefined: $2"
;;
esac
;;
battery)
case "$2" in
BAT0)
case "$4" in
00000000)
logger 'Battery online'
/usr/sbin/laptop_mode auto
;;
00000001)
logger 'Battery offline'
/usr/sbin/laptop_mode auto
;;
esac
;;
CPU0)
;;
*) logger "ACPI action undefined: $2" ;;
esac
;;
button/lid)
case "$3" in
close)
logger 'LID closed'
/usr/sbin/laptop_mode auto
if [ $(cat /sys/class/power_supply/ADP0/online) -eq 0 ]; then
/usr/bin/systemctl suspend
fi
;;
open)
logger 'LID opened'
/usr/sbin/laptop_mode auto
;;
*)
logger "ACPI action undefined: $3"
;;
esac
;;
*)
logger "ACPI group/action undefined: $1 / $2"
;;
esac
# vim:set ts=4 sw=4 ft=sh et:
Last edited by Superposition (2013-02-23 23:15:54)
Offline
You need acpid for that not laptop-mode-tools. This is exactly what apcid is for --- running user scripts on ACPI events.
Anyway, I finally have this fixed though I still have no idea what the problem was.
Ah yeah sorry don't know why I typed the tools....
Well, your problem is solved, but you didn't fix it!
Sad, now we never know what the real issue was.(
Offline
Well, I did fix it, I just didn't find out what the problem was...
The issue is some config file in /etc though it's hard so say which one. (Restoring all config files except /etc/logind.conf to their defaults resovles the problem.) If the problem crops up again, I would suggest backing up all configs in /etc and then restoring the default configs. After that you can copy back the old configs gradually and see at what point things break.
Offline
Well, I did fix it, I just didn't find out what the problem was...
The issue is some config file in /etc though it's hard so say which one. (Restoring all config files except /etc/logind.conf to their defaults resovles the problem.) If the problem crops up again, I would suggest backing up all configs in /etc and then restoring the default configs. After that you can copy back the old configs gradually and see at what point things break.
Reinstalling is not fixing the problem, thats a workaround , but hey thats how I think about, no worries mate!
Well diff logind.conf with the old one and look for differences.)
Offline
Reinstalling is not fixing the problem, thats a workaround hmm , but hey thats how I think about, no worries mate!
Well diff logind.conf with the old one and look for differences.)
A workaround would be if I used some ugly hack. Things are working exactly as they should now with no such hacks in place.
Well diff logind.conf with the old one and look for differences.)
I may not have many posts, but I'm not a noob and have used arch for a long time and do obvious things like diffing my config files before asking for help. The config file in question is not logind.conf or one for acpid as the logind.conf and acpi configs are the same as before. The theory when I asked on #archlinux was that there is some other daemon installed which is causing logind to suspend rather than ignore the closed lid as it should. This is probably due to some legacy config file that was present on my old install and got updated when I installed a fresh system. To find that file, I'd have to mess around with copying back all my old configs in /etc and seeing when things break.
Offline