Showing posts with label kernel. Show all posts
Showing posts with label kernel. Show all posts

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.

Thursday, November 6, 2014

Edimax EW-7811Un Wi-fi dongle on Ubuntu


The EW-7811Un is a cheap and fairly ubiquitous Wi-fi dongle.  If your Ubuntu installation doesn't come with a driver; here's how to get it working.  I'm using Ubuntu 13.04.


This wi-fi dongle is based on the RTL8188CUS chip.  Verify that this part number shows up on lsusb (mine's on the top line):


Do a Google search for RTL8188CUS driver, download and unzip the driver (from the Realtek site is better).  It should be called RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911.zip (md5: 5f15575ba6ae58cae485e8060bc771ed).  You should see this:




Go to driver/, extract the .tar.gz.  Then all you should need is a make and a (sudo) make install to be in business.