Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm a new Ubuntu 13.10 user. Closing the lid of my laptop does not result in the computer entering suspend mode, meaning each time I close my lid without manually suspending the computer the battery dies.

The proper settings are set in Power Management -- suspend the laptop on lid close for both AC and DC, but these do not have an effect on actual behavior.

It looks like this is a common problem for many users as far back as Ubuntu 11 -- the only solution I could find is the below. However, as a new linux user I'm not aware of how to actually execute the instructions. If someone could provide additional detail that would be tremendously helpful.

Thanks in advance.

/etc/acpi/events/lidbtn triggers /etc/acpi/lid.sh which triggers /etc/acpi/local/lid.sh.post at the end of the script. /etc/acpi/local/* allows you to add your own config (e.g. required for wmii).

generate /etc/acpi/local/lid.sh.post make it executable and add:

#!/bin/bash grep -q closed /proc/acpi/button/lid/*/state if [ $? = 0 ] then /usr/sbin/pm-suspend fi

wmii will now go to suspend mode when closing the lid. It'll automatically wake up when opening the lid.

share|improve this question

3 Answers 3

up vote 3 down vote accepted

(Note that # before a command indicates that it should be run by the superuser, so replace the # with sudo.)

Open logind.conf as root: # vim /etc/systemd/logind.conf and remove the # before HandleLidSwitch=suspend. You can also change the option suspend to hibernate or poweroff

Fix from Launchpad Bug #863834, comment #30:

  1. Open a terminal: Ctrl + Alt + t
  2. # mkdir /etc/acpi/local
  3. # vim /etc/acpi/local/lid.sh.post
  4. Copy this short script:

     #!/bin/bash
     if grep -q closed /proc/acpi/button/lid/*/state
     then
         /usr/sbin/pm-suspend
     fi
    

    ... and paste it into vim by typing: "+p

  5. Save by typing ZZ (in capitals)
share|improve this answer
    
ps: if you are not sure how to use vim then replace it with gedit and sudo with gksu –  Meow Dec 25 '13 at 3:41
    
Meow, thanks for the quick response. Unfortunately I'm still not 100% clear. Do I enter these commands in terminal? When I type 'sudo vim /etc/systemd/logind.conf', I get the error 'sudo: vim: command not found'. I'm also on a PC running linux, if that makes a difference. –  Kyle Chadha Dec 25 '13 at 5:38
    
use sudo gedit /etc/systemd/logind.conf if vim is not installed & yes you need to enter them in the terminal –  Meow Dec 25 '13 at 10:21
    
Hrm still does not work. No change on lid close after restart. '#HandlePowerKey=poweroff #HandleSuspendKey=suspend #HandleHibernateKey=hibernate HandleLidSwitch=suspend' –  Kyle Chadha Dec 25 '13 at 16:40
    
then try this install "dconf-tools" and then type dconf editor in dash or "dconf-editor" in terminal now navigate "org >> gnome >> settings-daemon >> plugins >> power" change lid-close ac action and dc action to suspend("sudo apt-get install dconf-tools" to install it in the first plase) –  Meow Dec 25 '13 at 16:54

In response to this post, I have had the same problem with this on my Toshiba Satellite a305-s6902 (which I purchased solely to practice on Linux), and found that this worked for me:

sudo vim /etc/systemd/logind.conf

then as above, remove the # before HandleLidSwitch=suspend and save (ESC :wq).

HOWEVER ---> I find that I must put the computer into suspend manually FIRST, and after every reboot to engage the trigger. I do not know why, but this has worked consistently for me.

share|improve this answer

I've solve it by uncommenting variable LID_SLEEP=true from /etc/default/acpi-support.

share|improve this answer

Your Answer

 
discard

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.