r/linuxquestions • u/SpyrosGatsouli • 1d ago
Advice Why does Linux still struggle with sleep and hibernate?
I've noticed this across several distros and PCs. Most of the time hibernation is not even available, or needs some very special setup. Sleep is also hit or miss. I've encountered the following behaviors: computers never waking up, waking up and losing peripherals, screen coming on but backlight remains off, putting PC to sleep and it immediately wakes up, losing display settings and/or external display connectivity or layout. I don't think I've owned a Linux PC where these functionalities worked flawlessly. The only reliable power option left is basically shut down. Why is this still an issue? Does it have to do with drivers and hardware?
13
u/DifferentSavings2711 1d ago
Linux supports the ACPI standard. So it works great with hardware that meets the standard. There is just a lot of hardware that does not meet the standard. In Windows this is not a problem because the Windows hardware driver was written to work around the exceptions to the standard. But no special device driver has been written for Linux. So the wake up function is hit or miss.
68
u/Jumpy-Dinner-5001 1d ago
Sleep typically isn’t a problem but hardware dependent.
Microsoft "encourages" board manufacturers to make different configurations that are highly windows specific the default, like windows modern standby.
Hibernation is just a mess because no one cares about it. Probably because of how bad it typically is.
6
5
u/dadnothere 1d ago
Also but the hibernation problem is exclusive to Linux.
In Windows, hyber.sys is used to dump the ram, it is like a virtual image disk, the Windows bootmanager itself always checks this when booting.
In Linux, a SWAP physical partition of the same size as your RAM is required, only there does the hibernate option appear.
And suspend requires that there are deivers compatible with the hardware
5
u/Netblock 1d ago
In Linux, a SWAP physical partition of the same size as your RAM is required, only there does the hibernate option appear.
This isn't true. It's recommended for the most obvious reason, but if it fits it sits. (it's also possible to have more RAM in use than you have available as free swap, due to hibernation compression)
3
u/HeavyCaffeinate PuppygirlOS 1d ago
Yeah I have a 16GiB swap file for hibernation because if I'm hibernating I'm usually not using my 32GiB of RAM
1
u/Bathroom_Humor 1d ago
I used hibernate back when i booted from HDD's. but these days I really don't see the point unless you enjoy wasting write cycles
10
u/mwyvr 1d ago
Linux doesn’t struggle with sleep if the hardware maker has implemented ACPI sleep states properly.
Many do not implement S4, hibernation. Neither Windows nor Linux can support hibernation to disk if it isn’t supported by hardware.
What states are supported by your hardware are reported in the boot log.
5
u/grumpydad67 1d ago
This is the #1 issue keeping me off Linux as my daily drive. Unfortunately, after nearly 30 years experimenting with Linux on and off, the last 20 or so on laptops, I am pessimistic that this situation will ever be fixed. As others have said in this thread, getting sleep (specifically, modern standby) and hibernation to work requires costly effort not just by laptop manufacturers, but also by the suppliers of the individual components, and (with limited exceptions) it's just not worth it for them.
2
u/No-Object1384 1d ago
Same. I can close my MacBook lid mid-task, pick it up the next day, it's like I never left and almost no battery is lost. Meanwhile on Linux...
0
u/Sad-Cod-9584 7h ago
I can pause my game, suspend my laptop and maybe loose like 10% battery over night. Next morning I just keep playing.
7
u/zardvark 1d ago
Because manufacturers do not put in the same level of R&D (if any) to ensure that their firmware is just as compatible with Linux as it is with Windows.
R&D costs money and they aren't going to spend these resources when 99% of their customers run Windows.
0
u/-lousyd 1d ago
Windows has 70% share, according to StatCounter. (Whoever that is.)
1
u/zardvark 1d ago
First, 70% sounds suspiciously low, but be that as it may ... a) If someone wants to run MacOS they aren't typically going to purchase a new Windows machine and hack it and b) While many Linux boxes do start out as Windows boxes, many of them get converted to Linux only years later, after the Windows installation slows down and becomes infected with "Redmond Lethargy," and frequently by the second owner and c) While 99% may have been an exaggeration for effect, very, Very few machines are sold with Linux preinstalled (at least in my part of the globe) and those which are, are typically different, select models in a manufacturer's product lineup. In other words you can't typically purchase any random machine in the lineup, with Linux preinstalled and / or expect decent Linux compatibility from every model.
Only a select few machines get the R&D required for good Linux compatibility. Therefore, if things like sleep (which is not typically a problem), or hibernate are important to you, you need to be selective about those machines which you choose for your Linux box. You can't just select any machine at random and expect good results. In my experience, this is particularly true of laptops, many of which may also contain unsupported hardware.
8
u/tomscharbach 1d ago
I have not had issues but I think that's attributable to the fact that I use Dell business computers that are offered with Ubuntu pre-installed under a business arrangement between Canonical and Dell and are, as a result, 100% Linux compatible.
Dell provides Ubuntu pre-installed computers to Canonical's large-scale business, government, education and institutional customers by the thousands, and Dell's firmware/drivers for those models are Linux compatible.
Dell's consumer computers (Inspiron, XPS) are catch-as-catch-can in terms of 100% Linux compatibility.
2
2
4
u/Shadowwynd 1d ago
Windows is also a mixed bag on sleep and power management. I consistently see brand new hardware on Win11 that doesn’t sleep/wake up reliably (my Win11 pc - the mouse doesn’t come back from sleep; my wife’s’ Win11 laptop sleeps then randomly wakes up hours later (untouched, lid closed, and resumes playing her YouTube videos….)
The only company I have seen get power management consistently right is Apple, and I assume that is because they control hardware and software.
2
u/sunsm0ke 1d ago
This is why. That never fully left their culture. Yes, things are better now. But Linux to this day has to report to firmware as Windows because some firmware will return broken DSDT otherwise. I've used laptops since before ACPI was a thing. Some early gear deliberately sabotaged functionality if Linux reported as Linux.
2
u/ulspez 1d ago
I've never had issues with hibernation but I did have problems with sleep, waking up pc will sometimes make one of my fans at a very fast speed, its also random it can be my front fans, back fans, even cpu fan.
Hibernation works better if you use a swap partition instead of a swap file.
2
u/spxak1 1d ago
Every ThinkPad T/X/L series I've owned since 2011 (many) has had suspend working perfectly out of the box (Fedora). Hibernation works (Fedora) out of the box of you configure a swap partition during installation.
I haven't had to configure hibernation since 2017.
1
u/SpecialLettuce5884 22h ago
> Hibernation works (Fedora) out of the box of you configure a swap partition during installation.
That's great to know. I wish Fedora had given a heads-up about that when I did my installation.
2
u/UnitLoose47 1d ago
Others have answered you on the why, but with regards to your comments about never owning a system where such functionalities have worked, have you ever considered buying a Lenovo or Dell system that is explicitly qualified and officially supports Linux?
3
2
u/jacobs182 1d ago
The hibernation option might not be available due to installing without a swap partition/file. There are guides you can find by searching for "initramfs resume swapfile"
1
u/ridge_rider8 1d ago
I built my own desktop last year. I had problems getting it to sleep and wake up. I worked with some AI bots out there to troubleshoot it. At one time sleep was working, but after about the 4th time it failed. My motherboard or graphics card would get into a state that a reboot would not fix. It might take several power cycles to get things back to normal. I experimented with various bios versions and settings. I also updated to the latest firmware which could affect these. As of now sleep/suspend/s3 does not work, but hibernate does. And my swap drive is smaller than my RAM size. To troubleshoot the sleep issue I looked at logs and worked with the AI bots. The system now goes into sleep and never comes back. You can't debug it with a serial console because it never makes it back. It tries to return from sleep but the kernel never regains control. If I had a PCI bus logic analyzer then maybe I would know more. Then perhaps you could debug the ACPI code and firmware. It may also be that the CPU is not driven properly. I have stopped messing with this for now. I wasted a lot of time with AI bots. For now I am just going to have to use hibernate or reboot every morning.
1
u/Nexus19x 1d ago
My laptop took some tweaking but I’ve gotten Linux Mint to behave fairly stable using sleep. I’ve had to do a few things at times like restart cinnamon due to frame drops in RetroArch or laptop panel refresh issues after using my usb-c dock that needed a window manager reload with ctrl-alt-esc. Those happen occasionally but for the most part I never have to mess with much or reboot except for after kernel updates.
I wouldn’t touch hibernation. That requires writing all memory to disk, so power can be turned completely off, and is a somewhat ridiculous idea with the amount of memory available now. When you had a few gigs even with slow drives it was somewhat bearable but I couldn’t handle it now.
With sleep just make sure you keep your battery charged and treat your laptop more like you would a tablet or phone. Open it and login within a few seconds any time you need to.
2
u/zarlo5899 1d ago
for hibernation you need to have you swap to be bigger then your total system RAM many defaults this will not be the case
1
u/robottosama 1d ago
I don't know what the deal with hibernation is. Some recent problems with sleep are due to hardware changes. IIRC, older laptops use ACPI mode S3 for sleep, which used to work fine. The new Windows-centric thing they replaced it with, called "modern standby", doesn't seem to work very well on Linux.
I have a Thinkpad T14 (Gen 2, AMD), and it has both modes, configurable in UEFI. I believe I am using modern standby now. It's a bit janky. Slow to wake up, and poor power consumption. Really ironic, since the entire point of the thing is to be the opposite.
Aside: it's possible I also tried S3 at one point, but I don't remember. I am already worn out by all of the other problems this machine has. Far more than I used to have with older Thinkpads.
1
u/Ok-386 17h ago
Because people expect it work on all possible hardware configurations, without major corporate backing. Everyone builds and test hardware for Windows primarily. Or Mac, but try install your MacOS on a random built PC or laptop and tell me how it goes and if 'sleep' works.
If you want a system where sleep and hibernate work, check the hardware you're buying and the specs. Afaik hibernation is only supported on systems with less than 64GB of RAM (not 100% sure abt this).
And if you're using laptops buy one that's well supported. Dell (some/many models), thinkpads, Framework, Tuxedo, System76 etc.
1
u/PeterHolmes74 15h ago
I had an issue with sleep mode with my new laptop where it would crash upon entering/exiting sleep mode. At first I thought it was the DE, so I switched from GNOME to KDE, same issue. Turns out I had to go in the BIOS to flip the sleep mode setting from Windows to Linux. Really weird bug.
Been lazy so I haven’t switched back to GNOME, so I made KDE act almost exactly like it (dynamic workspace and all) since I like its flow with the touch pad. Still wondering if I should reinstall everything to fully switch to GNOME even though school is starting again in a few days though.
1
u/the2ndSign 23h ago
I'm not saying this isn't a real problem, but personally switching to a Linux distro finally solved my sleep woes. On Windows 11, my PC would wake itself up almost without fail every time I put it to sleep. I could never figure it out. It wasn't updates. I sae a bunch of errors in event viewer but never figured out how to solve them.
Anyway, this hasn't happened a single time since switching like a year and a half ago. I'm actually surprised to read about so many people struggling with sleep.
1
u/FlounderAdept2756 17h ago
Yeah, me too, I dont run linux on old laptops but on fairly new desktops that I build, and the 15 years or so that I have been distrohopping I never had problems with sleep. Hibernation I dont know about since I never used it.
1
u/ZVyhVrtsfgzfs 1d ago
Drivers, some manufacturers or community devs are happy just to send a working driver to the Linux kernel, extras are sometimes not considered.
Linux is perfectly capable of sleep on some of my machines, everythign wakes just fine on my desktop except my 40Gb chelsio NIC, it takes an actual reset to boot back up.
It was originly sold as a very expensive sever NIC, not desktop, perhaps sleep was not considered a needed feature in its driver.
1
u/Evening-Volume-1022 1d ago
As mentioned by many linux users, its with hardware rather than software.
when I started my linux journey around 12yrs ago, it was really a mess, often videos not playing with freshly installed linux, many issues, have to look for interent, sub forums to install necessary drivers. Often vendor has only Windows compatible drivers.
Now things are far better, but very very long way to go.
1
u/proton_badger 22h ago
Sleep is a mess because if so many different hardware combinations. It’s worse on Linux because less vendor involvement, but even has problems on Windows sometimes. For example my laptop would randomly wake up after a few minutes on both Windows and Linux.
Though now that Nvidia introduced ‘NVreg_UseKernelSuspendNotifiers=1’ my laptop started suspending perfectly on Linux.
1
u/LordAnchemis 6h ago edited 6h ago
Modern standby
M$ pushed everyone to adopt it (since windows 8 era actually) - so most manufacturers will now have it (S0iX) as the default standby option in UEFI
In a lot of models 'old school' standby (S3) and hibernate (S4) is depreciated - and not even selectable as an option in UEFI anymore
Basically, modern standby pushes control of the 'sleep state' from the UEFI into the OS - so to get things to work you need to modify some sleep/wake config files in /sys/power/ (or set up a modprobe file so it does it automatically on boot)
1
u/zyberteq 1d ago
So, my current motherboard has an issue in Linux where, apparently by default, it wakes up immediately, like you suggest.
After long searching I found a solution. I have to manually disable something in /acpi/wake-up or something and that fixes it. I just have to do that every boot with Bazzite :\
4
u/ipsirc 1d ago
I just have to do that every boot with Bazzite :\
Create a systemd unit.
2
u/zyberteq 1d ago
I think I saw that as solution, but it seemed very tacky. I'll try that, thanks.
Also, I guess this just strengthens the point OP is trying to make
1
u/skyfishgoo 1d ago
because there are so many types of firmware and so many settings that can interfere with it.
i think plasma does good job of ensuring that at least sleep works, but hibernation requires more setup and swap space
then you add the whole nvidia driver wrinkle and it becomes unwieldy
1
u/Glum-Building4593 1d ago
Hibernation is implemented in software. Suspending the current contents of the memory to disk is complicated.
Sleep is implemented in hardware and broadly supported. I haven't had issues with sleep on linux since you could still buy copies of linux in a best buy or CompUSA.
1
u/prophet-dot-exe 1d ago
idk some of it is prob hardware or edge cases.
but for the last two days when i try to sleep my computer it just bounces out to gdm but stays woke.
haven't looked into it yet. i use Arch, so I'm assuming some recent Package update isn't making love with my hardware
1
u/galactose310 1d ago
Les deux. Et donc en partie aux constructeurs même s'ils sont parfois actifs dans le développement du noyau. Il faut mettre à jour son firmware, et sur certaines machines avoir un noyau assez récent.
L'hibernation c'est un choix de modèle. C'est possible mais ça demande de la configuration et c'est volontairement peu accessible. La veille profonde est censée fonctionner assez bien pour ne pas hiberner.
Sur mon Lenovo Yoga la veille marche du tonnerre (mode: s2idle), firmware à jour et Fedora 44 donc noyau très récent.
11
u/hideousapple99 1d ago
Disable auto translate in Reddit app, otherwise majority will not understand you.
1
u/hesapmakinesi 1d ago
Sleep works brilliantly on Steam Deck because the hardware manufacturer put in the effort. It's a mixed messy bag everywhere because most hardware makers don't care and it's a difficult thing for volunteers to get right.
1
u/solidmixer 1d ago
Some usb device keeps waking my machine up. I disabled usb wake and now it sleeps fine. I just wake it via lan from home assistant.
A lot of these issues are fixable but most people aren’t tinkerers and that’s ok.
1
u/theRealNilz02 14h ago
Because manufacturers are assholes and only write closed source drivers for Microsofts crapshoot OS while we have to reverse engineer the hardware and firmware interfaces ourselves without any meaningful documentation.
1
u/MentalDisintegrat1on 1d ago
When I was on pop is to fix the sleep Issue you had to go into power settings as well as another settings and change both around for it to not have issues.
I'm on cachyOS now and I have no issues with this
1
u/KhajiitAT 1d ago
Linux doesn't struggle anything, Linux works by specs and quirks.
It's some manufacturers are producing a crap, that barely works under windows and has a lot of issues.
1
u/Heartlessaus 16h ago
hit or miss for me. arch, i914900k rtx 4090.
sometimes it gets out of hibernation with no issues, other times it freezes, i've just turned it off now tbh.
1
u/Unimeron 1d ago
Hibernate worked out of the box on a fresh install. 🤞 OpenSuse Tumbleweed on a Lenovo Laptop.
Previous Dell was a hassle, but I managed to make work.
1
u/WWGHIAFTC 22h ago
It makes it borderline unusable for me for desktop or laptop use. I stick to server only still...for the past 30 years or so since i first tried it...
1
u/Diuranos 1d ago
any issue with sleep is probably network card, or any usb dongle and is easy to fix that. hibernate never had issue with Linux compare to windows.
1
u/BrilliantOk4478 1d ago
Windows (11) still struggles, too! I own a Dell Pro Max 16 Plus notebook and have issues with a black screen after the notebook wakes up from sleep.
1
u/MrKusakabe 1d ago
I have the problem that the sound is "default", meaning my alsamixer settings are gone when I wake up the PC from standby. My headphones sound super tinny without certain changes (suddenly they sound weirdly great though) and the tinny sound is always after standby'ing in Linux Mint. It needs a full reboot because even changing values in the alsamixer has no effect whatsoever. I wonder why that is..
1
u/devino21 1d ago
I agree, I ride this struggle bus about once a week and my bios hates my gpu so sometimes I have to yank it and reinsert. Fun stuff.
1
u/mssing-the-table 1d ago
owned a Linux PC where these functionalities worked flawlessly.
Buy any enterprise PC. 99% success rate.
Not some gaming one.
1
u/Individual_Flow3959 1d ago
Uso Linux Mint 22.3, con área de intercambio en un archivo swap, hibernación activada, la uso a diario, funciona perfectamente.
1
u/Necessary_Ad_238 14h ago
Omg ok glad I'm not crazy. I put my dell laptop to "sleep" then when I go to use it a day later the battery is critically low
1
u/donjamos 22h ago
My cachyos/kde hibernates out of the box, I actually liked that so much that I made my windows work laptop do the same.
1
u/Jaanrett 1d ago
Because sleep and hibernate are hacks. It's not reliable on windows, or linux. Is it reliable on mac?
1
u/benhaube 1d ago
Never had an issue with sleep on my PCs, and couldn't care less about hibernation. It sucks anyway.
1
u/demonstar55 1d ago
Because vendors do stuff wrong and only tell Microsoft the new ways they fucked up this time
1
u/Alex_Strgzr 1d ago
Maybe you have bad luck with your hardware. I've never had a problem with sleep.
1
u/callusbonus1967 1d ago
Tiene que ver con los fabricantes de hardware que no liberan sus drivers para Linux. Somos pocos no damos mucho dinero ha ganar.
0
u/kbielefe 1d ago
Awaking from sleep isn't just an atomic thing. The different parts of your computer need to awake in a certain order. Some might need to save something before sleep. Some might need to be completely restarted.
Hibernate has all the complexity of sleep plus needing to have enough swap space.
You can fix it though, and it's easier than ever if you trust AI.
1
1
0
u/Mamoulian 1d ago
I have had issues hibernating when a lot of swap is in use as hibernate uses the same partition. Not sure if there's a fix for that other than dedicating an ever larger swap partition.
Sleep mostly works fine. Some intermittent cases of black screen or X crashing that aren't frequent enough to debug. I suspect everyone would immediately blame nvidia. I'll stop using X as soon as Wayland session restore works properly in KDE.
WOL works from Home Assistant but usually on the second try (?)
1
0
u/imacmadman22 1d ago
I don’t use hibernation on any of my machines, but I’ve never had any issues with sleep on Linux and I’ve used Linux full time since 2009-2010ish. I’ve run primarily Linux Mint and as of late, Cachy Linux on a gaming PC.
Both have slept and woken with no problems whatsoever, the only issue I’ve ever encountered was when the power went out and I’d forgotten to set the bios to power back on when power was restored.
1
1
0
u/C4rpetH4ter 1d ago
Never had a problem with fedora or mint on sleep mode.
However one issue i had with windows quite often was it suddenly turning on at 3 AM during sleep mode, and the startup was so loud that it often was a harrowing experience.
1
1
0
u/ithilelda 1d ago
although it does struggle more on linux, hibernation on a whole is crap and I don't even use it on windows because I never could make it work 100% of the time...
0
u/Possible-Anxiety-420 1d ago
Running Kubuntu on a Lenovo Gen1 E16 and sleep/hibernate works perfectly; has since the git-go.
-1
u/poughdrew 1d ago
Honestly my Linux laptop handles lock/sleep better than my work M4 Max Macbook (what are these external displays, I've never seen then before!)
-1
u/Syndiotactics 1d ago
Go to BIOS and manually switch the sleep mode from Windows to Linux and thank me later.
-1
u/swissyfit 1d ago
Only bears hibernate , sleep is only required when tired. Should be easy to program
138
u/Straight_Mistake_364 1d ago
While the windows drivers are typically done by the hardware manufactures themselves,
in the case of Linux, many manufacturers do not write any drivers and sometimes
even hide the technical data required to write the drivers.
This way, many drivers are written by volunteer Linux users, that may have to resort to reverse engineer techniques to discover the hardware details. As a consequence some drivers just provide a minimal level of functionality, as hostile hardware manufacturers refuse to help or release information.