Ubuntu 16.04 on the Gigabyte P34w v5

11 June 2016

A few days ago I attempted to upgrade my Gigabyte P34w v5 from Ubuntu 15.10
(whose installation I documented
in a previous post
) to Ubuntu 16.04 using the auto-upgrade functionality. Suffice it to say, that process
failed miserably due to some PPAs I forgot to disable. I salved the system, but something
really low level in the OS was busted so badly I was getting random segfaults from several
system-level binaries and couldn’t load modules into the kernel. Thus, it was time to do
a fresh install of Ubuntu 16.04.

Suffice it to say support for the Gigabyte p34w v5 remains quite poor in the Ubuntu 16.04
installer. In particular, (1) the 4.4 kernel shipped with the installer has exceptionally
poor support for the Intel Skylake i7-6700HQ in the laptop, and (2) nouveau 1.0.12 does
not appear to function correctly with either the NVIDIA GTX 970m or optimus setup found
in the laptop. If you boot the installer and follow the standard installation method,
the machine will more than likely lock up (cores get stuck in a low-power state) or
you will encounter a slew of graphical issues once the installer is up and running.

A simple workaround for all of these problems is to simply install the server variant
of Ubuntu 16.04, upgrade the kernel from
the mainline kernel repository, and
then install the desktop of your choice. However, I want to use my SSD to provide
block-level caching (e.g. bcache)
of my my hard drive, thus I need access to a full shell during the installation process.

Installation

Turn on the system and enter into the BIOS. Disable the discrete GPU by setting the
XXXX graphic setting to “Disabled”. Save and exit. Your machine will need to restart
twice for the settings to apply.

Run the 16.04 installer. At the first menu (where you can choose how
to run the OS image), highlight either the “try Ubuntu” or “install Ubuntu”
option and press the e key to edit the command-line option.

Navigate down to the line that begins with linux. Insert the text
intel_idle.max_cstate=0 into the line prior to the triple-hyphens like this:

linux ... ro quiet splash intel_idle.max_cstate=0 ---

Press F10 to boot. Complete the installation, reboot the machine.
(If you are going to install bcache, you do this before rebooting following the same
instructions as
found in my previous post on the topic
)

After the BIOS screen disappears, press ESC (or hold left shift, I’m not sure which
works properly) to to get the GRUB boot menu.

Edit the default kernel line (e.g. the one selected) to add the same text as above.
Continue booting Ubuntu to press F10.

Now download and install the latest 4.6 variant of the Linux Kernel from
the mainline kernel repository.
At the time of this writing, it is 4.6.2. You can do this using the following commands:

Note: I am recommending the 4.6.x kernels rather than 4.7.x because NVIDIA’s drivers packaged
with CUDA 7.5 (nvidia-352) and 8.0 (nvidia-361) do not build against 4.7.x kernels without
some tweaking yet.

After you have verified that your machine boots correctly, you can proceed with installing
the graphics drivers. Don’t enable the NVIDIA GPU until you have finished the NIVDIA driver
installation!

NVIDIA Graphics and GPU computing capabilities

Visit the NVIDIA developer center
and download the latest CUDA driver. For my installation I registered with the developer
network and downloaded the CUDA 8.0 release candidate. The CUDA 7.5 x86_64 DEB package for
Ubuntu 15.04 should be ok. If it doesn’t build against 4.6, simply install Linux 4.5.7 or
later to get decent support of the CPU. You can grab the CUDA 7.5 DEB package directly from here:

SSD Caching (via. bcache)

The process for enabling bcache support is identical to my previous post
previous post for Ubuntu 15.10.
Just remember you need to create the bcache device prior to the partitioning step of the
installer.

Post-install

Keyboard

As before, the left super / Windows key is, in reality, wired to the right super / Windows key
so some window managers (e.g. Gnome) will need to be reconfigured to use the right super
key for the window selection function. Gnome, in particular, has this as an option in
gnome-tweak-tool

Touchpad

Ubuntu 16.04 uses libinput for managing keyboards and mice. I found that the mouse acceleration
was really wacky on first boot so I had to change it using xinput. You can see and modify
settings using xinput as follows:

List the input devices on your computer:

xinput --list --short

The touchpad is the “ETPS/2 Elantech Touchpad” device. You can set values by name, or
by the numeric ID. For example, to get a list of properties on my touchpad (device 15) I
can issue the following command:

Optimus / bumblebee

Update: on 2016 October 29

As it turns out, the Gigabyte P34w v5 (and the P35 variant) both use a BIOS
that has a bug in its ACPI tables which cause
several issues
with bumblebee on this laptop. As of 2016 October 29, the bug has not been
fixed in a BIOS update, so we have to use the work around provided by user
Lekensteyn in the previous link to change the OS reported to the BIOS
by the Linux kernel.

To do this, simply edit your /etc/default/grub configuration file using
your favorite editor and sudo. In the
GRUB_CMDLINE_LINUX_DEFAULT entry, add acpi_osi=! acpi_osi=\"Windows 2009\""
so that the entry appears like this:

After this, run sudo update-grub. After this I think bumblebee will function
like normal; however, I am still using the same procedure as I posted for
bumblebee on the P34w v5 for Ubuntu 15.10
as it gives me a little more control over when the daemon is running.
Happy gaming!