installing-linux-on-a-laptop-in-2017.md 9.49 KB
Newer Older
Thomas Randolph's avatar
Thomas Randolph committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
---
title: Installing Linux on a Laptop in 2017
tags:
---

# 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][amazonlaptop] ([alt link][hplaptop]). 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][beepcodessearch], 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.

Thomas Randolph's avatar
Thomas Randolph committed
24
25
26
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][fsflist] complaining about [problems with SecureBoot][fsfarticle]. 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:
Thomas Randolph's avatar
Thomas Randolph committed
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

* 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][livenoacpi]. 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?

Thomas Randolph's avatar
Thomas Randolph committed
48
> 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:
Thomas Randolph's avatar
Thomas Randolph committed
49
50
51
52
53
54
55
>
> * 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

Thomas Randolph's avatar
Thomas Randolph committed
56
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.
Thomas Randolph's avatar
Thomas Randolph committed
57
58
59
60
61
62
63
64
65
66
67

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.

Thomas Randolph's avatar
Thomas Randolph committed
68
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?
Thomas Randolph's avatar
Thomas Randolph committed
69

Thomas Randolph's avatar
Thomas Randolph committed
70
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][quadro]. 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][quadrodrivers]. To create a little bit of suspense, let's say that we're confident this will go smoothly.
Thomas Randolph's avatar
Thomas Randolph committed
71
72
73

# Installing Drivers - Only For Hardcore Nerds

Thomas Randolph's avatar
Thomas Randolph committed
74
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.
Thomas Randolph's avatar
Thomas Randolph committed
75
76
77
78
79
80
81

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.

Thomas Randolph's avatar
Thomas Randolph committed
82
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.
Thomas Randolph's avatar
Thomas Randolph committed
83
84
85
86
87
88

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.
Thomas Randolph's avatar
Thomas Randolph committed
89
90
91
92
93
94
95
96
97
* Since this laptop has a 2x DPI, everything is incredibly tiny. You can fix this easily in Ubuntu by [doing some stuff][scaling]. 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.
Thomas Randolph's avatar
Thomas Randolph committed
98
99
100
101
102

# 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.

Thomas Randolph's avatar
Thomas Randolph committed
103
104
105
106
----

[View the changelog for this post][changelog]

Thomas Randolph's avatar
Thomas Randolph committed
107
108
109
110
111
112
113
114
115
[amazonlaptop]: https://smile.amazon.com/gp/product/B01A3N5YHM
[hplaptop]: http://www8.hp.com/us/en/products/workstations/product-detail.html?oid=9789485&jumpid=reg_r1002_usen_c-001_title_r0001#!tab=specs
[beepcodessearch]: https://duckduckgo.com/?q=motherboard+beep+codes&t=ffab&ia=web
[fsflist]: http://www.fsf.org/campaigns/secure-boot-vs-restricted-boot/signers
[fsfarticle]: https://www.fsf.org/campaigns/secure-boot-vs-restricted-boot/
[livenoacpi]: http://askubuntu.com/questions/160036/how-do-i-disable-acpi-when-booting#160056
[quadro]: https://www.techpowerup.com/gpudb/2739/quadro-m1000m
[quadrodrivers]: http://www.nvidia.com/download/driverResults.aspx/112992/en-us
[scaling]: http://askubuntu.com/a/472266
Thomas Randolph's avatar
Thomas Randolph committed
116
[changelog]: https://gitlab.com/rockerest/log/commits/pages/source/_posts/installing-linux-on-a-laptop-in-2017.md