Installation of Debian GNU/Linux 10 “Buster” on a Lenovo ThinkPad P1 Gen2

ThinkPadP1Gen2Having recently started to work for Riks TV, I got a new laptop to install with my favourite Linux distribution: Debian. The laptop is a Lenovo ThinkPad P1 Gen2. It’s a very nice laptop, quite powerful and fast, with a large screen and way lighter than the Lenovos I have owned before through my previous employers (Opera Software and Telenor Digital).

That’s all great, but on the other hand my previous story with Lenovo laptops has never been problem-free, and I was sure this one was no exception. Alas, I was right. So I decided to write a few notes about the installation, for myself and for anyone who wants to install Debian on this laptop. These won’t be detailed, walk-through installation instructions, but more of a high-level checklists.

First things first, you need to download an installation image. In my experience, hardware in Lenovo laptops may be a bit problematic with Debian, so you will want to download the unofficial image which includes a handful of non-free firmware (see the yellow box in the page).

debian-website-2020-03-08

Second thing, connect to Internet using a wire. The WiFi card of the laptop is not recognised by the installation image, nor it is by the kernel 4.19 shipped with Debian 10. This is known, and that’s why you’ll have to upgrade to a kernel 5.x from Debian Backports once the initial installation is completed. You’ll have to upgrade the firmware packages, too, using those from backports.

Third thing, you’ll have to change some BIOS settings. This may not be strictly necessary, but it made the set-up considerably easier. The first setting you want to change is to disable SecureBoot: if you don’t, the system won’t be able to load unsigned modules, and that includes the Nvidia driver for the video card. There are ways around it, but I didn’t want to bother. The second thing is to disable Hybrid graphics. This means you will be using only the power-greedy Nvidia video card, while the Intel video card will be disabled. Sure, you can try to play with Bumblebee, Optimus and the like: I just didn’t want to.

With all this done, install the system. I chose to install over an encrypted LVM spanning the whole disk. Yeah, I didn’t give the poor pre-installed Windows a chance 😉 Once the system reboots, you’ll notice that the console font is terribly tiny. That can be fixed through dpkg-reconfigure console-setup once the system is booted: just run the program until you find a font family and size that suit your eyes. Anyway, that won’t fix the font used by GRUB. We’ll get to that in a minute, there is more important stuff to do now.

Now, configure the system to use backports and, once you’re done, you’ll want to install from them: the kernel image and header files (linux-image-amd64, linux-headers-amd64), the Nvidia drivers (nvidia-driver), the firmware for the WiFi card (firmware-iwlwifi), and some other miscellaneous firmware files (firmware-linux-free, firmware-linux-nonfree). I do that through apt-get:

apt-get install -t buster-backports linux-image-amd64 linux-headers-amd64 nvidia-driver firmware-iwlwifi firmware-linux-free firmware-linux-nonfree

This will install a whole bunch of dependencies, and that’s OK. You will also want to get rid of the nouveau driver: it doesn’t support the video card and having it around may just mess up things:

apt-get remove xserver-xorg-video-nouveau

Before you reboot, ensure that you add a line in /etc/modules to ensure that the WiFi card driver is loaded in the kernel at boot time:

iwlmvm

With all this stuff done, you can reboot. If everything went well, you should now have a functioning Debian Linux 10 “Buster”, and you can proceed to configuring the WiFi. The Nvidia driver will also allow you to use external monitors (e.g., through the HDMI port).

To solve the problem with the tiny characters in GRUB, I have edited the file /etc/default/grub and set

GRUB_GFXMODE=640x480

and run update-grub as root (e.g. via sudo).

The font is not preserved between the time that goes from GRUB launching the kernel and the kernel picking up your settings from console-setup. As far as I know, there is a way around it, too, that is: setting the font on the GRUB command line that launches the kernel. I decided not to bother, if you do bother you’ll have to do your own homework. Enjoy!

4 thoughts on “Installation of Debian GNU/Linux 10 “Buster” on a Lenovo ThinkPad P1 Gen2

  1. Thanks for this description. I just tried this on a brand-new P1 Gen2 Core i9 vPro 9th Gen. It didn’t work with the nvidia stuff. Trying to install nvidia-driver resulted in unmet dependencies. So I couldn’t apt-get install the whole list in a single command. Removing nvidia-driver from the list allowed me to install the new 5.4 kernel, but after removing the nouveau driver and rebooting into 5.4, the screen showed “funny” patterns, and I “blindly” rebooted into the default 4.19 kernel that luckily was left in the grub menu. This way I could at least get a text console up and running again, pressing Ctrl-Alt-F[2-6] after boot.

    Now I’m still trying to figure out how to get graphics and Wifi up and running. However, I may as well choose to simply try Ubuntu 18.04 LTS which is reported to run just fine on the P1…

      • Hi Axel

        I have main, contrib and non-free enabled on all base repos. I don’t think I added contrib and non-free by hand (usually, before I do so I create a backup of the original file, and it’s not there). It could be that I chose some setting during the installation that “triggered” their presence in the sources. So yes, you need contrib and non-free in addition to main. This is what I have in there:

        bronto@maserati:~$ grep ^deb /etc/apt/sources.list
        deb http://deb.debian.org/debian/ buster main contrib non-free
        deb http://security.debian.org/debian-security buster/updates main contrib non-free
        deb http://deb.debian.org/debian/ buster-updates main contrib non-free
        bronto@maserati:~$

        The same holds for backports: you need main, contrib and non-free since you are going to use a proprietary driver (nvidia) and firmware. To make the WiFi work, ensure you use the 5.4 kernel and those firmware packages from backports, and remember to update the modules file, and it will work like a charm at the first reboot.

        When it comes to nvidia-driver, you *must* use the ones from backports, and the latest ones. Anything older doesn’t support the video card of the laptop. Have you double checked that you are using the “-t buster-backports” option in apt-get install when you install the new kernel and the driver?

        Would also be interesting to see what kind of conflicts you got when trying the installation the first time.

  2. Despair… I’ve now also tried Ubuntu 18.04 LTS on the P1 Gen2 to no avail. Linux is broken. Get a new piece of powerful hardware and you can be sure that Linux won’t work on it. Back to Windows? Probably… Sucks….

    Still thanks for your experience report. It just didn’t work for me. Maybe you had some secret tricks htat you applied but didn’t share?

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.