7

Thinkpad T450 running Ubuntu 17.10 which was clean-installed (not upgraded) some weeks back. I frequently moved from room to room and like the laptop to go to sleep when I close the lid. It seems to never do this, staying awake all the time. I have to hold down the power button in the indicator and choose the pause icon to suspend it. Previous releases of Ubuntu used to "Just Work".

I have tried toggling the option in Tweaks to ensure it is set to suspend on lid close, but this makes no difference. Is this a bug or expected behaviour?

  • 3
    If I'm reading your question correctly, the suspend action works properly from the power button (you can also press the 'alt' key to get the pause icon) but not when activated by the laptop lid. Can you run tweak (perhaps sudo apt install gnome-tweak-tool), check in the 'power' section and check that the ability to suspend on lid is turned on? – Charles Green Dec 12 '17 at 18:15
  • Probably a bug, but also probably can be worked around, would that be an acceptable answer to you? – Jacob Vlijm Dec 12 '17 at 18:22
  • As already mentioned in the question, I have already checked in the tweaks tool. – popey Dec 12 '17 at 19:43
  • I'd like to understand why this doesn't work, and what can be done to make it work. – popey Dec 12 '17 at 19:49
  • 1
    What's the output of: gsettings get org.gnome.settings-daemon.plugins.power lid-close-ac-action & gsettings get org.gnome.settings-daemon.plugins.power lid-close-battery-action ? – Fabby Dec 14 '17 at 20:41
8

Turns out we were all wrong. The magnet which triggers the lid sensor had come away inside the laptop. I confirmed this by holding a fridge magnet up to the camera. As soon as I did that, the laptop suspended fine. So I figured there's a magnet in the base. There was, but it was floating around (clinging to the battery) inside the machine. I put it back in place and it's now working.

enter image description here

6
+50

We can catch the lid open/close events and could bind scripts to them by using acpid - Advanced Configuration and Power Interface event daemon.

  • In attempt to check whether this suggestion works I've installed Ubuntu 17.10 on my DELL Vostro 3350. Then I've used dconf-editor to disable the lid close action. But unfortunately I can't disable this action... So I just hope this could help you.

1. Catch the events. Execute one of the next commands, then close and open the lid: acpi_listen or netcat -U /var/run/acpid.socket. Here is an example output:

$ acpi_listen
button/lid LID close
button/lid LID open

2. Configure acpid to recognize the events triggered when the device mode is changed. Create the following files (don't forgot to use the actual events from the above step):

  • /etc/acpi/events/lid-close:

    # /etc/acpi/events/lid-close 
    # This is called when the lid is closed
    event=button/lid LID close
    action=/etc/acpi/lid-actions.sh 1
    
  • /etc/acpi/events/lid-open:

    # /etc/acpi/events/lid-open
    # This is called when the lid is open
    event=button/lid LID open
    action=/etc/acpi/lid-actions.sh 0
    

3. Restart acpid so it can re-read the event filters, including the ones we just added:

sudo systemctl restart acpid.service

4. Create the script /etc/acpi/lid-actions.sh (and make it executable) that will suspend the laptop when the lid is close 1. I don't have idea what action could be useful when the lid is going to be open 0, so these lines are commented.

#!/bin/sh
if [ "${1}" -eq 1 ]; then systemctl suspend  # Lid is close
#elif [ "${1}" -eq 0 ]; then                 # Lid is open
fi

References:

  • acpi_listen returns nothing when I close the lid or open it. – popey Dec 17 '17 at 21:56
  • Hi. @popey, sorry to hear that. IMO, It looks like some kernel module is not enabled. Does acpi_listen work with the Fn keys or the power button? – pa4080 Dec 18 '17 at 19:06
  • Yes, acpi_listen reports when volume up/down or other function keys are pressed. – popey Dec 21 '17 at 0:03
  • @popey, please read the bottom of this answer. If I remember right, I also had uncaught events before install these packages - maybe the last one is enough. – pa4080 Dec 21 '17 at 8:44
0

The fastest way is by using the default settings manager

  1. Go to Settings>Power Management>When laptop lid closed
  2. Select "Suspend" instead of "Do nothing" and hit apply
  3. All done

P.s : why use ubuntu tweaks when there is a option to do it in default settings app

  • 2
    I'm not seeing what you describe in Ubuntu 17.10 running the Gnome desktop. Does this exist on the native(modified Gnome) Ubuntu DE? I see Settings>Power, but from there no reference to anything laptop lid related. – richbl Dec 18 '17 at 20:29
  • I'm sure the option was there(i'm using kbuntu rn so its hard to back up ubuntu claims ) sorry – Cruelplatypus67 Dec 22 '17 at 6:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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