Try installing newer kernels. In some cases, it fixes the problem of freezing that caused by bad high precision timer code. This is binary for Linux 4.5.2:
http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.5.2-wily/
Download appropriate 3 .deb
binary packages, install them, and reboot to the new kernel. I hope this will fix your problm. By the way, Ubuntu 16.04 is alraedy out with a new kernel, so do a clean install (not an upgrade) and see if it fixes your problem.
TL;DR - my research suggests it's not fixed in the 17.04 beta image or in the release, but I have high hopes for 17.10.
These freezes happen when the processor attempts to enter a low-power state (c-state) that the kernel does not support. This problem was introduced by
commit 8fb55197e64d5988ec57b54e973daeea72c3f2ff
Date: Tue Apr 7 16:20:28 2015 +0100
drm/i915: Aggressive downclocking on Baytrail
This went upstream in kernel 4.2, and we have been having issues since then. As explained in heynnema's answer (and this post where I have tried to collate information) there is a straightforward and effective workaround, passing a boot parameter that disables the low power states.
The beta version of 17.04 currently available uses 4.9 (it's based on the upstream 4.9.6 as I understand), and by the time the release comes out in April, I believe it will be using 4.10. The problem still exists in these kernels, so I have concluded that it is not fixed as of now. I checked the Ubuntu kernel changelogs, and found nothing, but please correct me if I am wrong.
I have been tracking the c-state bug here on kernel.org for a long time. In January 2017, Mika Kuoppala added this patch to the thread. Apparently, it reverts the earlier commit that caused the problem. The patch is called
drm/i915/byt: Avoid tweaking evaluation thresholds
Testing indicates very good results with this patch, which was submitted to the i915 driver owners on 25th January. All being well, it could be merged in the 4.11 window. The 4.11 kernel may be released around the end of April. A version of this patch was merged in the 4.11 window and reports indicate that the bug is fixed in 4.11.
Each of the troublesome BayTrail processors behaves a little bit differently with each different kernel. In 16.04 (4.4 kernel) my uptime on Atom Z3735F without the intel_idle parameter was around 15 minutes before freezing. I tested the beta 17.04 ISO in live mode, and I didn't get a freeze in 90 minutes, so it seems like I'm lucky with this kernel. You can do the same thing to test any image on your system - just make a bootable USB and "try Ubuntu without installing" and test it for as long as possible.
When 17.04 came out, I installed it, and in the first two weeks I ran it without the intel_idle
parameter, I only had three c-state freezes, which is a huge improvement on earlier versions.
The safest thing to do is use the boot parameter. Based on my research I am expecting the bug to be fixed in 17.10 (and in other distro releases later this year) which will be using a kernel >=4.11, but not in 17.04.
However, there's always the possibility that the Ubuntu Kernel Team may patch it themselves. If you can tolerate running an unstable system occasionally, you can watch for progress by running regular updates (sudo apt update && sudo apt full-upgrade
) and testing each new kernel without the boot parameter when it arrives. You can also read the changelogs as new packages are installed or (again, if you can tolerate instability) install a mainline kernel.
Best Answer
Your processor is affected by the c-state bug
This causes total freezes when the CPU tries to enter an unsupported sleep state. It's a problem for many Bay Trail devices especially with newer (4.*) kernels.
Affected processors AFAIK:
(please (suggest an) edit to add your own device if affected)
Complete list of Bay Trail processors may be found here
There is a simple workaround for this until it gets properly fixed upstream.
You just need to pass a kernel boot parameter and the random freezing stops completely. The parameter may increase battery consumption slightly, but it will give you a usable system.
You do this by editing the configuration file for GRUB:
Boot Ubuntu and open a terminal by pressing Ctrl+Alt+T then type
Find the line that starts
GRUB_CMDLINE_LINUX_DEFAULT=
This needs to be changed to include
intel_idle.max_cstate=1
So after your edit it reads something like
quiet
andsplash
are default parameters for Ubuntu Desktop - no need to change them, or any other pre-existing parametersNow save the file by pressing ctrl+o then enter and exit by pressing ctrl+x
Now run
Then reboot.
What to do if you don't have enough time to do this before the system hangs
No problem. As explained on the help page I linked to earlier, you can add the parameter to GRUB before booting. Note that this only passes the parameter for the current boot, so you still have to edit
/etc/default/grub
once you have booted to make the change permanent.You need to get to the GRUB menu. If you are dual booting this will appear anyway, if not you have to press and hold (or tap) shift after pressing the power button to turn on.
When you get to this screen select Advanced Options for Ubuntu. You can move the cursor to a different kernel, or leave it in place to edit options for the default. Instead of pressing enter, press e and you will go into edit mode, looking vaguely like this.
Move the cursor down to where it says
quiet splash
, put a space after splash and carefully typeintel_idle.max_cstate=1
making sure there is a space after it as well.Now press F10 or Ctrl+x to boot.