[SOLVED] unwanted systemstart when opening lid

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Matumi
Level 1
Level 1
Posts: 24
Joined: Tue May 25, 2021 8:52 am
Location: Germany

[SOLVED] unwanted systemstart when opening lid

Post by Matumi »

Hey!

I was surprised that after installing Mint 20.1 it does not seem to offer hibernation as an option.
However, with some help I managed to get hibernation working.

My Problem: When I put my notebook to hibernation it always automatically starts the system again when opening the lid. Even if the lid is just moved the tiniest bit, the system starts.

I don't want that. I don't find it useful and it can easily happen accidentally when transporting the notebook - and then it discharges the battery for no reason.

In the energy settings I found an easy way to tell the system, not to do anything when the lid is closed. But there seems to be no way to tell the system, not to do anything when it is opened.

Does anyone know a way?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
t42
Level 11
Level 11
Posts: 3742
Joined: Mon Jan 20, 2014 6:48 pm

Re: unwanted systemstart when opening lid

Post by t42 »

You can find the wakeup device with acpitool
sudo apt install acpitool

This will show wakeup capable devices:

Code: Select all

acpitool -w
This will toggle wakeup capable device x (note capital W) :

Code: Select all

sudo acpitool -W x
example:

Code: Select all

acpitool -w
   Device	S-state	  Status   Sysfs node
  ---------------------------------------
 1. SBAZ	  S4	*disabled  pci:0000:00:14.2
------
17. LID	  S3	*enabled   platform:PNP0C0D:00

sudo acpitool -W 17
 Changed status for wakeup device #17 (LID)
After each reboot you need to repeat sudo acpitool -W x command or to implement boot script or service.
-=t42=-
Matumi
Level 1
Level 1
Posts: 24
Joined: Tue May 25, 2021 8:52 am
Location: Germany

Re: unwanted systemstart when opening lid

Post by Matumi »

Wow, that works so far! Very cool! Thanks a lot!

If I understand you right, there is a way to make this permanent!?

How does it work to implement a boot script or service?
t42
Level 11
Level 11
Posts: 3742
Joined: Mon Jan 20, 2014 6:48 pm

Re: unwanted systemstart when opening lid

Post by t42 »

Hot to create a service
Create a text file usb-wakeup.service here: /etc/systemd/system/usb-wakeup.service
example:

Code: Select all

[Unit]
Description=Disable wakeup events

[Service]
ExecStart=/bin/bash -c "echo UHC7 >> /proc/acpi/wakeup"
Type=oneshot

[Install]
WantedBy=multi-user.target
Change expressions inside double-quotes (here it is UHC7) to what is needed and save the file.
Then execute terminal commands

Code: Select all

sudo systemctl enable usb-wakeup.service
sudo systemctl start usb-wakeup.service
reboot
-=t42=-
Matumi
Level 1
Level 1
Posts: 24
Joined: Tue May 25, 2021 8:52 am
Location: Germany

Re: unwanted systemstart when opening lid

Post by Matumi »

Change expressions inside double-quotes (here it is UHC7) to what is needed and save the file.

I feel a bit stupid asking this question, but how do I know what is needed?
I have no idea what is supposed to be written there in my case. Where can I find out?
t42
Level 11
Level 11
Posts: 3742
Joined: Mon Jan 20, 2014 6:48 pm

Re: unwanted systemstart when opening lid

Post by t42 »

Matumi wrote: Mon Jun 21, 2021 4:49 am Where can I find out?
Here:
Matumi wrote: Mon May 31, 2021 5:15 am Wow, that works so far!
If you have the working command sudo acpitool -W [number] use the device name for that number from acpitool -w command and insert it in this expression "echo [devcie name here] >> /proc/acpi/wakeup"
-=t42=-
Matumi
Level 1
Level 1
Posts: 24
Joined: Tue May 25, 2021 8:52 am
Location: Germany

Re: unwanted systemstart when opening lid

Post by Matumi »

Aah!! So I knew more than I thought!

The command acpitool -w shows me the following information:

Code: Select all

  Device	S-state	  Status   Sysfs node
  ---------------------------------------
  1. LID	  S4	*disabled  platform:PNP0C0D:00
  2. SLPB	  S3	*enabled   platform:PNP0C0E:00
  3. IGBE	  S4	*enabled   pci:0000:00:19.0
  4. EXP2	  S4	*enabled   pci:0000:00:1c.1
  5. XHCI	  S3	*enabled   pci:0000:00:14.0
  6. EHC1	  S3	*enabled   pci:0000:00:1d.0
So the device name would judt be LID in my case - right?
t42
Level 11
Level 11
Posts: 3742
Joined: Mon Jan 20, 2014 6:48 pm

Re: unwanted systemstart when opening lid

Post by t42 »

It's right.
-=t42=-
Matumi
Level 1
Level 1
Posts: 24
Joined: Tue May 25, 2021 8:52 am
Location: Germany

Re: unwanted systemstart when opening lid

Post by Matumi »

I did all that. The effect is indeed that the system does not start when I open the lid.

For some reason now hibernation does not work properly. It is still offered as an option, but it seems to have the same effect as shutting down.
Matumi
Level 1
Level 1
Posts: 24
Joined: Tue May 25, 2021 8:52 am
Location: Germany

Re: unwanted systemstart when opening lid

Post by Matumi »

This might not be connected at all.
I am also having issues with the mint grub. At the moment only the mx grub is working.
t42
Level 11
Level 11
Posts: 3742
Joined: Mon Jan 20, 2014 6:48 pm

Re: unwanted systemstart when opening lid

Post by t42 »

Matumi wrote: Tue Jun 22, 2021 7:11 pm For some reason now hibernation does not work properly. It is still offered as an option, but it seems to have the same effect as shutting down.
Are you using the Power button to wake up from hibernation?
Before analyzing other things, make sure the size of a swap file is sufficient. Check it through System Monitor -> Resources or by the swapon --show command.
However, with some help I managed to get hibernation working.
It seems you are back to square one :)
-=t42=-
Matumi
Level 1
Level 1
Posts: 24
Joined: Tue May 25, 2021 8:52 am
Location: Germany

Re: unwanted systemstart when opening lid

Post by Matumi »

Hibernation not working any more was indeed unconnected to creating a service for the lid issue.

I repaired the mint grub and now hibernation works again and all the things connected to opening the lid are exactly the way I wanted them:
I can go to hibernation by choosing it in the menu or by closing the lid. When I open the lid nothing happens. When I press the button the computer wakes up.

So thanks a lot for all the advice!!
(So relieving when things finally just work!)
Locked

Return to “Beginner Questions”