Sunday, April 28, 2024
20
rated 0 times [  20] [ 0]  / answers: 1 / hits: 46373  / 1 Year ago, mon, january 2, 2023, 11:52:55

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.
#!/bin/bash

load=$(cat /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0/capacity)
min_load=20
if [ $load <= min_load ]; then
pm-suspend
fi

More From » power-management

 Answers
3

(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)


[#27830] Tuesday, January 3, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
peratingcit

Total Points: 253
Total Questions: 122
Total Answers: 94

Location: Botswana
Member since Sat, Jan 7, 2023
1 Year ago
;