Ubuntu – Ubuntu 15.10 and 16.04 keep freezing randomly

15.1016.04freeze

This issue i had it with 15.10 and it's still here after the 16.04 upgrade.
The whole system freezes, no keyboard/mouse input works anymore. I tried a variety of keyboard combinations (found on the internet, like Alt+SysRq+REISUB and others), but none actually worked. The system is completely unresponsive, only a force shutdown works at this point.
Interestingly, i can't correlate this freeze with any specific program or application, as the system hangs sometimes even while doing the simplest operations like opening the Terminal, or the Unity search.

I would be interested if there is any log saved that could contain useful information on these hangs.

Thank you.

Best Answer

I was facing a similar problem on my Ubuntu 16.04. It used to freeze randomly a lot and I had to perform a forced shutdown each time.

Upgrading the kernel to 4.7-rc3 did not work for me!

I found out that there was no swap memory area allocated(sudo swapon --show returned nothing and free -h showed there was 0B space allocated for swap memory) for my Ubuntu OS(I have a dual-boot system: Windows 7 & Ubuntu 16.04). I allocated swap space for Ubuntu and guess what, the problem is gone! Hope this helps. :)

Edit: I was wrong! This problem was not solved and it has nothing to do with swap memory, though allocating swap memory apparently fixed another type of freeze where continuous hard disk access occurs during the freeze and where it is possible to kill the latest process forcefully (by typing alt+sysrq+F from keyboard) to recover from the freeze.

However, this problem(where nothing but forced shutdown works to recover from the freeze) may be related to the kernel and if kernel upgrading cannot solve the problem, then a workaround could be to add the statement intel_idle.max_cstate=1 in the grub configuration file:

STEPS

  1. sudo nano /etc/default/grub
  2. There is a line in that: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" (like this), replace with: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_idle.max_cstate=1"
  3. Save it (CTRL+O)
  4. sudo update-grub
  5. sudo reboot

I will try this if I face the problem again(since in my case this problem is very rare now, occurred only once within a week after swap allocation, which led to the confusion), but there are people who have solved this kind of problem by this workaround.

Late update: Actually, I tried the above-mentioned workaround a couple of weeks after posting the Edit (most probably because the problem reappeared again, but it was not frequent for sure). After modifying the grub file, the problem was resolved completely and I have not come across any type of freezing after that, so this workaround seems to be a good one! :) Sorry for the late update.

Related Question