LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Password
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).

Notices

Reply
 
LinkBack Search this Thread
Old 11-07-2008, 10:37 PM   #1
xj25vm
Member
 
Registered: Jun 2008
Posts: 127

Rep: Reputation: 4
xlock password on suspend-to-ram problem / not working


Slackware 12.1, stock kernel 2.6.24.5-smp, XOrg server 1.4.0.90.

I am using acpi scripts in /etc/acpi/events and /etc/acpi/actions to send the laptop to suspend-to-ram when closing the lid. Everything is working fine, suspend/resume has been working for a while now.

I am trying to modify the script to lock the screen on suspend, so that I am prompted for a password on resume. The script works fine if I run from command line, both as 'su root' or as myself (regular user). However, it fails to lock the screen when triggered by the lid (but everything else in the script runs fine - i.e. the machine goes to sleep and wakes up).

Any ideas as to what would be causing it? I have tried running xlock in the script as 'sudo -u user_name xlock' and 'su user_name -c xlock' to no avail (user_name being the currently logged in user). If I redirect error output from script to a file - I get: 'xlock: unable to open display'. I have tried placing the xlock line before the actual stand-by point in the script and after - still no change.

Any hints appreciated. Here are my actions and events scripts. Just in case you are wondering, the chvt statements were necessary to move through consoles after resume - otherwise the screen comes back with the lamp switched off:

#This is the 'lid' script, in /etc/acpi/events:
# Optionally you can specify the placeholder %e. It will pass
# through the whole kernel event message to the program you've
# specified.

event=button/lid.*
action=/etc/acpi/actions/s2ram.sh %e




#This is the s2ram.sh script, in /etc/acpi/actions

#!/bin/sh

# Suspend to ram when the lid is closed

# First, let's make sure we're not shutting down or rebooting
if [ ! -e /etc/powerdown ]; then
sync ; sync # Just in case...
echo -n mem > /sys/power/state
chvt 7
chvt 2
xlock
fi
 
Old 10-20-2011, 06:06 AM   #2
xj25vm
Member
 
Registered: Jun 2008
Posts: 127

Original Poster
Rep: Reputation: 4
I needed to use the following line, instead of just "xlock"

Code:
su username -c "DISPLAY=:0.0 xlock"
and it worked.

In case it helps somebody else
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Xlock closes with no password needed after suspend to ram dive Slackware 10 09-27-2008 01:28 PM
Suspend 2 Ram Is not working. VTO Linux - Hardware 0 03-10-2008 03:44 AM
Suspend to RAM working, but console is dead bence8810 Linux - Laptop and Netbook 4 01-25-2007 12:15 PM
Suspend to RAM (S3) not working BCarey Linux - Laptop and Netbook 10 11-21-2006 06:18 PM
dell e1505 - how do i get suspend 2 ram working? mistamaila Linux - Laptop and Netbook 11 09-02-2006 03:15 AM


All times are GMT -5. The time now is 08:27 PM.

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