Ubuntu – Ubuntu 18.04 LTS hard freezing while AFK

18.04crashfreeze

I am having an issue on Ubuntu 18.04 LTS where the computer will hard freeze with no detectable reason. This happens most frequently while I am away from the computer for extended periods of time (while asleep, for example) and I will return to a completely frozen computer. It accepts no input whatsoever, does not move the cursor when the mouse is moved, and tricks like REISUB do nothing. My only option is to turn off the computer with the power button.

Specs:
CPU: AMD Ryzen 5 1600
GPU: GeForce GT 1030
Mobo: Gigabyte AB350-Gaming-CF
RAM: Ballistix Sport LT 8GB x2
HD: Samsung SM961 SSD
PSU: Cooler Master Extreme Power RS-600-PCAR-E3

I have figured this may have been a hardware problem related to my video card, but replacing the card with the GT 1030 has only slightly abated the problem. Once or twice the computer has frozen while I was using it, but almost always while I was not directly touching the computer and turned away doing something in real life.

I've looked through the syslog file to see if anything is going on, but the computer appears to freeze before it can even write anything to syslog. I've also ran a memtest which came up 100% clean.

I've been having this issue since running 16.04 LTS as well. Upgrading has had no effect on the freezing issue.

I am using Cinnamon desktop environment.

Best Answer

I am crossposing my answer from another similar question here:

I had a similar issue on my system. It would lock up on idle when I left the PC alone for a while. It seems to be a known bug with the C6 deep idle power state on AMD Zen processors.

I created a service that disables this power state on boot and it has been running without issue for a few weeks on my system now, so I uploaded it to OBS for others to use. To install it:

$ wget -nv -O - https://download.opensuse.org/repositories/home:jkist/xUbuntu_18.04/Release.key | sudo apt-key add -
$ sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/jkist/xUbuntu_18.04/ /' > /etc/apt/sources.list.d/home:jkist.list"
$ sudo apt-get update
$ sudo apt-get install amd-disable-c6

Versions for other distributions can be found here

Alternatively, you could try to disable the C6 state in your BIOS. If your BIOS is as crappy as mine, though, you might not have that option or you might have to disable all power saving modes instead of just disabling the C6 state.

Related Question