this post was submitted on 03 May 2026
47 points (98.0% liked)

Linux

65045 readers
212 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 7 years ago
MODERATORS
 

Linux is cool, I can do a lot of things with it. If i set a config file in Linux, I am damn sure that it is ran every single time. The code does what you tell it to do.

There is 1 thing that always seems to be "black magic": 1) lid close and suspend 2) lid close and suspend and lock.

If we ignore locking for a moment and focus on suspend. I cant seem to figure out why sometimes lid close would suspend immediately, when other time it takes 5 seconds after lid closes. On some days, lid closes would not even suspend !!

Did anyone manage to get suspend work 100 %? I cant believe we have tons of great linux tools and years into kernel dev, and still suspend is a hit or miss.

all 28 comments
sorted by: hot top controversial new old
[–] quantumvoid0@programming.dev 3 points 11 hours ago (1 children)

i dont really close my lid and walk away, i usually just lock the screen and turn off the display if required without suspending.

altho i have noticed users complain that suspend fails after a specific service/application is started so u might wanna check on that

[–] eldavi@lemmy.ml 3 points 11 hours ago (1 children)

i got in the habit of doing this also because suspend didn't work 100% of the time back then, but stopped when i switched to linux first laptops.

i switched back to a windows-first laptop recently and forgot about setting it so that it doesn't auto suspend when i close the lid and it works just fine with fedora on it; linux has made leaps and bounds since the last time i contributed to it.

although, to be fair, i was on linux-first laptops for a decade so there was plenty of time to catch up. lol

[–] quantumvoid0@programming.dev 1 points 9 hours ago

lol , i hope linux develops more and becomes mainstream

[–] utopiah@lemmy.ml 9 points 19 hours ago

Few seem to address the issue here : it does not work 100% of the time for you.

It might work for everybody else but that doesn't help you much. You have your setup, no theirs.

So... you need to investigate. When it works, great, nothing to learn from. When it fails though... can you find a pattern? Does it always fail after you have use something specific? Check https://lemmy.ml/post/46800646/25494455 which gives examples of potential failure point and journalctl logs. You can then check what failed and if not you can at least know when then backtrack to others logs, e.g. dmesg.

They key take away is that when things do not behave as expected you need to put a detective hat on and you investigate :

  • what's your crime scene? Your laptop and it's log files
  • what's the crime? It didn't suspend properly
  • where are the traces? In the logs
  • where are the logs? Using journalctl or dmesg and typically in /var/log/
  • what would a good detective do? Search for specific clues, e.g. places where fingerprints do stick, e.g metal or glass, which here would be error messages. That can be found using grep and other tools

You also have limited times because the logs will, just like on a real crime scene, get contaminated or rotated or deleted. So... if you do encounter the problem do not rush to the next tasks at hand because you are wasting an opportunity to learn and there is vanishing window.

TL;DR : grep logs

[–] Maiq@piefed.social 23 points 1 day ago (2 children)

/etc/systemd/logind.conf

HandleLidSwitch=suspend

[–] Ooops@feddit.org 8 points 1 day ago

Also HandleLidSwitchExternalPower= for when it's still plugged in when you close the lid.

[–] Mordikan@kbin.earth 3 points 22 hours ago (1 children)

NixOS for fun:

powerManagement.enable = true;
services.logind.extraConfig = ''HandleLidSwitch=suspend'';
[–] Maiq@piefed.social 2 points 22 hours ago (1 children)

Hows the maintenance on nixos? In reguards to updates. I really like arch for my dailies and have been running debain on my media device. I'm trying to find something that bridges that gap of more current packages and easy/low maintenance.

Been wanting to try it to see what it's all about.

[–] Mordikan@kbin.earth 4 points 21 hours ago (1 children)

I've used Arch as my daily for so many years now, it is a little tricky moving from imperative to declarative configuration. I'm treating my NixOS machine more as long term maintenance, so I'm not using the most bleeding edge packages. You can do that though by pointing to nixos-unstable.

I plan on using flakes for pinning and home-manager for writing ~/.config configurations, but I don't think I really need it, more just to learn how. With home-manager, I could rebuild this machine from scratch (including individual application preferences/settings) just with the backed up configs. I can at any point rollback to any saved previous generation though, too, just by restarting the machine.

I've really been impressed with it though. To the point, I will probably be moving my Arch DIY router over and converting it to NixOS.

[–] Maiq@piefed.social 1 points 21 hours ago

Thanks, maybe I'll give it a shot soon.

[–] MonkderVierte@lemmy.zip 1 points 16 hours ago

Suspend is basically the same sensible balance used in booting, so yeah, hit or miss.

[–] bjoern_tantau@swg-empire.de 22 points 1 day ago

In KDE it's just a simple configuration in the power section of the settings. No idea what the general Linux way would be.

[–] mko@discuss.tchncs.de 1 points 18 hours ago

It works almost all the time. The times it doesn’t usually can be attributed to me not switching off my wireless mouse.

[–] juipeltje@lemmy.world 8 points 1 day ago

Depends a bit on your setup. If you're using systemd you can use the logind.conf as already mentioned, or if you're on a non-systemd distro you can use the forked elogind, which works pretty much the same way. For locking your session when suspending, since i use wayland, i use swayidle for that. In its config i just put before-sleep 'swaylock', which will execute swaylock before the system goes to sleep.

[–] boredsquirrel@slrpnk.net 4 points 1 day ago* (last edited 1 day ago)

Any normal desktop environment should lock, then suspend. KDE does that afaik, never had that issue.

So first lock, then suspend. As the process is ran by the system, it doesnt care if the screen is locked or not.

[–] hexagonwin@lemmy.today 2 points 22 hours ago

i use fvwm. i have win l binded to xlock, so just press win l and close the lid.

[–] FishFace@piefed.social 6 points 1 day ago

You ask too much.

Sleep on Linux is never quite as reliable as it should be, and I end up with a laptop gently roasting itself to death in my bag more times than I'd prefer.

[–] everett@lemmy.ml 9 points 1 day ago

For starters, do you know if your laptop does S3 sleep or S0? I feel like the latter introduces a lot of uncertainty.

[–] anon5621@lemmy.ml 6 points 1 day ago* (last edited 1 day ago)

A lot depends on hardware actually, mix of USB Controller, video card, UEFI and etc type of suspeing s3,s0ix so huge fragmentation actually, it so bad that eveb on modern windows it holy crap shit not work because they forced on s2idle. Tell what ur hardware and please share journactl logs of when it fails

[–] Cyber@feddit.uk 4 points 1 day ago

Have a look on the Arch Linux wiki around udev and event debugging (evdev?)

Depending on whether you're suspending to RAM or disk will affect the time it takes - and of course, how much stuff it has to suspend.

If you're in the middle of a resource intensive task (which could just be watching a video... all depends...), then whatever is running needs to stop, and possibly has a full buffer which needs processing as suspend could be to the swap file / partition, which may need emptying first.

But, it should all work these days.

[–] Peasley@lemmy.world 1 points 1 day ago* (last edited 1 day ago)

Suspend and hibernate both work 100% of the time for me so far on both of my laptops, and have for as long as i've had them.

Thinkpad x270 Fedora (current) KDE spin

Thinkpad x250 Ubuntu 24.04 GNOME

Fully working since 2019 and 2016 respectively. I have not tested opening the lid after just 5 seconds so i can't say for sure how long it takes.

My previous laptop before these (an x200) would sometimes fail to suspend and get super hot in my bag before running out of battery. I was using Gentoo at the time and i suspect i had something configured incorrectly. It only happened a few times but it was pretty frustrating.

[–] JoeKrogan@lemmy.world 3 points 1 day ago

Kde on debian here. It just works nowadays

[–] warmaster@lemmy.world 3 points 1 day ago (1 children)

I don't know, I just installed Aurora Linux and everything works by default.

I bet your issue is hardware related, maybe you could change something in the bios to make it work.

[–] daggermoon@piefed.world 1 points 1 day ago (2 children)

What's Aurora Linux? I checked their website and it's still unclear to me. Is it immutable?

[–] warmaster@lemmy.world 1 points 9 hours ago* (last edited 9 hours ago)

Yeah, it's part of the Universal Blue family of distros which Bazzite is part of. Technically it's not immutable (they call it atomic), but yeah. For gui apps I just use flatpaks & appimages, for cli apps I do: brew install whatever. 99% of the time this does the trick, for that 1% which is some obscure random app I really want to try, I just use Kontainer which is a GUI for distrobox, basically it let's me install any linux app for any distro. And for those super rare cases when I need to use a Windows app, I use Winboat which is freaking great.

Aurora now has a live iso, you could try it without installing it and see if everything works out for you.

In other words, it's Fedora Kinoite with expanded hardware support, a few quality of life improvements and the trustworthyness of an immutable distro. I've been rocking it for more than a year, and it's the same pure bliss of Bazzite (which I run on all my home PCs).

I use Aurora on my work laptop, I've installed it in an external M2 caddy drive, so my company has the Windows drive with the license intact, and I've set the BIOS to boot to the M2... so my files are all on the external drive which also works as a thumbdrive on my desktop PC at home. When my IT guy said I had to change laptops, I just plugged my M2 drive to the new one and that's it.

Freaking great. Best experience I've ever had with work laptops. Plus, it's faster than Windows. I love it so much.

[–] cerebralhawks@lemmy.dbzer0.com 2 points 1 day ago (1 children)

Not sure how lid detection works on Linux because there are so few laptops that ship with Linux. So I'm not sure if there's a set rule on that. But, Linux can run on like most, if not all, x86-64 Wintel laptops out there, so there's gotta be a standard.

That said, I use Macs at home and Windows at work. It's hard wired in my brain that when you get up, you ⌘+CTRL+Q on a Mac or Win+L on a Windows box to lock the machine when you get up. Every single time. I don't care if it's a laptop or a desktop. The exception is my MacBook because I know exactly what it'll do, and it'll do what I want it to. But sometimes I do the three finger salute.

So I imagine if I used Linux, I'd just use its 2/3 finger salute to lock workstation before walking away, because that's my SOP for walking away from any computer. My main phone is an iPhone, but sometimes I use an old Android phone. My SOP for using it is much the same as the iPhone. So if I were using Linux, I wouldn't treat it any differently. All that being said, I'd expect the lid action to be in the power options like it is in macOS and Windows. But I guess I'd see if it actually does what it says?

[–] Attacker94@lemmy.world 1 points 1 day ago

I am very much the same with locking the system manually, and on KDE it is the same as the windows shortcut ie Super + L