OMEN HP with Linux

Recently I’ve bought a new notebook. Because I do like the design and I wanted to have something faster playing games I decided for this gaming notebook. So let’s see how to get everything working in Linux.

Installation

I decided to use Linux aside of the pre-installed Windows (not that I dare to use it, though if I’m bored I might take a look). Furthermore I decided to install Debian Stretch using a Debian Netinstall ISO on an USB-stick.

UEFI

I just disabled secure boot in the notebooks BIOS (f10 is the key to enter, f9 for boot-menu). I also tried with legacy mode because I wasn’t sure how safe it is to boot into UEFI with Linux – later noticed that I really did an UEFI install – so .. disabled legacy again (need to re-disable secure boot) and everything is fine.

Partitioning

For that I went into Windows (what did I just write..) to shrink partitions. The notebook came pre-installed with Windows 10 Home and got something like the following partition layout:

  • NVMe
    • p1 – 260 MB – EFI System
    • p2 – 16 MB – Microsoft reserved
    • p3 – 237 GB – Microsoft basic data
    • p4 – 980 MB – Windows recovery environment
  • HDD
    • p1 – 916 GB – Microsoft basic data
    • p2 – 15 GB – Microsoft basic data

I just reduced the NVMe p3 to 136.3 GB and added an 93.1 GB Linux partition, as well as an 7.8 GB swap partition. The HDDs partition 1 has been reduced to 416.1 GB and I added a 500.6 GB Linux partition. That was good enough to get Debian installed – Later I noticed that I would like to play around with bcache – Currently my root-system has 4.7 GB used – so 15 GB should be enough space. I moved to Windows again and reduced the Windows-Partition further by ticking compress device, cleaning up, de-installing software and games which were installed, defragmenting… I was able to reduce the windows partition on the NVMe to 60,9 GB. I also removed the data-partition on the HDD which has been empty anyway. Plenty of space free now for my shiny Linux. I’ll use bcache for my /home partition since / is on my NVMe already nothing to do there.

I moved, sorted, resized partitions and finally came up with:

The new partition scheme looks like this:

  • NVMe
    • p1 – 260 MB – EFI System
    • p2 – 16 MB – Microsoft reserved
    • p3 – 61 GB – Microsoft basic data
    • p4 – 15 GB – Linux filesystem (root)
    • p5 – 8 GB – Linux swap
    • p6 – 128 GB – Linux filesystem (used as bcache cache)
    • p7 – 980 MB – Windows recovery environment
  • HDD
    • p1 – 916 GB – Linux filesystem (used as bcache backing)
    • p2 – 15 GB – Microsoft basic data

More about bcache in section Tuning on this page.

Blacklisting

I’ve noticed that many people blacklist acer_wmi – It wasn’t loaded, though I blacklisted it as well (for no specific reason). I also blacklisted nouveau (which is required since I am going to use the nvidia card with nvidia driver).

blacklist nouveau
blacklist ibm-nouveau
options nouveau modeset=0
alias nouveau off
alias ibm-nouveau off
 
blacklist acer_wmi

A good place for those is in /etc/modprobe.d/, don’t forget to recreate your initramfs by issuing update-initramfs -k all -u probably followed by update-grub

Network

Firmware

While this might not be necessary, I do usually install firmware-realtek with systems which got a realtek adapter, which is the case here:

[    0.986509] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
[    0.986514] r8169 0000:3b:00.0: can't disable ASPM; OS doesn't have ASPM control
[    0.999291] r8169 0000:3b:00.0 eth0: RTL8168h/8111h at 0xffffb1a881911000, 80:xx:xx:xx:xx:xx, XID 14100800 IRQ 319
[    0.999293] r8169 0000:3b:00.0 eth0: jumbo features [frames: 9200 bytes, tx checksumming: ko]
[    1.018496] r8169 0000:3b:00.0 eno1: renamed from eth0
[    3.183328] r8169 0000:3b:00.0: firmware: direct-loading firmware rtl_nic/rtl8168h-2.fw

Hence the intel firmware (firmware-iwlwifi) as well:

[    2.616528] iwlwifi 0000:3c:00.0: enabling device (0000 -> 0002)
[    2.618759] iwlwifi 0000:3c:00.0: firmware: failed to load iwlwifi-7265D-26.ucode (-2)
[    2.618773] iwlwifi 0000:3c:00.0: Direct firmware load for iwlwifi-7265D-26.ucode failed with error -2
[    2.618783] iwlwifi 0000:3c:00.0: firmware: failed to load iwlwifi-7265D-25.ucode (-2)
[    2.618788] iwlwifi 0000:3c:00.0: Direct firmware load for iwlwifi-7265D-25.ucode failed with error -2
[    2.618795] iwlwifi 0000:3c:00.0: firmware: failed to load iwlwifi-7265D-24.ucode (-2)
[    2.618800] iwlwifi 0000:3c:00.0: Direct firmware load for iwlwifi-7265D-24.ucode failed with error -2
[    2.618809] iwlwifi 0000:3c:00.0: firmware: failed to load iwlwifi-7265D-23.ucode (-2)
[    2.618815] iwlwifi 0000:3c:00.0: Direct firmware load for iwlwifi-7265D-23.ucode failed with error -2
[    2.620673] iwlwifi 0000:3c:00.0: firmware: direct-loading firmware iwlwifi-7265D-22.ucode
[    2.620848] iwlwifi 0000:3c:00.0: loaded firmware version 22.361476.0 op_mode iwlmvm
[    2.634313] iwlwifi 0000:3c:00.0: Detected Intel(R) Dual Band Wireless AC 7265, REV=0x210
[    2.637297] iwlwifi 0000:3c:00.0: L1 Enabled - LTR Enabled
[    2.638091] iwlwifi 0000:3c:00.0: L1 Enabled - LTR Enabled
[    2.723290] iwlwifi 0000:3c:00.0 wlo1: renamed from wlan0

And due to Spectre/Meltdown I also installed intel-microcode

Connman

Connman is a really nice tool to have around for networking on desktops/workstations.

root@asuna:/home/jean# connmanctl 
Error getting VPN connections: The name net.connman.vpn was not provided by any
connmanctl> enable wifi
Enabled wifi
connmanctl> scan wifi
Scan completed for wifi
connmanctl> services
*AO Wired                ethernet_80xxxxxx5f_cable
    FRITZ!Box 7490       wifi_10f0xxxx930_managed_psk
    yyy                  wifi_10f0xxx5251_managed_psk
    yyy                  wifi_10f0xxx64f4e_managed_none
    yyy                  wifi_10fxxx3706f74_managed_ieee8021x
    yyy                  wifi_10f005f5xxx465722031313630_managed_psk
    yyy                  wifi_10f005xxx2038363030_managed_psk
    yyy                  wifi_10f0xxx331_managed_psk
    yyy                  wifi_10f00xxx07065_managed_psk
    yyy                  wifi_10f0xxx423232_managed_psk
connmanctl> agent on
Agent registered
connmanctl> connect wifi_10f0xxxx30_managed_psk
Agent RequestInput wifi_10f0xxxx30_managed_psk
  Passphrase = [ Type=psk, Requirement=mandatory, Alternates=[ WPS ] ]
  WPS = [ Type=wpspin, Requirement=alternate ]
Passphrase? xxx
Connected wifi_10f0xxx30_managed_psk
connmanctl> quit

I’ve just enabled connman through systemctl enable connman and removed my manual network configuration from /etc/network/interfaces. Connman will handle network connections from now on 🙂

Graphical system / X11

Initially I was unable to setup bumblebee so I decided to set up the nvidia-card directly. Later then I found out that the acpi_osi=Linux settings caused freezes when playing around with bumblebee.

Using the nvidia card (no hybrid)

For nvidia directly I just installed nvidia-driver and had to add a xorg.conf as well as an .xinitrc:

Section "Module"
    Load "modesetting"
EndSection
 
Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    BusID          "1:0:0"
    Option         "AllowEmptyInitialConfiguration"
    Option         "CustomEDID" "eDP-1-1: /sys/class/drm/card1-eDP-1/edid"
    Option         "ConnectedMonitor" "eDP-1-1"
    Option         "IgnoreEDID" "false"
    Option         "UseEDID" "true"
    VendorName     "NVIDIA Corporation"
EndSection

The BusID is returned by lspci (careful, issuing lspci two times after each other seems to make the system freeze) not giving that makes Xorg not find any nvidia device. AllowEmptyInitialConfiguration and the CustomEDID as well as the ConnectedMonitor, IgnoreEDID and useEDID options are necessary because Xorg reports there is no monitor connected to the nvidia card (DFP-0, -1 and -2 are available).

Apart from that, I had to remove any HorizSync/VertRefresh stuff from xorg.conf to make a resolution of 1920x1080px possible.

nvidia: .xinitrc

My .xinitrc looks like this (make sure it is executable by issuing chmod a+x on it). You’ll have to install xinit for this to work.

jean@asuna:~$ cat .xinitrc 
#!/bin/bash
 
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
 
exec enlightenment_start

If you use a login manager, you need to make sure that both xrandr options are run at the login manager (so a .xinitrc is not sufficient). Here’s an example for lightdm:

lightdm

My favorite login manager is SLiM it’s pretty lightweight and fast, though I just noticed that it is probably not developed anymore. So, let’s use lightdm. Because you need to set the xrandr options when X starts, putting it into a .xinitrc (like above) will only work if you do use startx it does not work if you do use a login manager.

With lightdm, just edit /etc/lightdm/lightdm.conf and add the following after [Seat:*]

greeter-setup-script = /usr/bin/xrandr --auto
display-setup-script = /usr/bin/xrandr --setprovideroutputsource modesetting NVIDIA-0

That’s it.

intel+nvidia hybrid using bumblebee / optirun / primusrun

Finally I got it working. The freezes stop once you set:

GRUB_CMDLINE_LINUX="acpi_osi=! acpi_osi=\"Windows 2009\""

Obviously if you followed this article you’ll now have to remove /etc/X11/xorg.conf and revert your modifications to /etc/lightdm/lightdm.conf and you need to remove /home/yourusername/.xinitrc.

So I’ve just installed bumblebee-nvidia, added the above to /etc/default/grub, rebooted and I can successfully run optirun nvidia-settings -c :8 as well as primusrun glxgears and optirun glxgears. While running glxgears checking /proc/acpi/bbswitch returns ON else OFF. I also installed xserver-xorg-input-mouse because bumblebee gives warnings about the mouse module not being there (well I’ll need that anyway probably). My /etc/bumblebee/xorg.conf.nvidia looks like this:

Section "ServerLayout"
    Identifier  "Layout0"
    Option      "AutoAddDevices" "false"
    Option      "AutoAddGPU" "false"
EndSection
 
# you can most likely remove this section
Section "Module"
    Load "modesetting"
EndSection
 
Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    BusID          "1:0:0"
    VendorName     "NVIDIA Corporation"
    Option "UseDisplayDevice" "none"
EndSection

Features / Hardware / Other stuff

Backlight

Due to the switch to intel graphics (due to bumblebee) Enlightenment did not properly set the backlight anymore. A fix for that was just adding a xorg.conf with the following contents:

Section "Device"
    Identifier  "Card0"
    Driver      "intel"
    Option      "Backlight"  "intel_backlight"
EndSection

Touchpad

I’ve got the following two packages installed: xserver-xorg-input-libinput xserver-xorg-input-evdev. mouse click by tapping on the touchpad did not work, for that I just applied a configuration file which I did find in the archlinux wiki:

root@asuna:/home/jean# cat /etc/X11/xorg.conf.d/10-synaptics.conf 
Section "InputClass"
        Identifier      "Touchpad"                      # required
        MatchIsTouchpad "yes"                           # required
        Driver          "synaptics"                     # required
        Option          "MinSpeed"              "0.5"
        Option          "MaxSpeed"              "1.0"
        Option          "AccelFactor"           "0.075"
        Option          "TapButton1"            "1"
        Option          "TapButton2"            "2"     # multitouch
        Option          "TapButton3"            "3"     # multitouch
        Option          "VertTwoFingerScroll"   "1"     # multitouch
        Option          "HorizTwoFingerScroll"  "1"     # multitouch
        Option          "VertEdgeScroll"        "1"
        Option          "CoastingSpeed"         "8"
        Option          "CornerCoasting"        "1"
        Option          "CircularScrolling"     "1"
        Option          "CircScrollTrigger"     "7"
        Option          "EdgeMotionUseAlways"   "1"
        Option          "LBCornerButton"        "8"     # browser "back" btn
        Option          "RBCornerButton"        "9"     # browser "forward" btn
EndSection

But that still did not make it working, I added the following one (and honestly I do not remember where I did find it – Most likely in the archlinux wiki as well – please drop me a note in case you know it)

root@asuna:/home/jean# cat /etc/X11/xorg.conf.d/40-libinput.conf 
Section "InputClass"
        Identifier "libinput touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
        Option "Tapping" "on"
EndSection

which did make it work :^)

HP Freefall Protection / hdapsd

The HP OMEN does have an accelerometer and hpsad detects if your notebook is free-falling. If this happens, the heads are parked to not cause any damage to the harddisc. This is a pretty useful feature and should generally be enabled. I noticed that the default of 15 is quite sensitive and a value of 100 works identically. Letting it fall carefully in 20cm height is still detected. I’ve just installed hdapsd (no reboot was required) stopped it using systemctl stop hdapsd started it manually using hdapsd -d sda -s 100 even with a value of 1000 fast lifting up of the notebook causes the head parking:

root@asuna:~# hdapsd -d sda -s 200
Sun Apr  1 15:14:54 2018: Starting hdapsd
Sun Apr  1 15:14:54 2018: Selected interface: FREEFALL
Sun Apr  1 15:14:54 2018: Uses hardware logic from /dev/freefall
Sun Apr  1 15:14:57 2018: parking
Sun Apr  1 15:14:58 2018: un-parking
Sun Apr  1 15:14:59 2018: parking
Sun Apr  1 15:15:00 2018: un-parking

I’ve modified the configuration file /etc/hdapsd.conf to look like this:

# Which device(s) should be protected by hdapsd?
# Can be either a single string (one device):
  device="sda";
# Or an array of strings (multiple devices):
#  device=["sda", "sdb"];
# Will be autodetected if not set.
 
# How sensitive should hdapsd be? Defaults to 15.
# You probably want to change this.
  sensitivity=200;
 
# Enables adaptive mode, where hdapsd adjusts the sensitity
# while the mouse and keyboard are used.
# You probably want to enable this.
  adaptive=true;
 
# Run hdapsd in background as a daemon.
#  background=true;
 
# Write a pid file.
#  pidfile="/var/run/hdapsd.pid";
 
# Enable logging to syslog.
#  syslog=true;

Since it doesn’t matter what sensitivity I do set, I just used 200.

Tuning

bcache

I did set up bcache afterwards; for that purpose I was moving files around, sorted/resized partitions. In the end I created a 128 GB partition on the NVMe which I do use as caching-device:

root@asuna:~# make-bcache -C /dev/nvme0n1p6

The tricky part was growing bcache. Actually it is simple if you make sure it does start at the same sector – don’t be confused that I do use „sda3“ – sda3 did start at sector 2048. I just created /dev/sda3 as bcache-backing:

root@asuna:~# make-bcache -B /dev/sda3

Using bcache-super-show I retrieved the cache uuid so that I was able to attach it:

root@asuna:~# bcache-super-show /dev/nvme0n1p6 | grep cset
cset.uuid               defcbf57-d360-44ee-8d85-bf9f817dd19e
 
root@asuna:~# echo defcbf57-d360-44ee-8d85-bf9f817dd19e > /sys/block/bcache0/bcache/attach

Created a filesystem:

mkfs.ext4 -O metadata_csum,64bit /dev/bcache0

Moved my files from oldhome (non bcache) to newhome (bcache) using cp, added it using the uuid output of blkid to /etc/fstab, deleted both partitions, re-created the partition starting at sector 2048, reboot, resize2fs /dev/bcache0 … Done. Bcache will help to make a lot more use of the NVMe in this system.

laptop-mode-tools

I just replaced BATT_HD_POWERMGMT=1 with BATT_HD_POWERMGMT=200 in /etc/laptop-mode/laptop-mode.conf.

Intel graphics / GuC firmware

I noticed GuC firmware load skipped in dmesg. Added the following:

/etc/modprobe.d/i915.conf
options i915 enable_guc_loading=1 enable_guc_submission=1

and it’s there, too.

Probably useful to know

Bumblebee Slow?

You might test your FPS using glxgears and notice that you’re only getting like 60 fps:

jean@asuna:~$ primusrun glxgears
/usr/bin/primusrun: line 41: warning: command substitution: ignored null byte in input
294 frames in 5.0 seconds = 58.782 FPS
301 frames in 5.0 seconds = 60.053 FPS
301 frames in 5.0 seconds = 60.056 FPS
^C

While glxgears is no benchmarking tool – the above a really low fps for the GTX 1050 Ti. Well, this is vblank synchronization in action as the primus FAQ states:

jean@asuna:~$ vblank_mode=0 primusrun glxgears
/usr/bin/primusrun: line 41: warning: command substitution: ignored null byte in input
ATTENTION: default value of option vblank_mode overridden by environment.
ATTENTION: default value of option vblank_mode overridden by environment.
ATTENTION: default value of option vblank_mode overridden by environment.
ATTENTION: default value of option vblank_mode overridden by environment.
13118 frames in 5.0 seconds = 2623.527 FPS
14472 frames in 5.0 seconds = 2894.247 FPS
14328 frames in 5.0 seconds = 2865.422 FPS
^C

So, errm. Don’t worry. Interestingly, I’m getting more FPS with bumblebee than without regardless of vblank_mode in Unigine. Interestingly, the battery shows 8 hours remaining when using the intel gpu instead of nvidia – with nvidia it’s showing 4 hours. Though, really, I haven’t tested how long the battery holds.

Repairing EFI-Bootloader

I really don’t know which of my tasks caused that – at some stage after a reboot I was presented with the grub-rescue menu. Fixing was simple, though.

In grub rescue I used ls to get a list of disks and partitions, I manually checked for the disk containing /boot. Found it by typing ls (hd1,gpt4)/ I believe. Now I told grub rescue where to find grub by issuing:

# this WILL be different on your system
set prefix=(hd1,gpt4)/boot/grub

Now I told grub rescue about root.

set root=(hd1,gpt4)

And finally I made it boot/start the bootloader

insmod linux
insmod normal
normal

Back in my shiny debian I repaired the bootloader by issuing:

apt-get install --reinstall grub-efi
# in case you got an NVMe as I do and you do boot from it, if not this command WILL be different
grub-install /dev/nvme0n1
update-grub

Verify:

root@asuna:~# efibootmgr --verbose | grep debian
Boot0000* debian        HD(1,GPT,f35f97a7-9dc2-440f-a936-55d09968db0e,0x800,0x82000)/File(\EFI\debian\grubx64.efi)

Reboot.

2 Comments

  • Ivan

    5. Juni 2018 at 22:49 Antworten

    Hi Jean!

    I’m glad to find another Linux user on HP OMEN, It’s really helpful this article to me.
    I’d like to ask you about fan controls and overheating. Do you has been experiencing something like this after some months of installed Debian?

    I’ve trying with Pop!_OS and my laptop overheats in a minute, maybe graphics drivers will be the problem..

    Thanks for share your knowledge, and sorry for any mistakes. English is not my native language

    • jean

      8. Juni 2018 at 23:27 Antworten

      Hi Ivan,

      what is your native language? By chance german? Sadly there is NO way to control the fans in my HP Omen in Linux. Overheating might be produced by (a) not using the onboard graphic card (mine has an intel gpu as well as an nvidia one – check if you have two and which one you do use (b) intel turbo mode. Check your cpu frequency (for example using cpufreq-info) and try disabling turbo mode: echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo

      Let me know if that helps.
      Jean

Post a Comment