<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>.:: Marcos Dione/StyXman's glob ::. (Posts about acpi)</title><link>https://www.grulic.org.ar/~mdione/glob/</link><description></description><atom:link href="https://www.grulic.org.ar/~mdione/glob/categories/acpi.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2025 &lt;a href="mailto:mdione@grulic.org.ar"&gt;Marcos Dione&lt;/a&gt; </copyright><lastBuildDate>Thu, 29 May 2025 15:41:11 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Configuring power and hardware related events</title><link>https://www.grulic.org.ar/~mdione/glob/posts/configuring-power-and-hardware-related-events/</link><dc:creator>Marcos Dione</dc:creator><description>&lt;p&gt;A month ago I revived my old-laptop-as-server I have at home. I don't do much in
it, just serve my photos, a map, provide a &lt;code&gt;ssh&lt;/code&gt; trampoline for me and some
friends and not much more. This time I decided to tackle one of the most
annoying problems I had with it: That closing the lid led to the system to
suspend.&lt;/p&gt;
&lt;p&gt;Now, the setup in that computer has evolved through some years, so a lot of
cruft was left on it. For instance, at some point I solved the problem by
installing a desktop and telling it not to suspend the machine, mostly because
that's how I configure my current laptop. That, of course,
was a cannon-for-killing-flies solution, but it worked, so I could focus in
other things. Also, a lot of power-related packages were installed, assuming the
were really needed for supporting everything I might ever wanted to do about
power. This is the story on how I removed them all, why, and how I solved the
lid problem... twice.&lt;/p&gt;
&lt;p&gt;First thing to go were the desktop packages, mostly because the screen in that
laptop has been dead for more than a year now, and because its new space in the
house is a small shelf in my wooden desktop. Then I reviewed the power-related
packages one by one and decided whether I needed it or not. This is more or less
what I found:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;acpi-fakekey&lt;/code&gt;: This package has a tool for injecting fake ACPI keystrokes in
  the input system. Not really needed.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;acpi-support&lt;/code&gt;: It has a lot of scripts that can be run when some ACPI events
  occur. For instance, lid closing, battery/AC status, but also things like
  responding to power and even 'multimedia' keys. Nice, but not needed in my
  case; the lid is going to be closed all the time anyways.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;laptop-mode-tools&lt;/code&gt;: Tools for saving power in your laptop. Not needed either,
  the server is going to be running all the time on AC (its battery also died
  some time ago).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;upower&lt;/code&gt;: D-Bus interface for power events. No desktop or anything else to
  listen to them. Gone.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pm-utils&lt;/code&gt;: Nice CLI scripts for suspending/hibernating your system. I always
  have them around in my laptop because sometimes the desktops don't work
  properly. No use in my server, but it's cruft left from when I used it as my
  laptop. Adieu.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Even then, closing the lid led to the system suspending. Who else could be there?
Well, there is one project who's being everywhere: &lt;code&gt;systemd&lt;/code&gt;. I'm not saying
this is bad, but it &lt;em&gt;is&lt;/em&gt; everywhere. Thing is, its login subsystem also handles
ACPI events. In the &lt;code&gt;/etc/systemd/logind.conf&lt;/code&gt; file you can read the following
lines:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="c1"&gt;#HandlePowerKey=poweroff&lt;/span&gt;
&lt;span class="c1"&gt;#HandleSuspendKey=suspend&lt;/span&gt;
&lt;span class="c1"&gt;#HandleHibernateKey=hibernate&lt;/span&gt;
&lt;span class="c1"&gt;#HandleLidSwitch=suspend&lt;/span&gt;
&lt;span class="c1"&gt;#HandleLidSwitchDocked=ignore&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;so I uncommented the 4th line and changed it so:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="na"&gt;HandleLidSwitch&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;ignore&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Here you can also configure how the inhibition of actions work:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="c1"&gt;#PowerKeyIgnoreInhibited=no&lt;/span&gt;
&lt;span class="c1"&gt;#SuspendKeyIgnoreInhibited=no&lt;/span&gt;
&lt;span class="c1"&gt;#HibernateKeyIgnoreInhibited=no&lt;/span&gt;
&lt;span class="c1"&gt;#LidSwitchIgnoreInhibited=yes&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Please check
&lt;a href="https://www.freedesktop.org/software/systemd/man/logind.conf.html"&gt;the config file's doc&lt;/a&gt;
if you plan to modify it.&lt;/p&gt;
&lt;p&gt;Not entirely unrelated, my main laptop also started suspending when I closed the
lid. I have it configured, through the desktop environment, to only turn off the
screen, because what use is the screen if it's facing the keyboard and touchpad :)
Somehow, these settings only recently started to be in effect, but a quick search
didn't gave any results on when things changed. Remembering what I did with the
server, I just changed that config file to:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="na"&gt;HandlePowerKey&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;ignore&lt;/span&gt;
&lt;span class="na"&gt;HandleSuspendKey&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;ignore&lt;/span&gt;
&lt;span class="na"&gt;HandleHibernateKey&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;ignore&lt;/span&gt;
&lt;span class="na"&gt;HandleLidSwitch&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;ignore&lt;/span&gt;
&lt;span class="na"&gt;HandleLidSwitchDocked&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;ignore&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;That is, “let me configure this through the desktop, please”, and now I have my
old behavior back :)&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;PS&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;I&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;should&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;reading&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;more&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;about&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;`&lt;/span&gt;&lt;span class="n"&gt;systemd&lt;/span&gt;&lt;span class="err"&gt;`&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;good&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;starting&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;point&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;seems&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;be&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;all&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;links&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;its&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;home&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//freedesktop.org/wiki/Software/systemd/).&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;</description><category>acpi</category><category>sysadmin</category><category>systemd</category><guid>https://www.grulic.org.ar/~mdione/glob/posts/configuring-power-and-hardware-related-events/</guid><pubDate>Sun, 28 Aug 2016 15:34:56 GMT</pubDate></item></channel></rss>