News for hackers. Stuff that matters.
Re:Why does Linux have so much trouble sleeping and waking? by pwg on Friday December 11, 2020 @09:40AM (#25386285)
This ...

If the OP does some internet research into this topic they will find articles detailing how almost all [1] non-apple laptop makers build to a single target: ms-windows. They also test against a single target: ms-windows. If it works there, they are done. Linux compatibility is not even an afterthought.

And as each makers various models all seem to also have slightly different ways to perform sleep/hibernate and subsequent wakeup, the result is that Linux kernel dev's are playing a continuous game of catch-up. One thing I've found is that upgrading the kernel to a later release sometimes fixes the issues (assuming patches were supplied by someone in the interim to fix them).

[1] Very few makers have any laptops that ship, from the maker, with Linux preinstalled, the few that do (one or two Dell models, the aftermarket "Linux Laptop" vendors, maybe a sliver of others) will more than likely work properly for sleep/wake. The reason why these work better is because the maker should, in theory, test for Linux compatibility and help fix any bugs (or simply build with compatible chipsets from the outset) since they are selling these with "Linux pre-loaded".

Re:Why does Linux have so much trouble sleeping and waking? by danieldk on Friday December 11, 2020 @09:49AM (#25386375)
one or two Dell models, the aftermarket "Linux Laptop" vendors, maybe a sliver of others

Lenovo also certifies ThinkPads for Linux:

https://support.lenovo.com/us/en/solutions/pd031426-linux-fo...

Newer (?) ThinkPads even have a firmware option to switch between the default sleep state and one that is more compatible with Linux.

Re:Why does Linux have so much trouble sleeping and waking? by gsich on Friday December 11, 2020 @04:10PM (#25391032)
Lenovo has Linux fails too. This list is on part a blatant lie.

Example: Lenovo ships some Thinkpads with a Fibocom LTE modem. But only Windows has PCIe drivers, Linux needs to use the USB interface. Not a problem one would think, but if you switch the modem to USB mode, the notebook will not boot. Lenovo still uses a whitelist for allowed devices and they forgot to add the USB mode for the modem.

Thread for further reading: https://forums.lenovo.com/t5/Linux-Discussion/Linux-support-...

https://forums.lenovo.com/t5/Other-Linux-Discussions/Linux-d...

Re:Why does Linux have so much trouble sleeping and waking? by lwhalen on Friday December 11, 2020 @11:44AM (#25387709)
Could you tell me more about this firmware option? As a ThinkPad owner/Linux user, I'd be very interested!
Re:Why does Linux have so much trouble sleeping and waking? by q3k on Friday December 11, 2020 @12:03PM (#25387947)
So, PCs can generally either do S3 sleep, or a new fancy 'S0ix' sleep since Haswell & co, and some similar mechanism on AMD machines.

S0ix is the new standard for W10 and beyond, in which the operating system attempts to itself shut down as many peripherals as possible, downclock the CPU, shut off unnecessary cores - but stay in ACPI S0. Basically just run normally, but try to be as power efficient as possible, following how mobile phones do things. Its big advantage is that it allows for varying levels of background processing (and eg. network connectivity) that just aren't possible with traditional S3. The downside is that it needs great hardware support within the OS and that it's a complex, system-wide effort to implement (like, needs application cooperation). Linux's S0ix support (via s2idle) is quite mediocre right now.

S3 sleep is the same ACPI-driven suspend-to-RAM mode that PCs have been shipping with for decades, in which a complex rube goldberg of DSDT and platform controller pokes ends up making a CPU stop running, having saved its entire state into RAM. The upside of S3 sleep is that it generally works, unless a machine's ACPI DSDT is terribly broken (which still unfortunately happens). The downside is that it's pretty much binary (either you sleep or you don't) and that you can't control what wakes you up. I mean, there's some ACPI mechanisms for it, but they're limited and janky.

New Thinkpad BIOSes can let you choose between either exposing old-school S3 via ACPI for non-W10 systems, or enabling S0ix functionality for W10. The default is generally S0ix/s2idle.

See: https://www.kernel.org/doc/Documentation/power/states.txt

Re:Why does Linux have so much trouble sleeping and waking? by stainforth on Friday December 11, 2020 @12:16PM (#25388095)
What percent power savings are achieved?
Re:Why does Linux have so much trouble sleeping and waking? by giantrobot on Friday December 11, 2020 @01:06PM (#25388681)
IME the S0ix sleep on a fully charged battery could last ones of days. So sleeping for an afternoon or overnight doesn't drain the battery too much. With S3 sleep I've had systems sleep for more than a week with only a little battery loss. It's only keeping RAM refreshed so it's way lower power than even just minor (massively under locked) CPU activity.

That being said I have not owned a laptop in the past decade that I trusted to sleep when running Linux. I've had nothing but problems with things like WiFi not coming back up or the machine randomly waking up in the middle of the night.

Those machines running Windows are much better. But really the only machines I trust to wake and sleep reliably are Macs. I haven't run into major sleep/wake issues on Mac laptops in twenty years of owning them.

Re:Why does Linux have so much trouble sleeping and waking? by q3k on Friday December 11, 2020 @12:24PM (#25388186)
Percent of what? This all depends on the particular hardware. If you want hard data, measure this yourself on your own device.
Re:Why does Linux have so much trouble sleeping and waking? by danieldk on Friday December 11, 2020 @11:59AM (#25387883)
There is a nice blog post that describes this:

https://brauner.github.io/2018/09/08/thinkpad-6en-s3.html

I recently bought a T14, which also has this option.

(It enables S3 sleep.)

Re:Why does Linux have so much trouble sleeping and waking? by lwhalen on Friday December 11, 2020 @12:00PM (#25387902)
Thanks very much!
Re:Why does Linux have so much trouble sleeping and waking? by evolve2k on Friday December 11, 2020 @09:44AM (#25386318)
Which laptops get this right then? Any of them?
Re:Why does Linux have so much trouble sleeping and waking? by Delk on Friday December 11, 2020 @10:01AM (#25386495)
I'd expect e.g. Ubuntu certified devices [1] to handle it. There are certified laptops from at least Dell and Lenovo, and probably the odd model from other manufacturers. While the certification technically only means the hardware is compatible with Ubuntu, and perhaps only as pre-installed by the OEM, in practice that probably means general Linux compatibility. I have trouble seeing any point in making Ubuntu-specific tweaks to an OEM install, as it's easier to just send only the models with compatible components for certification (or to pick compatible components in the first place, which may be feasible at least for premium laptops).

But as a user, you do have to pick your hardware.

My ThinkPad X240 has been suspending and resuming reliably for the majority of the last 6 to 7 years. There was a time when the touchpad didn't work after resume without tweaking (in Fedora), which was annoying and surprising and something that IMO shouldn't have happened. But other than that there have been no issues.

[1] https://certification.ubuntu.com/

Re:Why does Linux have so much trouble sleeping and waking? by dmytton on Friday December 11, 2020 @03:20PM (#25390439)
I have a Star LabTop Mk4 running Manjaro which suspends and resumes without any issues (laptop lid as well as sleep from OS). They build their laptops specifically for Linux and test on a range of major distros.

See https://starlabs.systems/ and https://starlabs.kb.help/compatibility-reports/

Re:Why does Linux have so much trouble sleeping and waking? by pferde on Friday December 11, 2020 @04:13PM (#25391072)
I've used two or three HP Elitebooks in past few years, and suspend/resume, as well as hibernation/resume just worked on them. I never even really thought about it, to be honest, I just used it - mostly just suspend - daily.

Curiously enough, some of my colleagues which have the same laptop model running Windows, complain that their laptops only wake up about 50% of the time, ever since we had a mandatory upgrade to Windows 10.

Re:Why does Linux have so much trouble sleeping and waking? by sigio on Friday December 11, 2020 @09:46AM (#25386341)
Had no issues with my current thinkpad (t480) and previous thinkpads (x240, x220, edge 11)
Re:Why does Linux have so much trouble sleeping and waking? by war1025 on Friday December 11, 2020 @12:34PM (#25388302)
I've always had good luck with Dell's Inspiron line. Have had three of them now that worked perfectly well. I always pick hibernate over sleep though, so I guess I can't say how sleep works on them.
Re:Why does Linux have so much trouble sleeping and waking? by sds357 on Friday December 11, 2020 @01:02PM (#25388641)
My Thinkpad L440 has never properly been able to use sleep or hibernate modes with Ubuntu, I have to shut down completely.
Re:Why does Linux have so much trouble sleeping and waking? by fwsgonzo on Friday December 11, 2020 @09:55AM (#25386441)
I have a Carbon X1 and it works perfectly, including the fingerprint unlock and the touchscreen.
Re:Why does Linux have so much trouble sleeping and waking? by smartbit on Friday December 11, 2020 @01:03PM (#25388644)
what version X1 do you have? And which distribution do you run on it?
Re:Why does Linux have so much trouble sleeping and waking? by fwsgonzo on Tuesday December 15, 2020 @04:05PM (#25435251)
I don't know which one it is. I bought it in autumn 2019 and it has a touch screen. I run bog standard Ubuntu 20.04 LTS on it.
Re:Why does Linux have so much trouble sleeping and waking? by cat199 on Friday December 11, 2020 @09:49AM (#25386374)
anyone that sells a linux on top; failing that its a crapshoot which mostly depends on developer popularity of that model / devices