[NCLUG] power button & lid actoins in Debian Jessie.

Bob Proulx bob at proulx.com
Wed Sep 17 13:11:04 MDT 2014


John Gilmore wrote:
> An old one - IBM thinkpad T43.

I love my T43.  And my T42 before it.  Although I upgraded to a T60 in
order to use a SATA SSD.  (The T43 is IDE only.)  But everything
worked great on the T42 and T43.

> "pm-hibernate" can't do anything, needs to be "sudo pm-hibernate" So
> usually I'll have to enter my password if I want to hibernate. Except
> I found a work-around.

To avoid needing a password tell sudo that you are allowed to run that
command without a password.  It is your laptop.  You are the only user
on the system, right?  If someone not you did grab your laptop
keyboard and triggered sudo pm-hibernate you really wouldn't care.  No
different than pressing Fn+hibernate.  And so there is no security
problem with allowing it without a password from the command line.

Create a /etc/sudoers.d/zz-local-sudoers file with:

  ALL     ALL=(ALL) NOPASSWD: \
  	/usr/sbin/pm-hibernate, \
  	/usr/sbin/pm-suspend

The above tells sudo that those commands can be used without a
password.  It won't ask you for a password for those anymore.

I suggest to create a file /etc/sudoers.d/zz-local-sudoers so that it
doesn't modify the /etc/sudoers and local changes won't need to be
merged in with future upgrades.  That file has been changing with
every release recently and needing to merge is a pain.  And zz because
you want it to sort last.  Last has higher priority than earlier and
you want this last to ensure that it is not overridden by other rules.

> As for which keys work how, I just did a little more testing, and:
> xev shows XF86Launch1 ("access IBM"), XF86Suspend, XF86Display, XF86Screensaver.
> 
> Volume buttons, power button, hibernate button, and search button
> don't register in xev or syslog, and also don't do anything.

Have you installed "tpb" (think pad buttons)?  If not install tpb.
Add yourself to the nvram group.  Log out and back in again for the
group change.  Then those buttons should work.

  apt-get install tpb
  less /usr/share/doc/tpb/README.Debian
  adduser jag nvram
  ...exit completely out...
  ...log back in again...
  id | grep --color nvram
  ...verify that you are in the nvram group...

That should enable the special ThinkPad keys.
  
> I don't see the lid button with xev, and the first thing that shows up
> in syslog on suspend is networkmanager saying it's suspending. (since
> I've modified the acpi scripts to log when called, it's not them.)

I configured these so many years ago that I have forgotten exactly how
everything works now.  But for me the lid switch triggers an acpi
event and action.  Look for those in /etc/acpi/*.  Personally I
configured GNOME to do nothing on lid close.  I prefer it that way.
Then I manually trigger sleep and hibernate explicitly when I want it
to sleep or hibernate.  Others like different things.

> In console mode, hibernate and suspend keys work! Yay! Immediate
> problem resolved, I can just switch to console before hibernating.

Yay!  A good workaround.

Bob


More information about the NCLUG mailing list