You are not logged in.

#26 2012-10-03 20:08:02

bazenga
Member
Registered: 2009-12-14
Posts: 15

Re: [SOLVED] Laptop mode tools forcing restart

With systemd the shutdown hook isn't executed anymore; create the following files to fix this:

/usr/local/bin/shutdown-power-management.sh

#!/bin/bash

# A script to act as a workaround for the bug in the runtime power
# management module, which causes thinkpad laptops to restart after
# shutting down.

# Bus list for the runtime power management module. Probably shouldn't
# touch this.
buslist="pci i2c"

for bus in $buslist; do                                                             
  for i in /sys/bus/$bus/devices/*/power/control; do                              
    echo on > $i
  done
done

/etc/systemd/system/laptop-mode-tools.service

.include /usr/lib/systemd/system/laptop-mode-tools.service

[Service]
ExecStopPost=/bin/rm -f /var/run/laptop-mode-tools/enabled ; /usr/local/bin/shutdown-power-management.sh

After you created the files, execute systemctl daemon-reload

Offline

#27 2012-10-04 00:24:31

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,132

Re: [SOLVED] Laptop mode tools forcing restart

I haven't seen the problem since switching to systemd - I was assuming the fix was unnecessary with systemd. (In fact, I have the opposite problem - I shutdown rather than rebooting.) But maybe I should test again...

EDIT: I double-checked and shutdown on battery shuts down even without the fix with systemd. (Or maybe it plans to reboot but whatever stops rebooting prevents it from doing so in my case? So it looks like it works but only because the bugs cancel each other out...)

Last edited by cfr (2012-10-04 20:42:13)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#28 2012-10-04 06:12:34

qiuwei
Member
Registered: 2009-12-18
Posts: 245

Re: [SOLVED] Laptop mode tools forcing restart

@bazenga, thanks, your workaround works like a charm here.

Offline

#29 2012-10-30 10:25:05

bassu
Member
Registered: 2011-12-21
Posts: 90

Re: [SOLVED] Laptop mode tools forcing restart

On my Thinkpad X230, I had to disable "auto turn on when AC power" in BIOS > Configurations > Power. Then deployed the above script to reenable pci power controls.
And bazenga!!!!!! lol

Last edited by bassu (2012-10-30 10:26:14)


The greatest threat to knowledge is not ignorance - it is the illusion of knowledge!

Offline

Board footer

Powered by FluxBB