It started freezing maybe a month or two ago. It happens anytime between a few seconds after the OS loads, to hours or days later. I do not recall downloading anything around when this issue began that could be suspect.
I’ve put off fixing this because I have no idea how to even begin troubleshooting it. Internet searches for “Linux freezes” returns practically countless potential problems.
What are some recommendations? I have my root directory on a 30 GB partition separate from my home directory, which I think makes reinstalling my base image (Debian) easy without losing personal data, so that’s an option. Maybe there’s a system log file that would provide some insight?
I’m Linux dumb so please teach me how to fish!
I’ll add that my Windows install (on a separate drive) doesn’t freeze, and my Linux install is on a new Samsung drive that didn’t report issues, so the problems unlikely hardware related.
02:05 18OCT: Thanks for all the quick responses, a lot of helpful suggestions so far. I should clarify that “my computer freezes” means it is 100% unresponsive until it is rebooted. Ctrl+alt+del spam or changing terminal sessions when its frozen does not get a response. The last few entries in my most recent journalctl boot outputs are different from one another, and the I did not see any errors. For now, I’ll boot a live USB and let it sit for while, see if it crashes again.
Do you have another machine(or even a phone with an ssh tool like connectbot) you can use to try remoting into the machine while it is “frozen”? If you can still ssh in, that would indicate it is a DE issue, and you can poke around from there, try forcing a restart of the DE
you can also use the GNOME Logs app to peruse a lot of these logs, if you prefer.
You can install a memory stress test and run it from the boot menu (memtest86).
Could also be a CPU overheating problem and this can be caused by a defect CPU fan. On older systems, that could cause a specific signal when compiling the kernel.
Other potential cause could be file system corruption. Good idea to back up your stuff.
Is your swap big enough? Some installers default to only 1gig. That isn’t big enough normally.
If it fills the ram and the swap, it will cause what you are seeing. Typically the suggestion is a little more than however much ram you have. Personally I set it at either 16 or 32gigs or more. Depending on the machine and what I intend on doing with it and how much drive space I have available.
You can keep a system monitor open (or top, htop etc) and keep an eye on it when you’re doing something ram hungry, like having a bunch of browser tabs open or whatever. If it freezes and you look over and see the ram usage pegged to the top, that will suggest that that is your problem.
16gb seems huge.
Is there some sort of rubric you follow that leads you to that figure?
The rule of thumb is that you want at least the same amount of ram that you have (plus a little more just in case) if you have a laptop or similar where you’re going to use hibernate, since that works by moving whatever is in the ram into the swap.
Also, note that swap is basically emergency (and slow) ram. You want enough to handle any emergencies. Although I think it gets used before ram fills up completely. There are a lot of uses of ram where swap works just as well. Like if you got a program and/or browser tabs open in the background that you’re not presently using, it needs somewhere to store that data. And don’t forget about all the programs you may use that handle or process large files. Typically that gets loaded into ram (or direct to swap if fast access isn’t needed), and if ram can’t hold it, something that is used less is moved to swap.
But if there is no room, it keeps trying any way and it all freezes up like what op describes.
So… since people often have 16 gigs of ram in their machines, no, that isn’t a huge amount of swap to have. Even on my desktops I generally have at least 32 gigs swap just because I often do things that fill up a lot of ram. One of them has 64 gigs ram, and it can fill a good chunk of the swap as well if I try to render something heavy in Blender. Add on to that, I may have a vm open as well. That often uses swap along with filling ram. And of course general web use where it is normal to keep several tabs constantly open.
I want to make sure I have more swap than will ever be used. Because if it does get used, then that means it and ram is full and the computer will freeze.
Hold the power button till the display goes dark. Then start up the computer.
Do you have a Ryzen CPU by any chance? I had an issue like this for ages and it turns out it was a faulty Ryzen power state that was disabled by default on Windows, but not on Linux. If this happens to be your issue, there are ways you can disable the power state in software: https://wiki.archlinux.org/title/Ryzen#Soft_lock_freezing
I have some bad experiences with btrfs and timeshift schedules. I have laptops seen freeze for minutes when creating a btrfs snapshot. I have not specifically looked if you are using this combination but it is something to check.
the
/var/log/
folder would be the best place to start.-
When a random freeze occurs note the time. Try to be as accurate and close to the time it happened as you can, including day, hour, and minute.
A. If possible, do this for multiple instances of this happening -
Check various log files starting with
syslog
and look at the times noted above. Look for any relevant errors being thrown by the system at these times.
-
If it’s freezing regularly, you could try booting a live usb of any Linux distro and see if it does the same thing. That will tell you relatively quickly if it’s a hardware problem or a software problem.
It happens anytime between a few seconds after the OS loads, to hours or days later.
That will tell you relatively quickly if it’s a hardware problem or a software problem.
I mean, potentially not that quickly if they have to wait days for it to happen. Good low-investment-of-personal-time-and-effort suggestion though.
Yeah, I would give it a few hours to most of the day to test and then move on with something else. I really recommend journalctl though. Of course it depends on how long it stays on and how fast you can read the logs.
this is important, and will help you find solutions much more specific than just “system freeze”
- Right after a crash, once you reboot, run
journalctl -b -1
and scroll to the bottom. Look for any big red text, all of that will be very helpful to diagnose this issue
Otherwise,
- Does it freeze permanently, requiring a reboot, or for a few seconds?
- If it’s just for a few seconds, and you’re on an AMD system, it would sound like an fTPM stutter. A BIOS update would likely fix that, it was a widespread issue.
- Are you using an AMD or NVIDIA GPU?
- Do you play any games or use any software that uses OpenGL? (Blender and minecraft are some I’ve had problems in before)
No red text from journalctl unfortunately. My last few sessions each end with different messages too. One is a KDE Connect warning, a few others echoing some commands I sent in the terminal, etc. No red errors.
The system freezes permanently, requiring a reboot.
I have an AMD GPU, and likely have OpenGL installed.
- Right after a crash, once you reboot, run
Command line is your friend. It might not seem like it at first, but it is very helpful.
Use the
journalctl
command in a terminal.Command Purpose Example
journalctl -u [SERVICE] View logs for a specific systemd unit/service. journalctl -u nginx.service
journalctl -b Show logs from the current boot. journalctl -b
journalctl -b -[N] Show logs from a previous boot (ee.g., -1 for the last boot). journalctl -b -1
journalctl --list-boots List all recorded boot sessions. journalctl --list-boots
journalctl -p [PRIORITY] Filter by priority level or a range. Levels are 0 (emerg) to 7 (debug). journalctl -p err…warning (shows errors, critical, alerts, and warnings)
journalctl --since=“[TIME]” --until=“[TIME]” Filter by time range. Supports absolute (YYYY-MM-DD HH:MM:SS) and relative times (1 hour ago, yesterday). journalctl --since “20 min ago”
journalctl -n [LINES] Show only the last N entries. journalctl -n 20
journalctl -k Show only kernel messages (equivalent to dmesg output). journalctl -k```I spent a couple of days trying to figure out why I couldn't install any variant of Arch Linux or Fedora Linux on my laptop. That command helped me narrow things down.
Sounds to me like your swap is to small. I had similar behaviour on two systems. One with 8gb of ram and one with 16 gb.
https://wiki.archlinux.org/title/Intel_graphics#Baytrail_complete_freeze
Go to 6.15, there is your solution. I had the same very problem and with this it got solved.
I’ve had something similar a while ago. Trying a different distro or doing stuff on the software side didn’t help.
What fixed the issue was getting a new hard drive because the old one was breaking down.
But maybe try other approaches first
Others have already given some good advice, but rather than let it sit and wait to error, use the program “stress”
It’ll work specific components hard which can help locate whether it’s a CPU/Heat problem, or Memory, or disk.
And if it still fails on random things, take a long hard look at your PSU and measure voltages if you can. But if everything else checks out, motherboard could be it. Tiny cracks/dry joints, even inside the pcb layers, can lead to occasional problems that come and go with heat or vibration and are impossible to accurately diagnose beyond swapping it out.
This definitely can’t hurt and will probably help narrow it down, but it’s unlikely that OPs problem is hardware-related given that it doesn’t happen on Windows.
I can understand that view, but I’ve personally experienced things where it absolutely can be this and I respectfully disagree with you. I think what OP describes is more likely to be hardware than the OS.
Firstly - different drive for linux. A dying drive can freeze and take down its host, regardless of OS.
Secondly, linux uses memory very differently to windows, especially in relation to caching the filesystem. Linux might be accessing memory that Windows doesn’t get to.
We also don’t know what loads OP puts on his computer when running windows and linux. Maybe he has windows to game with, or may he uses linux for LLM/compute work and runs it full tilt. Each may do very different things and tax different aspects of the hardware.
It’s simply not safe to assume anything when diagnosing intermittent problems with hardware. The only reliable method is methodical testing and isolation.
Very good points.