Laptop does not suspend when lid is closed

(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)
  6. # chmod 755 /etc/acpi/local/lid.sh.post (so it works even when power management is handled under the logged-in user instead of root)

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.


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


I had the same problem with Linux Mint Cinnamon 17.2. Since it's based on Ubuntu 14.04 I expect many things are much the same.

Having searched the suspend on lid closed problem I found myself here and up until then, the best I had come up with was to manually suspend the first time after a boot and afterwards the closed lid would suspend. Having read through these posts and comments I believe I've resolved the issue.

Here's what I did:

  1. Opened a terminal session and, using nano instead of vim, typed;

    sudo nano /etc/systemd/logind.conf
    
  2. As suggested, I removed the # before HandleLidSwitch=suspend. Then I saved it.

  3. Then I typed...

    mkdir /etc/acpi/local
    sudo nano /etc/acpi/local/lid.sh.post
    

    ...and copied and pasted the next 5 lines previously posted

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

    NOTE: To make this work I added the sudo to the line /usr/sbin/pm-suspend. Otherwise it would not run.

  4. Finally I saved it and as previously posted, typed; the logged-in user instead of root, typed;

    sudo chmod 755 /etc/acpi/local/lid.sh.post
    

Unfortunately, this did not work. I did some tests, however, on the commands in the script and they did work so I decided something else wasn't triggering them. Further down the posts I came across a reference to a Gnome power manager bug:

https://bugs.launchpad.net/ubuntu/+source/upower/+bug/863834

Particularly interesting was a post by Michael Backhaus on 2012-06-09 in which he wrote:

/etc/acpi/events/lidbtn triggers /etc/acpi/lid.sh which triggers /etc/acpi/local/lid.sh.post.

Following this was an almost identical version of the above bash script, lid.sh.post.

In this version of Mint, /etc/acpi/events/lidbtn and /etc/acpi/lid.sh did not exist. However, /etc/acpi/events/powerbtn and /etc/acpi/powerbtn.sh did. A look at "powerbtn" provided an answer

This is my work-around:

  1. To create a custom "lidbtn", typed;

    sudo nano /etc/acpi/events/powerbtn
    

    and modified it to like this for lidbtn;

    # /etc/acpi/events/lidbtn
    # This is called when the user closes the lid and calls
    # /etc/acpi/lidbtn.sh for further processing.
    
    # Optionally you can specify the placeholder %e. It will pass
    # through the whole kernel event message to the program you've
    # specified.
    
    # We need to react on "button lid.*" and "button/lid.*" because
    # of kernel changes.
    
    event=button[ /]lid
    action=/etc/acpi/lidbtn.sh
    
  2. I saved it. Then copied /etc/acpi/local/lid.sh.post to /etc/acpi/ and renamed it lidbtn.sh.

I rebooted and now closing the lid always suspends my laptop. However, I have to manually wake it up when opening the lid. Next project to work on.

ADDENDUM: I should add that I do not have a second monitor. For me, the problem was that suspend simply did not work when the lid was closed.