Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm in fluxbox on Arch on a Macbook 5,1. New to linux. I'm trying to get Arch to suspend when I close my laptop. Lately I've just been using sudo pm-suspend.

I installed slimlock, and inserted

    case $3 in
            #echo "LID switched!">/dev/tty5
         /usr/sbin/pm-suspend &
         DISPLAY=:0.0 su -c - username /usr/bin/slimlock

in my /etc/acpi/handler.sh, which I read to do here, but it doesn't work. I tried installing xscreensaver, but I get a weird error:

error: perl-lwp-mediatypes: signature from "Justin Davis (juster) <jrcd83@gmail.com>" is unknown trust
error: failed to commit transaction (invalid or corrupted package (PGP signature))
share|improve this question
Did you try pacman -Syy before trying to install xscreensaver? And what laptop do you have? – mtahmed Sep 4 '12 at 9:35
yup didn't help – Jack Stewart Sep 4 '12 at 18:04

You will need to install archlinux-keyring package to have all needed public key.

pacman -S archlinux-keyring

More information here.

Also you should lock first, suspend later:

    case $3 in
            #echo "LID switched!">/dev/tty5
            DISPLAY=:0.0 su -c - username /usr/bin/slimlock &
share|improve this answer
How does this approach differ from configuring lid off/on in /etc/systemd/logind.conf? Do we need to configure both, or are they mutually exclusive? – Lucas Jan 1 at 8:43

Follow this: https://wiki.archlinux.org/index.php/Pacman

Being new to Linux and going directly to Arch is not a good idea. Take a look at Fedora/Ubuntu or Debian.

Ps: You need to generate the PGP keys for arch linux so you can add them.

share|improve this answer
But I was under the impression that installing (or updating pacman) did that automatically... – mtahmed Sep 4 '12 at 18:53
thanks, this helped getting xscreensaver. but that script still isn't running anything on lid close – Jack Stewart Sep 4 '12 at 19:04
@mtahmed Actually it depends on the installation you are using. Last time I installed using the new Arch version, I didn't need to do anything. If you do, you usually need; pacman-key --init ; pacman-key --populate archlinux. JackStewart: I remember having the same problem with XFCE4. I The only way for me to close the lid was telling XFCE4 to suspend and not hibernate. Maybe a hint, perhaps you tried laptop-tools from the repo? wiki.archlinux.org/index.php/Laptop_Mode_Tools – Ephexeve Sep 11 '12 at 10:14

I understand this question is a little old, now the easiest way to do this is with systemd.

Use systemd-logind for this. see man logind.conf.

With HandleLidSwitch option you can tell it what you want it to do when lid closes.


The options can be one of ,

  • ignore
  • poweroff
  • reboot
  • halt
  • kexec
  • suspend
  • hibernate
  • hybrid-sleep
  • lock
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.