Dell XPS 15 (9570) Dual-Booting Windows 10 and Ubuntu 18

wsh
8 min readMay 28, 2019

Recently I bought a new laptop xps-15 to do machine learning. Since it has a high-end CPU i7–8750H and a GPU nvidia 1050-ti, it should be capable of doing machine learning, especially deep leaning, in Python using the GPU.

However, in my country, I could not purchase it with Ubuntu installed, and it ships only with Windows 10. If you want to do machine leaning, using Ubuntu is recommended rather than Windows 10, since much more APIs and documents on the web are available. In addition to that, I believe installing a proper nvidia graphics driver and APIs needed to do machine leaning with GPU enabled, such as CUDA and cuDNN, might be quite a bit easier.
Thus I decided to install Ubuntu on this new laptop along with Windows 10.

Laptop Specifications

  • Dell xps 15 9570 (2019 model) with 4K touch display
  • Core i7 8750H
  • nvidia GTX 1050-ti Max-Q
  • sk-hynix nvme 500GB SSD
  • 16GB of RAM
  • Windows 10 already installed (with fingerprint scanner enabled)
  • Latest firmware (as of May 2019). The version is 1.10.1

Contents

  • Prepare Ubuntu USB installer
  • Prepare Windows USB installer
  • BIOS Setups
  • Install Ubuntu 18
  • Install graphics driver
  • Install CUDA, cuDNN and tensorflow
  • Suspend problem
  • Screen brightness problem
  • Install Windows

Prepare Ubuntu USB installer

The Ubuntu 18 is going to be installed using an USB installer prepared in advance. Although details on how to make an Ubuntu USB installer are outside the scope of this post, I can briefly show you one way I used.

I created the USB installer on another Ubuntu machine and its preinstalled software “Startup Disk Creator”. After downloading the proper iso file of Ubuntu from here, launch Startup Disk Creator, then select the USB device on which you are going to install Ubuntu.

Make sure that the USB device is formatted to ext-4.

Prepare Windows USB installer

There are plenty of ways to create a bootable USB for Windows installation. This is the way I created one in Ubuntu system.

Whether you are using Windows or Ubuntu, you have to first download the ISO file of Windows 10. You can download the latest one from here. Then if you are on an Ubuntu system, you can use WoeUSB to create a bootable USB for windows installation. Just format the USB to NTFS and launch the app. Here is a detail description on how to use WoeUSB to create a bootable USB device.

BISO Setups

Before stating installation of Ubuntu 8 and Windows 10, we need to change some configurations of BISO such that the installed Ubuntu is not rejected.

When rebooting the laptop, press the F12 key jsut after the dell logo appears. If successful, you can enter the Boot menu. Go to “BISO Setup” under the “OTHER OPTIONS”.

The boot menu screen. Your screen may look different since my laptop already has Ubuntu and Windows.

After entering “BIOS Setup”, what we have to modify is the following:

  • SATA Operation: change to “RAID On”
  • Secure Boot Enable: uncheck the box
  • Advanced Boot Options: change to “Enable Legacy Option ROMs”

Then apply the changes and exit by clicking “Apply” and“Exit” button.

Install Ubuntu 18

After the BIOS setups are changed, then insert the installer USB created above and then enter the Boot menu again. This time you can see that you can boot from the installer. Select the one that shows your USB’s name.

My USB name is shown. The actual installer is in on the “Partition 2”.

In the “Grub” menu, select “start Ubuntu without installing”. You can then get into the Ubuntu desktop screen and find an icon named “Install Ubuntu 18.04.2 LTS” or something like this (the exact version may be different). Start installation by double clicking this icon and proceed the installation process. If any wifi is available, I recommend you to use that since some softwares are updated during installation at the same time:

You can choose both “Normal installation” and Minimal installation”. It does not matter.

Select “Something else” for the installation type:

We manually create partitions and format them.

If the drive of the laptop is empty, the “free space” is shown to be 512110MB(500 GB) under /dev/nvme0n1:

Do not touch /dev/sda drive. This is the USB installer. The drive of the laptop is /dev/nvme0n1.

We create the following three partitions on this free space by clicking the plus button while selecting the free space (orange):

  • EFI System Partition (1000MB) for the partition table
  • ext-4 (280000MB) for Ubuntu 18 (mount point = “/”)
  • fat-32 (200000MB) for Windows 10 (mount point = “/windows”)
After creating the partitions correctly, it looks like this.

Click “install now”, and then the installation process begins.

Install graphics driver

Since any nvidia graphics driver hasn’t been installed, we install the latest one manually. Although it can also be installed via terminal, I used “Software & Updates”, which is an Ubuntu’s standard application, since I believed it would be more secure.

Before that, we add an apt repository for newer nvidia graphics drivers:

$ sudo add-apt-repository ppa:graphics-drivers
$ sudo apt-get update
$ sudo apt-get install nvidia-driver-410
$ sudo reboot

Check if the installation was successful after rebooting:

$ nvidia-smi

If the GPU usage and other information are show, the installation is successful. Then you can proceed to installation of cuda and cudnn, which are necessary for GPU enabled machine learning.

Install CUDA, cuDNN and tensorflow

Prerequisites

Before starting installation of cuda and cudnn, you have to change g++ version from 7 to 6. Ubuntu 18 ships with g++ 7. However the version 7 does not work well with cuda and cudnn. Run the following commands on the terminal:

$ sudo apt-get update
$ sudo apt-get install build-essential software-properties-common -y
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
$ sudo apt-get update
$ sudo apt-get install gcc-6 g++-6 -y
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6

Because the whole installation process is too long to be written in this post, please follow this well-written medium post for more details.

CUDA 9.0

What is the most important thing here is the combination of cuda, cudnn, and tensorflow (I use tensorflow for machine learning). If wrong versions are installed, it wont work with high probability. I installed the following versions of cuda, cudnn, and tensorflow are installed:

  • CUDA 9.0
  • cuDNN 7.0
  • tensorflow-gpu 1.12.0

Run the following commands to download and install cuda 9.0:

$ cd
$ wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run
$ chmod +x cuda_9.0.176_384.81_linux-run
$ ./cuda_9.0.176_384.81_linux-run --extract=$HOME
$ sudo ./cuda-linux.9.0.176-22781540.run$ sudo bash -c "echo /usr/local/cuda/lib64/ > /etc/ld.so.conf.d/cuda.conf"
$ sudo ldconfig

Then add the following line at the end of ~/.bashrc file. This enables the installed library to be found by Python.

export PATH="$PATH:/usr/local/cuda-9.0/bin"

cuDNN 7.0

Download the following three files for cudnn 7.0 from this website (You have to be logged in):

  • cuDNN v7.0.5 Runtime Library for Ubuntu 16.04 [Deb]
  • cuDNN v7.0.5 Developer Library for Ubuntu 16.04 [Dev]
  • cuDNN v7.0.5 Code Samples and User Guide for Ubuntu 16.04 [Dev] (optional)

Then run the following command in this order:

$ sudo dpkg -i libcudnn7_7.0.5.15–1+cuda9.0_amd64.deb
$ sudo dpkg -i libcudnn7-dev_7.0.5.15–1+cuda9.0_amd64.deb
$ sudo dpkg -i libcudnn7-doc_7.0.5.15–1+cuda9.0_amd64.deb

After installation, add the this line again in the ~/.bahsrc file.

LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/extras/CUPTI/lib64

tensorflow 1.12.0

Before installing tensorflow, pip3 must be installed:

$ sudo apt update
$ sudo apt install python3-pip

Then you can install tensorflow 1.12.0:

$ pip3 install --upgrade tensorflow-gpu==1.12.0

Suspend Problem

After the graphics driver was installed and the GPU was successfully detected, you might have encountered a problem that the laptop did not resume once it was suspended.
I thought this was a problem related to the graphics driver, and thus tried different versions of driver. But it was just a wast of time.

After searching some web documents, I reached one possible solution that seemed to solve the problem. I tried this, and it worked! Here is what I did:

Edit the boot option

The first thing we have to do is edit the file /etc/default/grub . This is a system file used to tell the computer how the boot operation is done.
Simply copy and paste the following content to the file:

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nouveau.modeset=0"
GRUB_CMDLINE_LINUX="nouveau.blacklist=1 acpi_osi=! acpi_osi=\"Windows 2015\" acpi_backlight=vendor mem_sleep_default=deep"

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

Then activate this change by running this command:

$ sudo update-grub
$ sudo reboot

Update the kernel

The step taken above does not take effect unless the kernel is updated to the latest version (at least on my case). Run the following command to update the kernel:

$ sudo apt-get update
$ sudo apt-get dist-upgrade

Screen brightness problem

Although the problem mentioned above was was solved, another problem arose that the screen brightness can not be changed even via the “settings”.

One way to get around this problem is using brightness-controller . This app can be installed by:

$ sudo add-apt-repository ppa:apandada1/brightness-controller
$ sudo apt update
$ sudo apt install brightness-controller-simple

Install Windows

Now the partition for Windows is already created, what you have to do is just boot from the created bootable USB and follow the installation guild. To boot from USB, enter the bios setup and select the USB’s name shown under “UEFI BOOT”:

Your screen should look different, since I have already Windows installed.

The “Drive 0 Partition 3” is the partition created for Windows 10 before. Select this partition and go to next. You can format the drive to the appropriate format if necessary.

  • Drive 0 Partition 1: UEFI System Partition
  • Drive 0 Partition 2: Ubuntu 18
  • Drive 0 Partition 3: Windows 10
  • Drive 0 Partition 4: Unused

--

--