Wednesday, May 18, 2016

Acer Aspire Ubuntu "Freezing" Issue (Ubuntu 14.04, 16.04).

Starting from late last year, and continuing into the time of writing (May 2016), there have been several long threads on the kernel bug tracking system (bugzilla.kernel.org), the Ubuntu Forums and Launchpad with dozens of infuriated Acer Aspire users experiencing spontaneous, randomly-timed freezes which affect Ubuntu 14.04 (Trusty Tahr), Ubuntu 16.04 (Xenial Xerus), and perhaps earlier releases too (although I cannot find any evidence for this). 

One user tried downgrading his kernel; another upgrading his kernel; both to no avail.  Later another user reports it to be a "...horrible bug affecting BayTrail users", with "little activity from Intel or kernel devs to fix it".  Bay Trail is an an SoC architecture common on many Acer Aspire machines. 

The good news is that there's one solution which truly works; the bad news is that it will severely affect your battery life.  So don't chuck out your laptop, but remember to put that power supply into your bag before going to Uni or work.

Here's the fix.  Add the following parameter into Grub:


intel_idle.max_cstate=1

When altering kernel parameters you should always 'test' it out first before applying it permanently.

To 'test' out the kernel parameter enter into grub (press "SHIFT" repeatedly during your computer's POST (power-on-self-test) phase) to enter grub and you should enter a GRUB screen which looks something like this:

It might look different depending on your desktop environment.  I use Ubuntu Mate and mine looks like this:

As you can see the options are still the same; they just look different.

Select the option which your normally boot from and press 'e' to edit it.  Locate the line mentioned earlier beginning with 'linux', and add the new bootarg  intel_idle.max_cstate=1
(sometimes also called a "boot parameter" or bootparam) somewhere towards the end of the line.  Press ctrl+x or F10 to boot using this param.  If the kernel can boot successfully without any issues and you can login, you know this fix is safe to apply for good and for every time you reboot your system.

Type the following command into your terminal:
sudo vim /boot/grub/grub.cfg

Make the same modification that you made from the Grub screen, save and exit.  You will most likely need to save with "w!" because grub.cfg is a read-only file.

Now this bootarg will be set for the next time you reboot and every subsequent reboot; and hopefully for you, the freezing issue will be gone.  But at what cost?  We mentioned earlier that there was a power-consumption side effect to this fix.  It has to do with a CPUs "C-states" and "P-states".

"C-states" are "power consumption states" and can be thought of as different levels of "sleep".  A CPU, or any one of its individual cores, if it is not currently doing anything would effectively be "driving around in circles", which wastes power.  The solution to this is that CPUs have different "C-states" starting from C0 right up to Cn where n is the highest C-state.  The higher the C-state level and the higher the value of n, the lower the transistors' quiescent (resting) voltage is, and the lower the transistors' switching frequency is; both of which drastically affect power consumption.  CPUs enter high levels of "n", during longer periods of "doing nothing".

Looking back at the fix we applied, we have limited our Baytrail chip's C-state to "1" (intel_idle.max_cstate=1).  One could only deduct from this fix that entering into one of the higher C-states or exiting out of them is what is causing the kernel to freeze.

So-called "P-states" are to do with performance.  During periods where the CPU is executing tasks, but the CPU utilization is not 100%, the CPU may enter into high "P-states"  in order to further save power.

6 comments:

  1. thank you so much for this fix. my ubuntu installation is *finally* bearable to use!

    ReplyDelete
  2. No worries! Thanks for stopping by.

    ReplyDelete
  3. Spent ages trying to sort out my constantly freezing Acer B115 before following your clear description. Many thanks for helping me finally sort it.

    ReplyDelete
  4. This was the solution for the freezing problems on my Acer Travelmate B115. Thanks a lot!

    ReplyDelete
  5. I would like to thank you for this tipp and suggest to make the permanent change in /etc/default/grub to persist it over kernel updates.

    ReplyDelete