Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 06-29-2012, 12:03 AM   #1
Registered: Mar 2012
Distribution: Slackware, CentOS, OpenBSD, FreeBSD
Posts: 462

Rep: Reputation: Disabled
acpid "xscreensaver-command -lock" not working until acpid is restarted

Sorry to bother everybody again, but I'm running into a mystery wrapped around a conundrum.

I believe this problem started with either yesterday (Wed Jun 27) or today's (Thu Jun 28) update (I'm running 64-current, did "slackpkg upgrade-all" ; "slackpkg install-new" and "slackpkg clean-system"). Again, I'm not 100% sure but it wasn't a problem during the Tue 26th update.

Anyways, here's the problem,
I've been using acpid to hibernate (when I push the power button) and lock my screen (when I close the lid on my laptop) for quite some time by setting my /etc/acpi/
# Default acpi script that takes an entry for all actions

set $@

case "$1" in
    case "$2" in
      power) /usr/sbin/pm-hibernate
      lid) /usr/bin/xscreensaver-command -lock
      *) logger "ACPI action $2 is not defined"
    logger "ACPI group $1 / action $2 is not defined"
Nothing appears to be wrong with my /etc/acpi/events/default file either (output of grep -v ^# /etc/acpi/events/default):
action=/etc/acpi/ %e
Unfortunately, despite all of this and reinstalling acpid (just in case my permissions were somehow messed up), my laptop still won't run "xscreensaver-command -lock" when I close the lid (and I also reinstalled xscreensaver). With the help of rworkman, we even confirmed that acpid is running with:
ps $(pidof acpid)
So even though the pm-hibernate command works with the power button (which is what I set it to), the "xscreensaver-command -lock" will not work with me closing the lid.


1. "xscreensaver-command -lock" works fine on its own (me typing it in a virtual terminal)
2. restarting "acpid" via /etc/rc.d/rc.acpid restart DOES make the lid-closing method for "xscreensaver-command -lock" work successfully

I don't understand why #2 happens because acpid is running, started up by rc.M (I don't have a /proc/apm file either) and the power button for hibernate works. After all, if it was running and working successfully before without me changing anything, why would restarting it make it work?

The people of slackware's IRC channel on freenode said it may have to do with the events I've set, but as listed, the /etc/acpi/events/default file lists events=.* (and I've never touched the events folder) so I'm thinking it should pick up all events even if they have no command or action set to them.

Last edited by TommyC7; 06-29-2012 at 12:10 AM.
Old 06-30-2012, 03:40 AM   #2
Registered: Mar 2012
Distribution: Slackware, CentOS, OpenBSD, FreeBSD
Posts: 462

Original Poster
Rep: Reputation: Disabled
Ok, I believe I've found what is happening (I haven't looked into the technical details, so I'll just go based off of the error messages and such).

First off, when I added in "&> /someplace/screensaver.log" to the xscreensaver-command portion in /etc/acpi/, I got:
xscreensaver-command: warning: $DISPLAY is not set: defaulting to ":0.0".
No protocol specified
xscreensaver-command: can't open display :0.0
So now I had something I could finally Google. All the Google results were about xhost, xauth and such. I didn't look too deeply to see when /etc/profile is called, but I'm guessing it's loaded after acpid.

My reasoning for this is because when acpid is loaded, I get that message above. However, when I do check my environment variables for root, $DISPLAY is set to ":0.0" so I still pondered why it didn't load. But, as stated in my first post, I could use "xscreensaver-command -lock" successfully as root after logging in (and restarting acpid would also make it work successfully). Hibernation and rebooting of course would cause the same error message to pop up again.

Eventually I came to believe that the $DISPLAY variable is set after acpid is loaded, although I have no idea why it was working before until I saw a .Xauthority file in /root. No idea why it wasn't working now, but after switching to a different user to run the "xscreensaver-command -lock" command in /etc/acpi/, it was working again. I hope this helps other people, and if I'm wrong about the whole /etc/profile thing, then I'm out of ideas, folks.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ACPID scripts only work when restart acpid from terminal jasonkhonlaw Linux - Laptop and Netbook 2 07-31-2012 11:37 AM
[SOLVED] acpid "Solution: please add acpid to /etc/runlevel.conf to start before hal/dbus" linus72 Linux - General 2 10-04-2009 07:40 PM
"Lock Screen" is not working on Fedora Core 5 jialin Fedora 2 04-05-2008 08:37 AM
No lines within '/var/log/acpid', and then server restarted guarriman Linux - Hardware 1 07-20-2006 04:14 PM
acpid working? viniosity Linux - Laptop and Netbook 0 09-18-2005 05:41 PM > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:55 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration