How to disable S4 s-state at boot time?

@lospompadores
Could You please help me to create and enable service to take may Manjaro Cinnamon PC to sleepsuspend (to ram)? All was good till nV driv this is my outpuers updating about a 10 days ago :frowning:
When i type cat /proc/acpi/wakeup this is my output:

Device S-state Status Sysfs node
SBAZ S4 *disabled
PS2K S3 *disabled
PS2M S3 *disabled
P0PC S4 *disabled pci:0000:00:14.4
GEC S4 *disabled
UHC1 S4 *enabled pci:0000:00:12.0
UHC2 S4 *enabled pci:0000:00:12.2
USB3 S4 *enabled pci:0000:00:13.0
UHC4 S4 *enabled pci:0000:00:13.2
USB5 S4 *enabled pci:0000:00:16.0
UHC6 S4 *enabled pci:0000:00:16.2
UHC7 S4 *enabled pci:0000:00:14.5
PE20 S4 *disabled
PE21 S4 *disabled
PE22 S4 *disabled
PE23 S4 *disabled
PC02 S4 *enabled pci:0000:00:02.0
PC03 S4 *disabled
PC04 S4 *enabled pci:0000:00:04.0
PC05 S4 *enabled pci:0000:00:05.0
PC06 S4 *disabled
PC07 S4 *disabled
PC09 S4 *enabled pci:0000:00:09.0
GBE S4 *disabled pci:0000:04:00.0
PC0A S4 *disabled
PC0B S4 *disabled
PC0C S4 *disabled
PC0D S4 *disabled
PWRB S3 *enabled platform:PNP0C0C:00

When i set processes from UHC1->UHC7 to state *disabled with sudo sh -c "echo UHC1 > /proc/acpi/wakeup" my PC went to sleep wery well and no wakening but i am a noob and donā€™t know how to do that but automation when PC starts.

Any HELP?

I donā€™t know whether Cinnamon has an ā€œautostartā€ feature that allows you to start things at login, but I presume it does. And in that case, all youā€™d need to put in there would be a small shell scriptā€¦ :arrow_down:

#!/bin/sh

for i in {1..7}
do
    sudo sh -c "echo UHC{i} > /proc/acpi/wakeup"
done

Of course, you would need to make the script executable, and you would need to set up /etc/sudoers so that the above script can be executed without prompting for a password. Seeā€¦ :arrow_down:

man sudoers

Disclaimer: I donā€™t use sleep/suspend/hibernation, so I trust that the command you gave is correct and that it must be sent to /proc/acpi/wakeup for each of the UHC values ā”€ I donā€™t know about that because as I said, I donā€™t use it.

I am only trying to help you in automating the process, so if the script breaks your system, then you get to keep both pieces. :stuck_out_tongue:

Hi.
Right now i have tried Your script in this form:

#!/bin/sh

for i in (1 2 4 6 7)
do
sudo sh -c "echo UHC{i} > /proc/acpi/wakeup"
done



but this is an output:

[ng@ng-linuxpc Skripte]$ cat /proc/acpi/wakeup
Device	S-state	  Status   Sysfs node
SBAZ	  S4	*disabled
PS2K	  S3	*disabled
PS2M	  S3	*disabled
P0PC	  S4	*disabled  pci:0000:00:14.4
GEC	  S4	*disabled
UHC1	  S4	*enabled   pci:0000:00:12.0
UHC2	  S4	*enabled   pci:0000:00:12.2
USB3	  S4	*enabled   pci:0000:00:13.0
UHC4	  S4	*enabled   pci:0000:00:13.2
USB5	  S4	*enabled   pci:0000:00:16.0
UHC6	  S4	*enabled   pci:0000:00:16.2
UHC7	  S4	*enabled   pci:0000:00:14.5
... ... ... ... ... ... ...

and this is not working but i donā€™t know to write script alone :frowning:

Please help to disable

UHC1	  S4	*enabled   pci:0000:00:12.0
UHC2	  S4	*enabled   pci:0000:00:12.2
USB3	  S4	*enabled   pci:0000:00:13.0
UHC4	  S4	*enabled   pci:0000:00:13.2
USB5	  S4	*enabled   pci:0000:00:16.0
UHC6	  S4	*enabled   pci:0000:00:16.2
UHC7	  S4	*enabled   pci:0000:00:14.5

TNX

Beware, this is very dangerous.

Use the command:

sudo visudo

At the bottom add:

YourUsername ALL=(ALL) NOPASSWD:ALL

Save it, and quit :grinning:

Normally, I would say run the script at boot with your rc.local file, but I donā€™t think arch systems have this. I canā€™t find it on my KDE system anyway.

Another way, and probably safer, as it does not require messing with sudoers file is to create the script, without sudo and make it run as a systemd-unit:

https://wiki.archlinux.org/title/Systemd#Writing_unit_files

Example of such a use:

3 Likes

Donā€™t use ellipses. :arrow_down:

for i in 1 2 4 6 7

It is, yes, but what the OP is asking about is very unusual, and I trust they will be responsible and properly inform themselves.


That was my initial thought as well, but as Iā€™ve never written a systemd service file, I would have to sufficiently research this subject myself before giving the OP any advice on how to do it. :wink:

Hello.
I found the time only now to try the ellipse-free script again and everything is fine when running, but the output for UHC1 ā€¦ UHC7 is still the same *enabled :frowning:

So no one to help and write a working script?!?!
(I donā€™t know how to write that otherwise I would do it)
:frowning:

@neogeo

Can you explain, what you are trying to accomplish?

I see you want to disable S4, what is hibernation (sleep-to-disk)ā€¦

Isnā€™t it easier to edit this file: /etc/systemd/sleep.conf and add there:

AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no

Just an idea :man_shrugging:

2 Likes

I am trying to state *disable UHC1ā€¦UHC7 and USB1ā€¦USB3 ports because when state *ensbled my PC wonā€™t Suspend (to RAM).
Now iā€™m gonna try Your advice and post a result.

@megavolt
TNX TNX TNX
The sleep state of my computer now works like a charm thanks to your selfless help!!!

@neogeo Glad that it works. I changed the topic name and marked my post as solution. Feel free to change it if you disagree. :wink:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.