How to install Ubuntu 18.04 on Lenovo P1

Thomas Arp
Bekk
Published in
6 min readDec 18, 2018

--

Tl;dr : Install Ubuntu 16.04 LTS first, then upgrade.

I’ve recently gotten my hands on a new laptop. The Lenovo Thinkpad P1, the crux of modern technology. The pinnacle of portable workstations.

And it contains a Windows 10 installation.

Now, I don’t think there’s anything inherently bad about using Windows.
I use it every day at home, I am familiar with a lot of the internals and consider myself a Windows super user.

However, when I need to develop software, I prefer to use a platform that is closer to the platform the code will be running on.
My colleagues use macs and I find it useful to avoid differences in directory structure. Also, the “works on my machine”-syndrome is a lot rarer if the platforms are similar.

I’ve been using a predecessor to my new laptop, the Thinkpad W541, for a while now, running Ubuntu in a dual boot setup. There have been some issues: the Nvidia drivers for Linux really struggled with the high resolution screen in the beginning, for instance, but I’ve worked out most of the kinks and have a productive setup, with 18.04.
The new P1 is about half the weight, though, so I look forward to lugging about a smaller machine.

Now, this next part is only there for completeness: I tried to install Ubuntu 18.04 LTS by downloading the Ubuntu 18.04 LTS installation live-image.

IT DOES NOT WORK! (as of december 2nd 2018).

If you read the installation instructions below and think “hey, I can just skip ahead and use the 18.04 installer”, you will get stuck on a bug. There is no work-around for this bug at this time, except installing a previous version and upgrading from within. I guess this will change over time, but as it is today, you will need to use this upgrade path. Even after the bug is fixed, the settings in the BIOS and the grub settings are needed, so this recipe will hopefully still be helpful.

So, what steps do you need to take?

Start by logging into Windows. The first thing you need to do is to shrink the Windows partition a bit. I know it’s possible to do this during the Ubuntu setup, but Windows knows which files can’t be moved about.
So, start up Disk management and shrink the C-partition by 200GB. That should be more than enough space for the Linux install.

Next, download the Ubuntu 16.04 LTS install live-ISO.
Also, you’ll need the Rufus “write ISO to USB” tool. Just follow the tutorial for this part. Nothing new or ground breaking here :)
Write the ISO to a USB stick and plug it in.

Next, reboot and press <ENTER> (quickly — the window for input is extremely short) during the boot to get into the BIOS. You will need to change a couple of values:

On the “Security” tab, set “Secure boot” to “Disabled”.
This would otherwise prevent you from running Linux. The “secure boot” feature prevents other applications from usurping the Windows installation. Which is exactly what we’re trying to accomplish. So it’s got to go.

On the “Startup” tab, change the “UEFI/Legacy Boot” to “Both”.
This allows USBs to actually boot the machine. Note that this option is unavailable unless you make the change above.

Your USB stick will be listed here

Also on the “Startup” tab, enter the “Boot” submenu. Find your USB stick (the reason you inserted that first ;) and make sure it gets to the top (plus/minus moves a line up/down).

Press F10 to save and reboot.

Now, you’ll (hopefully) get to see the GRUB boot menu. It has a couple of different options.

Select the “Install Ubuntu” option and press E.
The default options won’t work here; you’ll crash on the video drivers.

So, edit the options:

Change the “set…” line to set gfxpayload=text
(or it will try running in a video mode that doesn’t work)

Change the “linux…” line to linux /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity nomodeset
(removing quiet so you can see what happens if it hangs, and splash so it’s not hidden by a splash screen). nomodeset prevents the nouveau video driver from trying to take over.

Press fn+F10 to boot

In a minute, you’ll be greeted by the Ubuntu 16.04 LTS installation guide. I suggest you make these choices:
- Choose a language you’ll want to use.
- Connect to your wi-fi. Its imperative that you get new video drivers ASAP. The installer can do that if it’s online.
- Check the boxes for “download updates” and “install third party software”. The graphics driver is such a piece of software.
- Choose “Install Ubuntu alongside Windows”. Because you already made space for the install from inside Windows, you don’t need to mess around with the partitions here. You still need to ok it, though.
- Fill in a little about yourself and where you are and then “continue” starts the installation.

During the installation, nothing much happens and now is a good time to go get a cup of coffee.

After the installation is finished, you will have to reboot. Pull out the USB drive and press the “Reboot now” button. In my case this didn’t work, instead, the screen froze up. A hard reset (5s press on power button) worked, though.

Frozen screen after install

You should be greeted by the GRUB menu, allowing you to boot into Ubuntu or Windows.
Boot into Ubuntu and log in.
Typically, at this time, the updater will have found some updates for the new installation. Install them and reboot.

You can choose to stop here. Ubuntu 16.04 LTS has maintenance releases until 2021, so you’ll be fine.

However, the rest of the process is simple and worked for me the first time:

After you’ve installed updates, open a terminal (right-click menu on desktop). You will need to install something that generates entropy to combat the bug I linked to above. Two different packages can help you here, rng-tools and haveged. I chose haveged, but I assume the other works just as well. Install it with the command sudo apt install haveged.

Next, re-run the update-manager to trigger an upgrade. Run
update-manager -cd

This triggers a dialog allowing you to press a button aptly named “Upgrade…”.

I won’t go into details about the upgrade process, just inform you about a message that will pop up halfway through about a conflict in some GRUB configuration files.
I suggest choosing the option “Install the package maintainer’s version” since we haven’t changed it ourselves.
This is not the default setting, but we really don’t want 16.04-values in our 18.04 GRUB config.

Note: the upgrade may look like it’s stuck for a while — it isn’t.
At the end of the update, press the “Reboot now” button (it worked for me this time) and you’ll be greeted by the Ubuntu 18.04 login page.

Also note that it took quite a lot of trial and error to get to this :)
If you find a quicker or more simple solution, please let me know in a response so I can update the post.

Edit: After a slightly embarrassing meeting, where I experienced some, let’s call them “minor issues” when connecting an external monitor, it turns out that contrary to what I thought, the Nvidia display drivers aren’t actually installed by the above procedure. The repository is linked, but no files downloaded. To actually install them, you will need to run
sudo ubuntu-drivers autoinstall
to install the drivers and then reboot. It worked without a hitch for me, though :)

--

--