Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Brainiarc7
Last active May 9, 2020 15:28
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Brainiarc7/f7da590bee1ed35ac5ed258ff9335fd6 to your computer and use it in GitHub Desktop.
Save Brainiarc7/f7da590bee1ed35ac5ed258ff9335fd6 to your computer and use it in GitHub Desktop.
Installing Ubuntu 18.04LTS on the Eurocom Q6, among other tweaks.

Installing Linux on the Eurocom Q6:

For starters,

If you are dual booting, install Windows first, and partition from there with a tool such as Minitool. You'll only need two partitions, one for root and optionally, a small one for swap (say, 8GB). Partition them as appropriate, and when done, reboot into the UEFI menu and ensure that:

(a). Secure boot is disabled (otherwise you won't be able to load up proprietary drivers needed for the Nvidia GPU).

(b). Confirm that you're booting in UEFI mode ONLY. This is the default. CSM should remain disabled. Here's why.

(c). Ensure that SATA mode in the BIOS is set strictly to AHCI. RAID mode will NOT work with Linux.

The standard Ubuntu 18.04LTS ISOs will not work, for two reasons:

  1. The desktop edition acts up badly with both the touchpad and external mice, so even if you get to load the live environment (after blacklisting the nouveau driver via the pre-boot grub option blacklist=nouveau), you won't be able to proceed with the next steps such as guided partitioning, etc.

  2. The Ubuntu server image offered on the main download page disallows the use of existing partitions on your SSDs, which could be detrimental if you're dual booting. And this is where the alternate ISO comes in. Fetch it from here: http://cdimage.ubuntu.com/releases/18.04/release/

Then, create a bootable flash drive using etcher.io . If you can get Rufus to work with your flash drives (I had no such luck), you can use that too. When done, leave the USB drive plugged in and reboot to your UEFI (firmware settings). The shortcut is F2. Therein, go to the exit menu, boot override, and select your flash drive's partition with Linux on it. It will be listed as "drive-name/partition-number".

At this point, you'll also want to ensure that you have a plugged in Ethernet cable at the ready. The installer will be able to configure it as appropriate (select DHCP, its' the fastest option when you get to that point).

Start the Ubuntu server installer as you would, and take note of the custom partitioning settings:

(a). For the partition designated for root, set its' file-system as ext4, mount point /. Simple.

(b). The swap partition will be automatically recognized, if you so chose to have one.

(c). The ESP, where the UEFI-based installation boots from, will also be automatically detected and mounted as needed. This is that 100MB~ partition that the Windows installer creates and is marked as 'SYSTEM RESERVED'. Read more about it here.

The rest should be pretty straight-forward, even if you're new to Linux. The guided installer is driven primarily by keyboard input, needs no mice and you won't run into any modesetting issues. Use this as a refresher.

When done, reboot. You'll notice that grub will be the default boot manager. Go back to Linux so we can finish setting up the desktop.

When done booting, log in (with the username and password you set up earlier) and install the latest updates first. Remember that ethernet cable you had to plug in? That interface was configured by the installer, and its' configuration remains persistent , thanks to a new abstraction layer in 18.04LTS named netplan.io.

Now, update your system:

Run:

sudo apt-get -y update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade

Next, install the Ubuntu desktop via tasksel:

sudo tasksel install ubuntu-desktop

You can see the list of alternate environments by running:

tasksel --list-task

For example, if you want KDE, you could run:

sudo tasksel install kubuntu-desktop

When you're done with that step, proceed to the next bit: The drivers for your GPUs.

Next, add the NVIDIA proprietary driver repository and Oibaf's PPAs as shown:

sudo add-apt-repository ppa:graphics-drivers/ppa -y && sudo add-apt-repository ppa:oibaf/graphics-drivers

Then update your software sources:

sudo apt-get update

Followed by an upgrade (to deploy the latest FOSS GPU drivers for your Intel card):

sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade

And now, install the latest NVIDIA driver (R396 as of the time of writing):

sudo apt-get -y install nvidia-driver-396

For Conky, install the conky-all package:

sudo apt install conky-all

When done, make the following changes to your grub configuration file, ensuring that the line below looks exactly as shown (under /etc/default/grub, use your preferred editor):

GRUB_CMDLINE_LINUX_DEFAULT="acpi_osi=! acpi_osi='Windows 2009' blacklist=nouveau elevator=deadline drm.debug=0xe quiet splash"

The important options there are as follows:

  1. The acpi_osi setting ensures that you won't hang on reboot, or get stuck with lspci. It compensates for how Linux handles ACPI table parsing on these newer models.

  2. Blacklist nouveau here because that module, if loaded, will lock up your system.

  3. The elevator=deadline option selects the deadline scheduler for all block devices on the system. Ideal for SSDs.

  4. The drm.debug=0xe is important for catching any issues with Direct Rendering early on in the kernel log (dmesg). You can safely omit it.

Now, generate new grub configs by running:

sudo update-grub

And reboot at this stage.

When you boot up, you'll be greeted by the fruits of your labor as shown below: A clean, minimalist Ubuntu desktop that you can tweak to your heart's content.

That's mine running Conky.

Conky in its' glorious simplicity

And building libvpx, etc.

A clean, minimalist look

And as you can see, things get toasty when compiling stuff. I'm seeing high 80s on some workloads.

Cooling a 45W hexacore processor on such a thin chassis is tough work

Here's the LTE module on Linux (The Qualcomm Snapdragon X5):

Modem manager can show you the status of the LTE module, including signal strength and connection state, including statistics on throughput and location data, if supported. The libqmi implementation for this device doesn't expose GNSS sensor data, so its shown as unsupported.

So far, no show stoppers encountered so far.

A few caveats:

  1. The audio jack works now (see the change made to /usr/share/pulseaudio/alsa-mixer/paths/iec958-stereo-output.conf above).

  2. Keyboard backlight control can be resored by the use of the tuxedo-keyboard wmi driver as shown in the gist file below that documents the installation steps.

  3. The LTE module needs a udev rule to initialize correctly. Fetch it from here:https://github.com/borovsky/x5-snapdragon-linux

  4. Fan control would also be welcome under Linux for Clevo laptops. This, according to tuxedo Linux crew, will be coming soon.

  5. The red SPDIF light can also be annoying. See the alias provided above that you can use to turn it off.

  6. The fingerprint reader does not work under Linux at the moment. This is a part made by Synaptics, labelled as the Synaptics WBDI platform (usb 073).

See the conky script above. Note that you'll need to set hddtemp in daemon mode if you want HDD temps in the app:

Notes:

For hard drive temperature, ensure that hddtemp is running as a daemon. You can do that by editing /etc/default/hddtemp and ensuring that RUN_DAEMON is set to TRUE. When done, restart the hddtemp unit service by:

sudo systemctl restart hddtemp.service

On autostart: https://wiki.archlinux.org/index.php/conky#Autostart

You can switch your system to NetworkManager control with the following instructions.

netplan is configured in a "yaml" file in /etc/netplan/ The configuration file may have different names on different systems. On my install the file name is 01-netcfg.yaml.

Lets make a backup copy of that yaml file and edit the existing one to use NetworkManager.

cd /etc/netplan
sudo cp 01-netcfg.yaml 01-netcfg.yaml-backup

Now edit 01-netcfg.yaml using your editor of choice (and use sudo). Change the file so it looks like,

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: NetworkManager

Then run the following to make the new setup,

sudo netplan generate
sudo netplan apply

Lastly restart the NetworkManager service,

sudo systemctl restart NetworkManager.service

You are now using NetworkManager.

You'll also need these additional steps:

  1. Install dnsmasq
  2. Configure it (listen address and DNS servers).

Now, install the package:

sudo apt -y install dnsmasq

Populate the dnsmasq.conf configuration file:

sudo su
tee -a /etc/dnsmasq.conf << ENDdm
interface=lo
bind-interfaces
listen-address=127.0.0.1
# DNS server from Cloudflare and Google. Use yours...
server=1.0.0.1
server=8.8.8.8
ENDdm

Start the service and enable it at boot:

systemctl restart dnsmasq
systemctl enable dnsmasq

And now you're all set up.

PS: Confirm that NetworkManager's config file is sane, under /etc/NetworkManager/NetworkManager.conf.

[main]
plugins=ifupdown,keyfile

[keyfile]
unmanaged-devices=*,except:type:wifi,except:type:wwan,except:type:ethernet

[ifupdown]
managed=true

Getting NVIDIA HDMI Audio to work in NVIDIA prime-select mode

By default, even with the NVIDIA GPU left enabled by default (as recommended here), HDMI audio will be unavailable due to a known bug.

The audio chip on the nvidia GPU is disabled at boot, most likely due to an ACPI table parsing bug as described below.

This isn't a problem on Windows as the proprietary driver handles the initialization of the GPU's audio controller upon handshaking with an audio-ready HDMI device. This, however, is not the case on Linux.

See:

  1. https://devtalk.nvidia.com/default/topic/1024022/linux/gtx-1060-no-audio-over-hdmi-only-hda-intel-detected-azalia/?offset=4

  2. https://bugs.freedesktop.org/show_bug.cgi?id=75985

There's a fix available for this, which you can install, as shown below:

git clone https://github.com/hhfeuer/nvhda
cd nvhda
sudo make -f Makefile.dkms

When done, regenerate initramfs and update the grub menu, followed by a reboot:

sudo update-initramfs -u
sudo update-grub

Then reboot to test your changes.

Module usage:

Load Module:

sudo modprobe nvhda

Get status:

cat /proc/acpi/nvhda

Turn audio on/off:

sudo tee /proc/acpi/nvhda <<<ON sudo tee /proc/acpi/nvhda <<<OFF

Check dmesg for messages.

Credit: https://github.com/hhfeuer/nvhda

Now, you can select the HDMI audio device profile via pavucontrol.

Keyboard Backlight control under Linux:

On Linux, you can now use the refactored (and work in progress) tuxedo WMI keyboard handler driver , installed as shown below.

Where it differs mostly from the older tuxedo-wmi driver is the dropping of the model lookup table and instead relies on Clevo-specific GUIDs for WMI handling, which should help in:

(a). Reducing the code base's footprint.

(b). A sub-vendor agnostic approach in supporting newer devices, and

(c). Splitting the WMI module into smaller and discrete components (one for Keyboard backlighting, another for hwmon, another for fan controls, etc).

Installing this module:

On Ubuntu, use only the DKMS route. Stress free.

The steps below will fetch, build, and install this as a DKMS module:

mkdir -p ~/clevo && cd clevo
git clone https://github.com/tuxedocomputers/tuxedo-keyboard
cd tuxedo-keyboard
make clean
sudo cp -R . /usr/src/tuxedo_keyboard-1
sudo dkms add -m tuxedo_keyboard -v 1
sudo dkms build -m tuxedo_keyboard -v 1
sudo dkms install -m tuxedo_keyboard -v 1

Now, prepare to load this as on boot:

Add the tuxedo_keyboard module to /etc/modules by running:

sudo su
echo tuxedo_keyboard >> /etc/modules

Configuring the module:

Create /etc/modprobe.d/tuxedo_keyboard.conf and populate it with the appropriate arguments for the module. See this for reference.

My example, which uses the random keyboard backlight mode:

I created the file /etc/modprobe.d/tuxedo-keyboard.conf with the content:

options tuxedo_keyboard mode=5

Then rebooted the machine.

The Intel wireless driver (iwlwifi) can be tuned even further.

Edit /etc/modprobe.d/iwlwifi.conf and add the following:

# /etc/modprobe.d/iwlwifi.conf
# iwlwifi will dyamically load either iwldvm or iwlmvm depending on the
# microcode file installed on the system.  When removing iwlwifi, first
# remove the iwl?vm module and then iwlwifi.
#remove iwlwifi \
(/sbin/lsmod | grep -o -e ^iwlmvm -e ^iwldvm -e ^iwlwifi | xargs /sbin/rmmod) \
&& /sbin/modprobe -r mac80211


#Fuck Ubuntu's default. We finna roll this shit :-) 

options iwlwifi 11n_disable=8

That should fix the performance issues observed with Wireless N access points on the Netgear R7000.

Original documentation from the Intel wireless entry on the Arch Wiki.

Create the file /usr/share/pulseaudio/alsa-mixer/paths/iec958-stereo-output.conf and populate it with:
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of the
# License, or (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
[General]
description = Headphones + Digital Output (S/PDIF)
[Element IEC958]
switch = mute
When done, issue a reboot.
alignment top_right
background = true
border_width 1
color1 07CC0D
color2 D1E7D1
color3 FF0000
color4 FFFFFF
cpu_avg_samples 2
default_color D1E7D1
default_outline_color white
default_shade_color white
double_buffer yes
draw_borders no
draw_graph_borders yes
draw_outline no
draw_shades no
#gap_x 20
#gap_y 20
border_outer_margin 20
max_port_monitor_connections 64
maximum_width 500
minimum_width 500
# max_specials 512
max_user_text 16384
minimum_size 330 10
net_avg_samples 2
no_buffers yes
out_to_console no
# wm_class_name Conky
stippled_borders 2
# wn_window yes
#settings to define how to draw the window. compiz needs these settings, adjust for your WM
own_window true
own_window_class Conky
#own_window_type override
#own_window_class conky-semi
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes
own_window_argb_visual yes
own_window_argb_value 50
update_interval 2
uppercase no
use_xft yes
xftalpha 0.8
xftfont Bitstream Vera Sans Mono:size=9
# WIDTH = 500pixel, ${goto 270} for 2 column designs
# SMALL BAR HEIGHT: 12, LARGE GRAPH HEIGHT: 240
TEXT
${color1}$nodename ${alignr}$kernel
${color1}Uptime:${color} $uptime ${color1} ${alignr}Load:${color} $loadavg
$hr
${alignr}${color1}RAM: $memperc% = $mem / $memmax
${color #88cc00}${cpugraph 60,240 07CC0D FF0000 -t} ${goto 270}${color #88cc00}${memgraph 60,250 07CC0D FF0000 -t}
${execi 1000 cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //'| uniq | cut -c 1-26}
${font sans-serif:bold:size=8}PROCESSOR UTILIZATION & FREQUENCY ${hr 2}${font}
CPU1: ${cpu cpu1}% $alignr ${freq (1)} MHz $alignr ${cpubar cpu1 8,60}
CPU2: ${cpu cpu2}% $alignr ${freq (2)} MHz $alignr ${cpubar cpu2 8,60}
CPU3: ${cpu cpu3}% $alignr ${freq (3)} MHz $alignr ${cpubar cpu3 8,60}
CPU4: ${cpu cpu4}% $alignr ${freq (4)} MHz $alignr ${cpubar cpu4 8,60}
CPU5: ${cpu cpu5}% $alignr ${freq (5)} MHz $alignr ${cpubar cpu5 8,60}
CPU6: ${cpu cpu6}% $alignr ${freq (6)} MHz $alignr ${cpubar cpu6 8,60}
CPU7: ${cpu cpu7}% $alignr ${freq (7)} MHz $alignr ${cpubar cpu7 8,60}
CPU8: ${cpu cpu8}% $alignr ${freq (8)} MHz $alignr ${cpubar cpu8 8,60}
CPU9: ${cpu cpu9}% $alignr ${freq (9)} MHz $alignr ${cpubar cpu9 8,60}
CPU10: ${cpu cpu10}% $alignr ${freq (10)} MHz $alignr ${cpubar cpu10 8,60}
CPU11: ${cpu cpu11}% $alignr ${freq (11)} MHz $alignr ${cpubar cpu11 8,60}
CPU12: ${cpu cpu12}% $alignr ${freq (12)} MHz $alignr ${cpubar cpu8 12,60}
${color #88cc00}Swap Usage: $swapperc% = $swap/$swapmax ${color #88cc00} ${swapbar 4 color1 color3}
$hr
${color1}Net Down:${color} ${downspeed wlp3s0} ${goto 270}${color1}Net Up:${color} ${upspeed wlp3s0}
${color1}${downspeedgraph wlp3s0 60,240 07CC0D FF0000 -t}${color1} ${goto 270}${upspeedgraph wlp3s0 60,250 07CC0D FF0000 -t}
$hr
${color1}Temperatures in Celsius:
${color1}HDDs ${color} ${hddtemp /dev/sda}
${color1}CPUs ${color} ${hwmon 1 temp 1} ${hwmon 1 temp 2}
#GPU Attributes:
${color1}GPU:${color #FCAF3E}${exec nvidia-smi --query-gpu=gpu_name --format=csv,noheader,nounits} $color
${color1}GPU Temperature ${color} ${nvidia temp} °C
${color1}GPU Utilization ${color} ${exec nvidia-smi | grep % | cut -c 61-63} %
${color1}GPU Core Frequency ${color} ${nvidia gpufreq} MHz
${color1}GPU Memory Frequency ${color} ${nvidia memfreq} MHz
${color1}VRAM Utilization ${color} ${exec nvidia-smi | grep % | cut -c 37-40} MB
${color1}GPU Power Draw ${color} ${exec nvidia-smi | grep % | cut -c 21-23} W
${color1}Top Processes:
${color1}Name PID CPU% MEM% TIME USER
${color}${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1} ${top time 1} ${top user 1}
${color}${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2} ${top time 2} ${top user 2}
${color}${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3} ${top time 3} ${top user 3}
${color}${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4} ${top time 4} ${top user 4}
${color}${top name 5} ${top pid 5} ${top cpu 5} ${top mem 5} ${top time 5} ${top user 5}
$hr
#${color Tan2}ESTABLISHED Connections${color DarkSlateGray}${hr 2}
#
#${offset 10}${color lightgrey}Inbound: ${color white}${tcp_portmon 1 32767 count} ${color lightgrey}Outbound: ${color white}${tcp_portmon 32768 61000 count}${alignr}${color lightgrey}Total: ${color white}${tcp_portmon 1 65535 count}
#
#${color slate grey}Process ${color slate grey}Remote Host ${color slate grey}L-Port ${alignr}${color slate grey}R-Port${color lightgrey}
#
#${texeci 3 netstat -ap | grep 'ESTABLISHED' | sed -r 's|.*[0-9.]+:([0-9]*)\s*([^:]+):([a-zA-Z]+)[^/]+/([a-zA-Z0-9]*)|\4 \2 \1 \3|' | awk '{printf("%-14s %-20s %5s %7s\n",$1,$2,$3,$4)}'}
#old way for network
${color1} Port(s) ${alignr} #Connections
${color} Inbound: ${tcp_portmon 1 32767 count} Outbound: ${tcp_portmon 32768 61000 count} ${alignr} ALL: ${tcp_portmon 1 65535 count}
${color1} Inbound Connection ${alignr} Local Service/Port ${color}
${tcp_portmon 1 32767 rhost 0} ${alignr} ${tcp_portmon 1 32767 lservice 0}
${tcp_portmon 1 32767 rhost 1} ${alignr} ${tcp_portmon 1 32767 lservice 1}
${tcp_portmon 1 32767 rhost 2} ${alignr} ${tcp_portmon 1 32767 lservice 2}
${tcp_portmon 1 32767 rhost 3} ${alignr} ${tcp_portmon 1 32767 lservice 3}
${tcp_portmon 1 32767 rhost 4} ${alignr} ${tcp_portmon 1 32767 lservice 4}
${color1}Outbound Connection ${alignr} Remote Service/Port${color}
${tcp_portmon 32768 61000 rhost 0} ${alignr} ${tcp_portmon 32768 61000 rservice 0}
${tcp_portmon 32768 61000 rhost 1} ${alignr} ${tcp_portmon 32768 61000 rservice 1}
${tcp_portmon 32768 61000 rhost 2} ${alignr} ${tcp_portmon 32768 61000 rservice 2}
${tcp_portmon 32768 61000 rhost 3} ${alignr} ${tcp_portmon 32768 61000 rservice 3}
${tcp_portmon 32768 61000 rhost 4} ${alignr} ${tcp_portmon 32768 61000 rservice 4}
Place this in ~/.config/autostart/conky.desktop
[Desktop Entry]
Type=Application
Name=conky
Exec=conky --daemonize --pause=5
StartupNotify=false
Terminal=false

Getting VAAPI to work on the Eurocom Q6:

Build platform: Ubuntu 18.04LTS

Preamble: This is an Optimus-based laptop where the outputs to all external devices, ie one HDMI 2.0b port and dual DisplayPort 1.3 ports are wired directly to the NVIDIA GPU, and as such, the NVIDIA GPU is always active by default unless you switch manually to the Intel IGP for rendering via prime-select. Personally, I do not recommend this for two reasons:

  1. It provides no tangible benefits over the long run. The Max-Q variant used in this laptop is already capped at ~80W maximum and on idle, is very efficient.
  2. This complicates setup. Bumblebee is a dying project, and its' best to avoid using it unless you absolutely must. It's last commit was over five years ago, and still needs a lot of manual tweaking to work right.
  3. You'll want access to both GPUs so they can run the tasks they're good at: The discrete GPU for rendering, and Intel's GPU for media decoding (and encoding) via VAAPI, without locking yourself out of NVIDIA's NVENC should you need it.

However, by default, attempting to initialize VAAPI via tools such as vainfo (from libva-utils) will result in an error due to the wrong DRI device (under /dev/dri/renderD12x) being picked (since the iGP isn't the default renderer) and more likely, due to an outdated libva package being installed on your system. Here, we will kill two birds with one stone, as shown below:

Install baseline dependencies first

sudo apt-get -y install autoconf automake build-essential libass-dev libtool pkg-config texinfo zlib1g-dev libva-dev cmake mercurial libdrm-dev libvorbis-dev libogg-dev git libx11-dev xorg-dev libogg-dev git libx11-dev libperl-dev libpciaccess-dev libpciaccess0 intel-gpu-tools

Then add the Oibaf PPA, needed to install the latest development headers for libva:

sudo add-apt-repository ppa:oibaf/graphics-drivers
sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade

Build the latest libva and all drivers from source to satisfy VAAPI's system requirements:

First things first, build the dependency chain:

Start by creating a clean build directory and work from there:

mkdir -p ~/vaapi

This will serve as the build directory.

  1. libva:

Libva is an implementation for VA-API (Video Acceleration API)

VA-API is an open-source library and API specification, which provides access to graphics hardware acceleration capabilities for video processing. It consists of a main library and driver-specific acceleration backends for each supported hardware vendor. It is a prerequisite for building the VAAPI driver components below.

cd ~/vaapi
git clone https://github.com/intel/libva
cd libva
./autogen.sh --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu
time make -j$(nproc) VERBOSE=1
sudo make -j$(nproc) install


  1. cmrt:

This is the C for Media Runtime GPU Kernel Manager for Intel G45 & HD Graphics family. it's a prerequisite for building the intel-hybrid-driver package.

cd ~/vaapi
git clone https://github.com/intel/cmrt
cd cmrt
./autogen.sh --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu
time make -j$(nproc) VERBOSE=1
sudo make -j$(nproc) install


  1. intel-vaapi-driver:

This package provides the VA-API (Video Acceleration API) user mode driver for Intel GEN Graphics family SKUs. The current video driver back-end provides a bridge to the GEN GPUs through the packaging of buffers and commands to be sent to the i915 driver for exercising both hardware and shader functionality for video decode, encode, and processing.

cd ~/vaapi
git clone https://github.com/intel/intel-vaapi-driver 
cd intel-vaapi-driver
./autogen.sh --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu 
time make -j$(nproc) VERBOSE=1
sudo make -j$(nproc) install


  1. libva-utils:

This package provides a collection of tests for VA-API, such as vainfo, needed to validate a platform's supported features (encode, decode & postproc attributes on a per-codec basis by VAAPI entry points information).

cd ~/vaapi
git clone https://github.com/intel/libva-utils 
cd libva-utils
./autogen.sh --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu
time make -j$(nproc) VERBOSE=1
sudo make -j$(nproc) install


Platform environment variables:

Add yourself to the video group:

sudo usermod -a -G video $USER

Check if LIBVA environment variables are correctly configured:

set | grep LIBVA

Should output something like:

LIBVA_DRIVER_NAME=i965
LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri


If not (as expected), set them on your system environment variables (/etc/environment).

The next bit involves setting up a bash alias that will automatically run vainfo with the correct drm display and DRI render node:

vainfo --display drm --device /dev/dri/renderD128

Now, aliased as vainfo in ~/.bash_aliases

as:

alias vainfo='vainfo --display drm --device /dev/dri/renderD128'

Then reboot:

sudo systemctl reboot 

We set the render node to renderD128 as its' the canon default for the first DRI render node pointing to the Integrated GPU. That way, when we run vainfo, it will return the correct platform information.

A better solution to this problem would be a patch in libva that allows for an environment variable, which, like the current implementation of LIBVA_DRIVER_NAME would allow for the explicit setting of a single, or an array of, DRI render nodes for VAAPI usage. For now, this is a workaround.

Verification:

When done, test the VAAPI supported feature-set by running vainfo:

vainfo


The output on a similar Skylake-based testbed is:

libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'i965'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_1
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Coffee Lake - 2.1.1.pre1 (2.1.0-50-g021bcb7)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Simple            :	VAEntrypointEncSlice
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSliceLP
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointEncSliceLP
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSlice
      VAProfileH264High               :	VAEntrypointEncSliceLP
      VAProfileH264MultiviewHigh      :	VAEntrypointVLD
      VAProfileH264MultiviewHigh      :	VAEntrypointEncSlice
      VAProfileH264StereoHigh         :	VAEntrypointVLD
      VAProfileH264StereoHigh         :	VAEntrypointEncSlice
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileNone                   :	VAEntrypointVideoProc
      VAProfileJPEGBaseline           :	VAEntrypointVLD
      VAProfileJPEGBaseline           :	VAEntrypointEncPicture
      VAProfileVP8Version0_3          :	VAEntrypointVLD
      VAProfileVP8Version0_3          :	VAEntrypointEncSlice
      VAProfileHEVCMain               :	VAEntrypointVLD
      VAProfileHEVCMain               :	VAEntrypointEncSlice
      VAProfileHEVCMain10             :	VAEntrypointVLD
      VAProfileHEVCMain10             :	VAEntrypointEncSlice
      VAProfileVP9Profile0            :	VAEntrypointVLD
      VAProfileVP9Profile0            :	VAEntrypointEncSlice
      VAProfileVP9Profile2            :	VAEntrypointVLD


Notes:

You can confirm which driver is bound to a specific DRI node, as shown below:

  1. Integrated GPU:

sudo cat /sys/kernel/debug/dri/128/name

  1. Discrete GPU:

sudo cat /sys/kernel/debug/dri/129/name

That should return i915 and nvidia-drm respectively.

Use that to confirm when adjusting the alias command above.

Install environment-modules with apt:

apt install environment-modules tcl

Then append this to your ~/.bashrc so that the package is sourced appropriately:

#Source modules automatically:


if [ -f /etc/profile.d/modules.sh ]; then
    . /etc/profile.d/modules.sh
fi

Then append this to allow bashrc to load itself automatically when edited:

##prompt_command function:


prompt_command() {
  # initialize the timestamp, if it isn't already
  _bashrc_timestamp=${_bashrc_timestamp:-$(stat -c %Y "$HOME/.bashrc")}
  # if it's been modified, test and load it
  if [[ $(stat -c %Y "$HOME/.bashrc") -gt $_bashrc_timestamp ]]
  then
    # only load it if `-n` succeeds ...
    if $BASH -n "$HOME/.bashrc" >& /dev/null
    then
        source "$HOME/.bashrc"
    else
        printf "Error in $HOME/.bashrc; not sourcing it\n" >&2
    fi
    # ... but update the timestamp regardless
    _bashrc_timestamp=$(stat -c %Y "$HOME/.bashrc")
  fi
}

PROMPT_COMMAND='prompt_command'

Alternative method (not recommended): You can also run step 1 by running:

add.modules

After installing the package for the first time.

The bash_aliases goes under ~./bash_aliases and is populated as shown below in my case:

alias vainfo='vainfo --display drm --device /dev/dri/renderD128'
alias phoronix-test-suite='LD_PRELOAD=/usr/\$LIB/libgamemodeauto.so phoronix-test-suite'
alias spdif_light_toggle='amixer -c0 cset iface=mixer,name='IEC958 Playback Switch',index=16 off'

Current actions:

I also have gamemode, the performance tuning daemon installed and called up every time I run phoronix test suite.

The spdif_light_toggle alias is set up to disable the annoing red SPDIF light that persists after boot.

Optimal BIOS settings for the Eurocom Q6:

The Eurocom Q6 is based on the Clevo P950ER - physically similar to the P950/P957HR SKUs, retaining a similar I/O layout, dimensions and looks.

It's internals, despite being well cooled, will run warmer than last year's designs primarily due to the new processor: The Intel Core i7 8750H. Despite its' stock rating of 45W, this processor can potentially draw way more power under load, and the BIOS on the Q6 has provisioning for cTDP (configurable TDP limits) if so needed.

Thanks to Thermal Velocity Boost, the threshold for thermal throttling at stock settings is much higher despite the potential performance gains, and hence the need to under-volt. Ideally, you'll want your hexacore Coffeelake processor to not exceed a skin temperature of ~50 degrees Celsius on idle so you can take advantage of Intel Thermal Velocity Boost benefits.

So far, here are the changes I made to the Eurocom Q6 as far as BIOS settings go:

I had to under-volt all the domains, ie:

(a). Core  
(b). Uncore.  
(c). GT Slice  
(d). GT Unslice  

By an offset of -100mV.

Anything lower than that results in Watchdog-related BSODs on Windows and MCE errors on Linux.

In the BIOS, I also disabled BLCK binning and power efficient P-states (to prevent the effects of Thermal Velocity Boost's dips to base clock under sudden load).

I also disabled the XTU interface to prevent the XTU components in Clevo Control Center from messing up the ACPI fan tables. This way, I get a predicatble fan curve on both automatic and Max-Q fan profiles without unnecessary tweaking.

See the shots of the BIOS settings below:

(a). The OC menu:

See overclock settings here.

(b). Core domain undervolt:

enter image description here

(c). Ring down bin is disabled:

enter image description here

(d). GT slice and unslice domain undervolting:

enter image description here

(e). Uncore domain undervolting:

enter image description here

(f). And the XMP profile for the RAM is enabled by default in this BIOS:

enter image description here

Why we undervolt:

Lower heat, better sustained performance. Simple.

These hexacore chips run hot. And undervolting is a necessity.

Why undervolt all domains?

This is an Optimus-enabled laptop, and as such, the Integrated Graphics controller domains (GT slice and unslice) are always powered on (and contributing to heat output especially under load from tasks such as video encoding via VAAPI and QuickSync). For this reason, it is imperative that an undervolt be applied here too, same as the uncore domain.

Why undervolt from the BIOS?

So that these settings persist across multiple boot environments, be it Windows or Linux.

Making a hardware probe of the Eurocom Q6:

On Ubuntu, install the hw-probe tool:

sudo add-apt-repository universe
sudo add-apt-repository ppa:mikhailnov/hw-probe
sudo apt update
sudo apt install hw-probe --no-install-recommends

Then run a probe:

sudo hw-probe -all -upload -id "DESC"

Where "DESC" is the description you want to use to identify your hardware probe.

When done, the process will generate a unique URL pointing to your submission. In my case, that points to: https://linux-hardware.org/index.php?probe=001ab8c139

Fan control on Linux:

If you need fan control on Linux for supported Clevo based systems, install Tuxedo's fan control software here: https://github.com/tuxedocomputers/tuxedo-fan-control/blob/master/docs/dev/dev_manual.md#building

Build steps:

Install the necessary dependencies, namely nodejs 10+ and gcc.

For nodejs 10 on Ubuntu 18.04LTS, install the following:

sudo apt install curl

The curl package is most likely installed by default. Then proceed to add the required repository and proceed:

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

Now, you may proceed with installing nodejs and build-essential packages:

sudo apt install nodejs autoconf automake build-essential gcc g++ make rpm

Fetch the sources and build the software:

mkdir -p ~/project && cd ~/project
git clone https://github.com/tuxedocomputers/tuxedo-fan-control
cd tuxedo-fan-control
npm install && npm run build && npm run pack

Then install the package:

sudo dpkg -i output/build/*.deb

You can also use gdebi, provided by gdebi-core:

sudo apt install gdebi-core`
sudo gdebi output/build/*.deb

When done installing the software, create a systemd unit file for it:

sudo nano /etc/systemd/system/tuxedofancontrol.service

With the content:

[Unit]
Description=TUXEDO Fan Control

[Service]
Type=forking
ExecStart=/bin/bash -c "Xvfb :99 & export DISPLAY=:99 && <path>/tuxedofancontrol --novendorcheck --startdaemon"
ExecStop=/bin/bash -c "Xvfb :99 & export DISPLAY=:99 && <path>/tuxedofancontrol --novendorcheck --stopdaemon"
ExecReload=/bin/bash -c "Xvfb :99 & export DISPLAY=:99 && <path>/tuxedofancontrol --novendorcheck --restartdaemon"

Restart=always

[Install]
WantedBy=multi-user.target

Note that the path above can vary, based on the package you installed. Be it a snap package or the executable, self contained AppImage binary.

Then enable and start the service:

systemctl enable tuxedofancontrol && systemctl start tuxedofancontrol

Now when you start the binary (from wherever it was installed), you should see the fan duty status, etc. Warning: Do not use the systemd options from the GUI. The unit files created by that package point to the wrong path of the binary. This is a bug.

@Brainiarc7
Copy link
Author

Update documentation with this included: https://github.com/tuxedocomputers/tuxedo-fan-control

@abeforgit
Copy link

Just wanna let you (and maybe other visitors) know that the headphone jack fix also worked on a P650SE running arch. Thanks a bunch!

@Brainiarc7
Copy link
Author

Brainiarc7 commented Dec 4, 2019 via email

@jakehubbard
Copy link

The Tuxedo Fan Control is working well on a P950HP6 running Arch Linux. Just make sure to install python2 in addition to the dependencies. You will get an error when building because rpmdevtools is most likely not installed but it doesn't matter. Run debtap on the .deb file after compiling to get the Arch package.

@Brainiarc7
Copy link
Author

Brainiarc7 commented May 9, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment