Debian 9 random freezing on new PC

After installing GNU/Linux to my new PC build a few months ago, I've been having random freezes that are becoming more frequent. The screen freezes with no cursor movement, or response to the keyboard. I first had this issue with Kubuntu, but after weeks not being able to find the source of the problem, I formated the drive and installed Debian 9 instead expecting a fresh install to solve the problem. The continues and seams to happen more often after I connect my android to the PC.Audio continues for a few seconds then stutters and stops. I have the nVidia drivers installed following the Debian 9 documentation, and have tried reseating the GPU. Memtest86+ isn't launching from Grub, so I've tried running memtester a few times, but have gotten no errors. I also have no crashing issues when running Debian live on a USB. All of these things make me suspect that this isn't a hardware issue./var/log/syslog shows an odd \00\ error after some crashes. I've included a few lines before and after the crash:

Feb 19 12:32:24 Hermes tracker-extract[2021]: Could not insert metadata for item with ID 123952: Subject `urn:uuid:d581e393-41e0-ff7d-8621-130081ea3ea2' is not in domain `nie:DataObject' of property `nie:dataSource'
Feb 19 12:32:24 Hermes tracker-extract[2021]: If the error above is recurrent for the same item/ID, consider running "tracker-extract" in the terminal with the TRACKER_VERBOSITY=3 environment variable, and filing a bug with the additional information
Feb 19 12:32:24 Hermes tracker-extract[2021]: Could not insert metadata for item with ID 123952: Subject `urn:uuid:d581e393-41e0-ff7d-8621-130081ea3ea2' is not in domain `nie:DataObject' of property `nie:dataSource'
Feb 19 12:32:24 Hermes tracker-extract[2021]: If the error above is recurrent for the same item/ID, consider running "tracker-extract" in the terminal with the TRACKER_VERBOSITY=3 environment variable, and filing a bug with the additional information
\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00Feb 19 12:36:14 Hermes systemd[1]: Mounted Debug File System.
Feb 19 12:36:14 Hermes kernel: [    0.000000] Linux version 4.9.0-5-amd64 ([email protected]) (gcc version 6.3.0 20170516 (Debian 6.3.0-18) ) #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04)
Feb 19 12:36:14 Hermes systemd[1]: Mounted POSIX Message Queue File System.

Another crash with more lines and file directories replaced with '...' since their names may be sensitive

Feb 19 13:54:53 Hermes systemd[1]: Started PC/SC Smart Card Daemon.
Feb 19 13:54:53 Hermes org.gnome.Documents[1099]: error: The metadata does not have a thumbnail property
Feb 19 13:54:53 Hermes gnome-documents[3512]: Error creating thumbnail for file:///...doc: Unrecognized image file format
Feb 19 13:54:53 Hermes org.gnome.Documents[1099]: error: Could not find thumbnail in zip file
Feb 19 13:54:53 Hermes gnome-documents[3512]: Error creating thumbnail for file:///....docx: Unrecognized image file format
Feb 19 13:54:53 Hermes org.gnome.Documents[1099]: error: The metadata does not have a thumbnail property
Feb 19 13:54:53 Hermes gnome-documents[3512]: Error creating thumbnail for file:///...doc: Unrecognized image file format
Feb 19 13:54:53 Hermes org.gnome.Documents[1099]: error: Could not find thumbnail in zip file
Feb 19 13:54:53 Hermes gnome-documents[3512]: Error creating thumbnail for file:///...: Unrecognized image file format
Feb 19 13:54:53 Hermes org.gnome.Documents[1099]: error: Could not find thumbnail in zip file
Feb 19 13:54:53 Hermes gnome-documents[3512]: Error creating thumbnail for file:///....docx: Unrecognized image file format
Feb 19 13:54:53 Hermes org.gnome.Documents[1099]: error: Could not find thumbnail in zip file
Feb 19 13:54:53 Hermes gnome-documents[3512]: Error creating thumbnail for file:///...: Unrecognized image file format
Feb 19 13:54:54 Hermes Main[3634]: Failed to load module "canberra-gtk-module"
Feb 19 13:54:54 Hermes tracker-extract[1398]: unable to create file '/run/user/1000/dconf/user': Permission denied.  dconf will not work properly.
Feb 19 13:54:55 Hermes org.gnome.Shell.desktop[1264]: Window manager warning: Buggy client sent a _NET_ACTIVE_WINDOW message with a timestamp of 0 for 0x3200048 (Open Datab)
Feb 19 13:54:59 Hermes org.gnome.Shell.desktop[1264]: Window manager warning: Buggy client sent a _NET_ACTIVE_WINDOW message with a timestamp of 0 for 0x3200048 (Open Datab)
Feb 19 13:54:59 Hermes org.gnome.Shell.desktop[1264]: Window manager warning: Buggy client sent a _NET_ACTIVE_WINDOW message with a timestamp of 0 for 0x3200017 (myPassword)
Feb 19 13:55:15 Hermes firefox-esr.desktop[2136]: console.warn: nsLoginManager: searchLogins: `formSubmitURL` or `httpRealm` is recommended
Feb 19 13:55:31 Hermes firefox-esr.desktop[2136]: console.warn: nsLoginManager: searchLogins: `formSubmitURL` or `httpRealm` is recommended
\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00Feb 19 13:56:44 Hermes kernel: [    0.000000] Linux version 4.9.0-5-amd64 ([email protected]) (gcc version 6.3.0 20170516 (Debian 6.3.0-18) ) #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04)
Feb 19 13:56:44 Hermes kernel: [    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.9.0-5-amd64 root=UUID=d9147965-889b-4e4f-99b1-bb2936411c63 ro quiet splash intel_idle.max_cstate=1
Feb 19 13:56:44 Hermes kernel: [    0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
Feb 19 13:56:44 Hermes systemd[1]: Starting Flush Journal to Persistent Storage...

Using a Ryzen 1200, Gtx 1060 6GB, and 8GB GSkill RAM.

Edit 23/02/2018: I've found a clue that might explain the issue. Before every freeze, I have this driver error in /var/log/kern.log:

Feb 23 15:31:42 Hermes kernel: [   25.328836] input: HD-Audio Generic Front Mic as /devices/pci0000:00/0000:00:08.1/0000:12:00.3/sound/card1/input9
Feb 23 15:31:42 Hermes kernel: [   25.328932] input: HD-Audio Generic Rear Mic as /devices/pci0000:00/0000:00:08.1/0000:12:00.3/sound/card1/input10
Feb 23 15:31:42 Hermes kernel: [   25.329018] input: HD-Audio Generic Line as /devices/pci0000:00/0000:00:08.1/0000:12:00.3/sound/card1/input11
Feb 23 15:31:42 Hermes kernel: [   25.329102] input: HD-Audio Generic Line Out as /devices/pci0000:00/0000:00:08.1/0000:12:00.3/sound/card1/input12
Feb 23 15:31:42 Hermes kernel: [   25.329770] input: HD-Audio Generic Front Headphone as /devices/pci0000:00/0000:00:08.1/0000:12:00.3/sound/card1/input13
Feb 23 15:31:42 Hermes kernel: [   25.786212] Adding 8319996k swap on /dev/sda3.  Priority:-1 extents:1 across:8319996k FS
Feb 23 15:31:42 Hermes kernel: [   25.963539] input: HDA NVidia HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:03.1/0000:09:00.1/sound/card0/input14
Feb 23 15:31:42 Hermes kernel: [   25.963975] input: HDA NVidia HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:03.1/0000:09:00.1/sound/card0/input15
Feb 23 15:31:42 Hermes kernel: [   25.965993] input: HDA NVidia HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:03.1/0000:09:00.1/sound/card0/input16
Feb 23 15:31:42 Hermes kernel: [   25.966456] input: HDA NVidia HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:03.1/0000:09:00.1/sound/card0/input17
Feb 23 15:31:45 Hermes kernel: [   30.883926] IPv6: ADDRCONF(NETDEV_UP): enp6s0: link is not ready
Feb 23 15:31:45 Hermes kernel: [   30.906709] r8169 0000:06:00.0: firmware: failed to load rtl_nic/rtl8168g-2.fw (-2)
Feb 23 15:31:45 Hermes kernel: [   30.906762] r8169 0000:06:00.0: Direct firmware load for rtl_nic/rtl8168g-2.fw failed with error -2
Feb 23 15:31:45 Hermes kernel: [   30.906769] r8169 0000:06:00.0 enp6s0: unable to load firmware patch rtl_nic/rtl8168g-2.fw (-2)
Feb 23 15:31:45 Hermes kernel: [   30.920959] r8169 0000:06:00.0 enp6s0: link down
Feb 23 15:31:45 Hermes kernel: [   30.921002] r8169 0000:06:00.0 enp6s0: link down
Feb 23 15:31:45 Hermes kernel: [   30.921043] IPv6: ADDRCONF(NETDEV_UP): enp6s0: link is not ready
Feb 23 15:31:49 Hermes kernel: [   34.752112] r8169 0000:06:00.0 enp6s0: link up
Feb 23 15:31:49 Hermes kernel: [   34.752123] IPv6: ADDRCONF(NETDEV_CHANGE): enp6s0: link becomes ready
Feb 23 15:31:50 Hermes kernel: [   35.493690] NVRM: Your system is not currently configured to drive a VGA console
Feb 23 15:31:50 Hermes kernel: [   35.493692] NVRM: on the primary VGA device. The NVIDIA Linux graphics driver
Feb 23 15:31:50 Hermes kernel: [   35.493693] NVRM: requires the use of a text-mode VGA console. Use of other console
Feb 23 15:31:50 Hermes kernel: [   35.493693] NVRM: drivers including, but not limited to, vesafb, may result in
Feb 23 15:31:50 Hermes kernel: [   35.493694] NVRM: corruption and stability problems, and is not supported.
Feb 23 15:31:50 Hermes kernel: [   35.494445] nvidia-modeset: Allocated GPU:0 (GPU-2461ba41-089f-56ba-dc6d-78e54e3662b2) @ PCI:0000:09:00.0
Feb 23 15:32:12 Hermes kernel: [   58.359483] snd_hda_codec_hdmi hdaudioC0D0: HDMI: invalid ELD data byte 11
Feb 23 15:32:13 Hermes kernel: [   60.145642] fuse init (API version 7.26)

Solution 1:

I have a similar issue, which I found others reporting elsewhere on the web:

Using buggy Gnome drivers: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=767173

Missing a driver: http://forums.debian.net/viewtopic.php?f=6&t=135457

ALT+F2 R seems to resolve the issue for some. For others, using another desktop besides Gnome seems to fix the problem.

More things you can try here: https://unix.stackexchange.com/questions/31818/what-to-do-when-a-linux-desktop-freezes