Can't change sleep state, permission denied - Am I even reading this right?

I’m running Fedora 42 KDE on my 2015 MacBook Air, and it’s perfect other than one problem: if it stays asleep on battery for more than 24 hours, the system thinks the battery died and flashes the “charge now” icon on screen. When I plug it in, it fresh boots to the exact same level of battery it had when put to sleep.

MacOS drains more battery while asleep, so I think Linux is sleeping “too deep” if that’s even a thing.

“cat /sys/power/mem_sleep” returns “s2idle [deep]”

If I understand what I’m reading, this means it’s starting with s2idle and transitioning to deep sleep at some point.

So I have two options: change this to to s2idle [shallow] or just remove the deep/shallow part altogether and set it as just s2idle. Right?

Problem is, when I run “sudo echo shallow > /sys/power/mem_sleep” terminal says Permission Denied.

How the freak do I change my sleep state??

echo 's2idle'| sudo tee /sys/power/mem_sleep
or sudo bash -c "echo 's2idle' > /sys/power/mem_sleep”

Doing sudo echo blah > file sudo applies to the echo command but not to the redirect writing to the file.

edit fixed

I tried both and echo shallow | sudo tee /sys/power/mem_sleep returns “invalid argument” and sudo bash -c "echo shallow > /sys/power/mem_sleep” just makes my terminal show a > character where the text entry goes and nothing actually happens.

Sorry about that ..
your options are s2idle or deep, I fixed the original post.

If I understand what I’m reading, this means it’s starting with s2idle and transitioning to deep sleep at some point.

That controls what sleep state you’re using. System Sleep States — The Linux Kernel documentation has more details.

Oh I see, the file shows the states supported by the system, and the brackets around [deep] means that’s the current mode yeah?

1 Like

Affirmative

1 Like

I think it is more like MacOS is ‘always listening’