console.blog(

Installing Linux on a Laptop in 2017

Surely Dual-Booting Windows And Linux Is A Solved Problem

I mean, it's 2017, after all.


I recently came into possession of a brand new HP ZBook Studio G3 (EnergyStar) laptop, model #T6E17UT (alt link). Did you catch that? Did you see the problem? I managed to miss it when I first purchased the laptop, but it's right there at the beginning: "HP".

Because this laptop was intended to be a work computer, my first plan was to shrink the pre-installed Windows partition down to something very small (40GB or so, the approximate minimum Windows wants to run on), and then use the rest as a Linux partition for getting actual work done.

Without belaboring the point, this failed, probably due to one of the issues I'll be writing out below. I abandoned this course of action almost immediately, but there's a chance it would have worked if I had known all of this up front. Regardless, thanks to proprietary vendor bootloader locking and UEFI SecureBoot, I can simply pop in a Windows 10 USB installer and it'll be re-installed and validated. I guess that's the positive takeaway.

On to the negatives.

Something Something ACPI UEFI SecureBoot

I know almost nothing about motherboards. From my past building computers as an amateur enthusiast, I know how to get to BIOS (then EFI, then UEFI), read beep codes, and all those things you might want to know when building a computer. However, I know very little about what bootloaders actually do. This is a part of my computer knowledge that is lacking, and I have zero desire to learn it. The farther I am abstracted from a bootloader, the better.

Something has happened in the bootloader world that has made it exceedingly difficult to install something - other than what was shipped on it - onto your laptop computer. I'm vaguely aware of some people complaining about problems with SecureBoot. It seems that there was a middle ground that happened some time in the last 6 years or so that satisifed them (haven't heard of it since then) but appears to have royally screwed everyone else.

In any case, you can't seem to install Linux (my flavor this time around was Ubuntu 16.10) while ACPI support is on in the kernel. If you do, anything that requires interacting with hardware will not work. That is:

  • writing a flag into the bootloader to go back to the installer after a reboot
  • reading the number of cores
  • reading the power status
  • booting up
  • powering down

And many more, I'm sure, I just don't remember them or didn't encounter them.

The simple fix here is to just disable ACPI at the kernel bootstrap level. Of course, you have to do this at every level of the process, which means any time you boot from - say - a Linux live USB stick, you need to catch the bootloader and modify the boot line to disable ACPI. Good luck. Don't forget to do it on the full install, too, or it won't boot properly either.

Oh, and while you're installing with ACPI off, there's a chance it'll fail because of SecureBoot. Yes, I agree that Ubuntu says it supports SecureBoot, but that doesn't change the reality that it doesn't seem to work with it on. Go ahead and turn SecureBoot off in your UEFI admin panel. It's probably F2, F3, F9, F10, Esc, or Del to get in there, but only in a very small window of time.

It "Works"

So now Ubuntu is installed on the laptop and the bootloader always starts it with acpi=off in the kernel flags. Hey at least it's working... right?

Haha, sorta.

Remember when I said this?

In any case, you can't seem to install Linux [...] while ACPI support is on in the kernel. If you do, anything that requires interacting with hardware will not work. That is:

  • writing a flag into the bootloader to go back to the installer after a reboot
  • reading the number of cores
  • reading the power status
  • booting up
  • powering down

It turns out - yeah, nothing will work with it enabled - but, disabling it is almost as bad. Somehow the things that matter for installing (powering down, I guess) work, but everything else is still shot when ACPI is off. That means your nice laptop with 4 cores and hyperthreading is reporting nothing to the OS, so the OS just naturally assumes there's 1. Also, you can't integrate with the onboard graphics card, so your display is max brightness no matter what you do. The OS can't determine whether you have a battery installed or if a power cord is plugged in, so you're in a state where there's no battery indicator but you're receiving power somehow.

So now what?

Well, I installed this as UEFI - which, as we know - doesn't work with ACPI on. However, I need ACPI on to have a functional computer. The only way to do that is to install as a "Legacy" (read: BIOS) OS with ACPI on. As far as I can tell, there's no way to convert a UEFI boot to a BIOS boot. So, turn off UEFI, turn on Legacy, and start installing all over again - with ACPI on.

Now It "Works"

Well, alright.

Now we have a power indicator, that's good.

The OS indicates it can utilize 8 cores, that's even better. The laptop chassis is no longer dangerously hot to the touch, but it's still disturbingly hot. top indicates that each core is generally at less than 1% utilization, so why is it so hot?

Brightness still isn't adjustable, and every now and then graphical artifacts and screen tears show up: this must be a GPU issue. This laptop runs an NVIDIA Quadro M1000M chip. Ostensibly, the open source drivers that ship with Ubuntu work with this chip. This is not true. You should be able to install jockey-gtk to get access to the Additional Drivers GUI that allows installing more third-party drivers, but Ubuntu reports that jockey-gtk is already the latest version and there doesn't appear to be a way to start the Additional Drivers interface. What you can do, however, is install the drivers directly from NVIDIA. To create a little bit of suspense, let's say that we're confident this will go smoothly.

Installing Drivers - Only For Hardcore Nerds

All you need to do is download the NVIDIA drivers and install them. Like everything else, you can install the drivers using the appropriate package for your operating system. On Windows, this is .exe, Mac it's .app or something, and on Debian-based Linux distributions, it's .deb. Easy.

Or NVIDIA could ship you a script that you have to run when the X Server is not active.

This is actually less of a problem than it feels like.

Ctrl + Alt + F1 drops you to a TTY terminal. Shut down the X Server with sudo service lightdm stop, or - you know - the appropriate display manager which may be lightdm or I-have-no-idea but good luck on this one. Once you've shut down the X Server (by shutting down the display manager, DUH, is this not self-explanatory?) you can just run the drivers installer with something like sudo ./NVIDIA-blahblah.run. I'm sure this will work the first time, as it's a script from a major graphics vendor.

If - by some fluke - it does not, just follow the directions it gives. Since it basically tells you to go to a troubleshooting page on the internet, ignore the directions immediately and start over. As long as you run this script with sudo and your display manager (lightdm) is not running it should just work.

Now your graphics drivers are up to date, and you can reboot.

Unsolved Problems

  • When you do anything that requires fiddling with the motherboard bootloader (UEFI/BIOS), this particular brand of laptop seems to write random bytes into firmware. This has the effect of - usually - making random noises come out of the speakers. Often this is just static. Static is good. Other times, it's a sharp tone played at the highest possible volume. Others, the tone smoothly increases from low to very high, still at the highest possible volume. Very rarely, the UEFI/BIOS will simply not boot, which is fun.
  • Since this laptop has a 2x DPI, everything is incredibly tiny. You can fix this easily in Ubuntu by doing some stuff. Of course, this doesn't actually fix it, it just changes this particular slider in the UI. You can fix this for real by calling
    dconf read /com/ubuntu/user-interface/scale-factor
    and then changing the number to 16. The UI scale is factors of 8, so "8" is 1X, and "16" is 2X. You can write this back with
    dconf write /com/ubuntu/user-interface/scale-factor "[the full JSON configuration with 16 instead of 8]"
    I don't know why the UI doesn't work.

Summary

As you can see, dual-booting Linux and Windows is super simple now that it's 2017 and computing is not a total and complete fucking nightmare any more.


View the changelog for this post
(View the changelog for a previous version of this post)