Skip to content

Instantly share code, notes, and snippets.

@hmaarrfk
Last active November 5, 2019 16:53
Show Gist options
  • Save hmaarrfk/48e2c204c6cad3861b194dd44a47d45a to your computer and use it in GitHub Desktop.
Save hmaarrfk/48e2c204c6cad3861b194dd44a47d45a to your computer and use it in GitHub Desktop.
Installing Ubuntu 16.04 on XPS 15 9560

I recently (July 2018) installed Ubuntu 16.04 on my XPS 15 9560.

my main usecase is to be able to run and test cuda programs localy when developing image processing software.

I chose Ubuntu 16.04 mostly because of compatibility with software like cuda, pytorch, tensorflow, and matlab. My previous Fedora 28 worked well, but had too much incompatiblity with software that was stuck on an older GCC. Fedora is leading the pack with GCC 8 and it is simply too aggressive for larger peices of software. They also renamed lib to lib64 which I think was a mistake.

Creating a USB

The dd command for me is still the only one that works reliably.

dd if=ubuntu-16.04.4-desktop-amd64.iso of=/dev/sdx bs=8M

Laptop preparation

Bios version. I probably have something like 1.6. Whatever was before all those big hacks with Intel. The new bioses wer really buggy and I just don't feel like testing them for Intel.

Make sure you have

  1. Disabled RAID. To do this:
  • Set windows to boot in safe mode.
  • Open your bios. Set the drive to whatever non-raid is.
  • Boot into safe mode
  • Reboot into normal mode.
  • Yes this is necessary. Windows would otherwise complain that it can't find the boot disk.
  1. Disable safe mode. It will probably interfere with nvidia-drivers anyway.
  2. Backup your hard drive. The best way to do this is probably on the cloud somewhere.

Installation

16.04.4 actually went smoothly. Earlier versions had a hard time with the highdpi display settings.

Currently, it just scales everything by 2. And seems to work OK. I haven't used multiple monitors yet, but I'm sure I'll have some DPI issues.

Nouveau apparently hangs your computer, so hopefully the install goes smoothly.

Update

Reboot into your new ubuntu install. But before you do that, change the kernel boot parameter. In the grub screen:

  1. High light the Ubuntu line.
  2. Press e.
  3. Go to the last line (be patient, grub lags on a 4k screen)
  4. After quiet splash add nouveau.modeset=0
  5. Boot up.
  6. Edit the file /etc/defaults/grub and add nouveau.modeset=0 to the GRUB_CMDLINE_LINUX_DEFAULT inside the quotes.
  • While you are there, you can just add all the parameters:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nouveau.modeset=0 acpi_rev_override=1 nvidia-drm.modeset=0"
  1. After you are finished modifying /etc/defaults/grub, run the command
sudo update-grub2
  1. Update everything
sudo apt update
sudo apt upgrade

Nvidia install

This is the scary part. I have to admit, there is a step that gave me a system that wouldn't boot into graphics mode.

You will want to add the bumblebee testing ppa. Yes testing is what you need, at least for 16.04.

You will also need to add the nvidia cuda 9.0 repository. To find it, search for nvidia cuda and go to legacy releases. Find the 9.0 release, and download it.

Install cuda-9-0, this will pull in nvidia-396. Pay attention to the driver that it pull in case.

sudo apt update
sudo apt install cuda-9-0

Install bumblebee as a seperate step.

sudo apt install bumblebee

Add the rest of the kernel boot parameters: acpi_rev_override=1 nvidia-drm.modeset=0 and update grub.

Edit the bumblebee configuration file /etc/bumblebee/bumblebee.conf.

  1. Specify the nvidia driver on line 22: Driver=nvidia
  2. Line 55 should specify the version of the nvidia driver you have installed: KernelDriver=nvidia-396
  3. Line 58 should replace current with 396: LibraryPath=/usr/lib/nvidia-396:/usr/lib32/nvidia-396
  4. Line 61 should do the same: XorgModulePath=/usr/lib/nvidia-396/xorg,/usr/lib/xorg/modules

Reboot. Pray that your system boots back up.

If your system fails to boot to the graphic mode, add 3, just the number 3 at the end of the kernel boot string. That will allow you to boot into a tty.

Testing nvidia drivers

Open a terminal. Try typing:

nvidia-smi

It should give an error with:

NVIDIA-SMI couldn't find libnvidia-ml.so library in your system. Please make sure that the NVIDIA Display Driver is properly installed and present in your system.
Please also try adding directory that contains libnvidia-ml.so to your system PATH.

Now try:

optirun nvidia-smi

You should get

Fri Jul  6 14:04:04 2018
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 396.26                 Driver Version: 396.26                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 1050    Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   35C    P3    N/A /  N/A |      5MiB /  4042MiB |      2%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0     16451      G   /usr/lib/xorg/Xorg                             5MiB |
+-----------------------------------------------------------------------------+

Now profit!

Things I had working in Fedora

ReFIND

This makes your boot process prettiers

Larger font TTY

This makes the TTY usable.

Larger font on Grub (backup to ReFIND)

This makes grub lag less.

@lucbettaieb
Copy link

I followed this guide (mostly) and got nvidia-418 with cuda9 instead. Things seem to work until I close my screen, at which point it seems as if the nvidia driver crashes. Any advice? I can usually get to tty after but anything X is dead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment