Re: pm-suspend works, but just plain closing the lid to suspend usually doesn't.
1. Make sure pm-suspend is working on your system. You may also need to sudo first. Some services can prevent a system from going to Suspend.
2. There's also the possibility your machine is using another event name for the lid.
Close and reopen the lid whilst running in a x-terminal:
This will capture the actual string of acpi events passed from your hardware when you close the lid and reopen it. The string generated needs to be passed to the event=XXX in the lid file.
Re: pm-suspend works, but just plain closing the lid to suspend usually doesn't.
It is very strange.
Only if I open a xterm and execute the command you provided:
and then close the lid, the computer suspends, and acpi_listen command returns:
Code:
clara@clara1:~$ acpi_listen
button/lid C154 00000080 00000001
video C099 00000080 00000000
thermal_zone TZ1 00000081 00000000
thermal_zone TZ3 00000081 00000000
button/lid C154 00000080 00000002
pm_suspend has always worked on my computer (of course, using sudo), also the suspension button in the upper panel.
So the conclusion is, the workaround for suspension when close lid, works only if I execute the command acpi_listen, but no in other case ???
Re: pm-suspend works, but just plain closing the lid to suspend usually doesn't.
Please understand the point. The reason to use acpi_listen is to get the trigger for the event.
In your case it is:
CLOSE
Code:
button/lid C154 00000080 00000001
and OPEN
Code:
button/lid C154 00000080 00000002
So put in the file /etc/acpi/events/lid
Code:
event=button/lid C154 00000080 00000001
action=/usr/sbin/pm-suspend
Re: pm-suspend works, but just plain closing the lid to suspend usually doesn't.
Okay, I have done as you say:
/etc/acpi/events/lid file :
Code:
event=button/lid C154 00000080 00000001
action=/usr/sbin/pm-suspend
I try to run the file but I obtain:
clara@clara1:/etc/acpi/events$ lid
El programa «lid» puede encontrarse en los siguientes paquetes:
* id-utils
* libuser
Intente: sudo apt-get install <paquete seleccionado>
Translation:
Program lid can be found in the following packages:
* id-utils
* libuser
Try: sudo apt-get install "selected package"
What am I doing wrong?, lid file has to be a bash script and beginning by #! /bin/bash?
As it is clear, lid file is executable by anybody in /etc/acpi/events/:
Code:
-rwxr-xr-x 1 root root 68 dic 18 13:53 lid
Tankyou for your patience
Re: pm-suspend works, but just plain closing the lid to suspend usually doesn't.
Why are you running the file? It should have +x attributes but you don't run the file.
Leave the file in the /etc/acpi/events directory. The acpid/service will run the action if it detects the lid event.
Re: pm-suspend works, but just plain closing the lid to suspend usually doesn't.
Okay, now is working, and certainly it is not necessary to put the #! /bin/bash "title" in the beginning of the file or to manually run the file. For me the problem is solved.
I was trying to run the file because when close lid before it wasn't recognized, and computer didn't suspend. I suppose it was for the "LID close" order insted of the good one for me "C154 00000080 00000001".
Thankyou for your help.
I dare to ask to the original poster to mark the thread as "solved", since the workaround propossed by os2 works.