Skip to content

Ubuntu linux on Dell XPS 15 (9560)

Ramón Casero edited this page Apr 22, 2017 · 78 revisions

DISCLAIMER: These are my personal notes for experiments with my own laptop. These instructions could cause data loss, damage to your system, or even your system becoming unusable. Use at your own risk.

These are my notes to get Ubuntu working on a Dell XPS 15 (9560, early 2017).

I originally started with Ubuntu 16.04 LTS. Then I upgraded to Ubuntu 16.10, and recently to Ubuntu 17.04.

At this point, I have Ubuntu running, encrypted home directory, dual boot with Windows 10 Pro, and it works fine. Suspend/resume work fine with the nVidia 381 driver. I can also run the Windows 10 Pro (guest) from Ubuntu (host) as a virtual machine, at full resolution. I.e. I can choose whether I want to boot Windows natively, or as a virtual machine from Ubuntu. I also have a shared folder so that Windows (as virtual machine) can access my linux encrypted home directory. This way, all the data and documents can live on the Ubuntu partition and I don't need to allocate extra space for data in the Windows partition.

However, there are a couple of small outstanding problems trying to run Office both natively and on the virtual machine, and drag'n'drop from Windows to Ubuntu. Sometimes, bluetooth dies after suspend/resume (possible fix below). Also, sometimes the dual boot disappears and the laptop will boot Windows directly (but see below for easy fix).

Table of Contents

Created by gh-md-toc

Installation steps

Prep work with Windows

  1. Plug the power cord into the laptop

  2. Start laptop and go through the Windows 10 set up process

  3. Create a Windows recovery USB stick so that we can reset the laptop to factory settings if things go wrong.

  4. Go to the XPS 15 9560 drivers webpage and update the BIOS (version 1.1.3 at the time of this writing)

  5. Other driver updates

    • Graphics card: nVidia n17P-G0
  6. Change SATA Operation so that Ubuntu can see the SSD

    1. Login into Windows 10, and set up Safe Mode: "Change advanced Startup Options" -> "Restart Now" -> "Troubleshoot" > "Advanced options" > "Startup Settings" > "Restart"

    2. Boot laptop and press F12 -> BIOS Setup

    3. System Configuration -> SATA Operation

    4. Change SATA Operation from "RAID On" to "AHCI"

    5. Apply and Exit. This will reboot the laptop, and provide several boot options

    6. Choose "4. Safe Mode"

    7. "Start" -> "Windows System" -> "Control Panel" -> "Device Manager". Check that the "IDE ATA/ATAPI controller" is "Intel(R) 100 Series/C230 Chipset Family SATA AHCI Controller"

    8. Reboot normally. This should boot into the regular Window 10

    9. If you reboot and go into the BIOS, SATA Operation should still be AHCI

Installing Ubuntu

  1. Create a bootable USB stick with Ubuntu Live (currently 16.04 LTS). You can do it from Windows or Linux

  2. Boot the laptop with the USB stick (you need to press F12 while booting, and then select the USB stick from the BIOS menu)

  3. Launch Ubuntu Live with "Try Ubuntu without installing"

  4. Click on "Install Ubuntu 16.04.1 LTS" to start installation

  5. Select language (e.g. English)

  6. Select whether you want to connect to Wifi (in my case I couldn't, because it doesn't give you the option to enter the Wifi username)

  7. Select "Install third-party software for graphic and Wi-Fi hardware, Flash, MP3 and other media"

  8. Check "Turn off Secure Boot" and enter a password that you'll need later

  9. In "Installation Type", it should have detected the existing Windows installation, and offer to install Ubuntu alongside (dual boot).

  10. Now you'll see the partitions in your drive. Select the main one, that contains Windows, and reduce it to make space for Ubuntu. For example, I reduced the Windows space to 50 GB, and left the rest for Ubuntu.

  11. The rest of the steps (time zone, keyboard layout, login name and password) is straightforward, just complete them.

  12. After the system installs, you will have dual boot. Boot into Ubuntu, login and now you can upgrade to 16.10 (you don't have to, if you want to have LTS support, but I did).

    sudo do-release-upgrade
    

Upgrading things

Graphics card driver

By default, Ubuntu uses the noveau driver. You can switch to the nVidia driver by launching "Additional drivers" from the dash, waiting for GUI to search for proprietary drivers, and then clicking on the nVidia driver, or using the command line. For example, to install v375 of the nVidia driver,

sudo apt-get install nvidia-375

This will ask you for permission to deactivate Safe Booting, as it's a third-party driver. You'll have to provide a password, the system will reboot, boot up into a configuration mode that will ask whether you want to deactivate Safe Booting, and ask for said password.

To avoid corruption of the window manager after resuming from suspend, you need v381 of the driver. This is not in the regular repository of Ubuntu 17.04 at the time of this writing. To install the latest versions of the nVidia drivers, first you have to add the graphics team repositories

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update

Now launching "Additional drivers" from the dash will provide more options, in particular v381.09. Select and click "Apply changes".

The nVidia driver seems to work fine, and provides GPU acceleration. It also solves the window manager corruption after resuming from suspend caused by previous versions of the driver.

Fixing problems

Touchpad

Moving your hand near the touchpad can cause the mouse pointer jump to the bottom left corner of the desktop and open the Trash. Sometimes, it also makes your cursor jump back so that you type in the middle of the sentence. To fix this problem, Juan Hernández suggests replacing xserver-xorg-input-synaptics with xserver-xorg-input-libinput

sudo apt-get install xserver-xorg-input-libinput
sudo apt-get remove --purge xserver-xorg-input-synaptics
sudo reboot

Windows update removes your dual boot

After updating Windows, or installing a program, you may lose the dual boot (i.e. Windows boots without giving you the option to choose between Ubuntu or Windows). This is very easy to fix.

  1. Reboot the machine.

  2. Press F12 when the Dell logo appears. Apart from the BIOS options, at the top you'll be given the option to boot in Windows or Ubuntu. Select Ubuntu.

  3. Log in, and run in a terminal

    sudo grub-install

This will recover the dual boot.

Run your native Windows 10 Pro install as guest on VirtualBox with Ubuntu as host

DISCLAIMER: The instructions in this section are particularly dangerous, and can corrupt or destroy your system. If you use these instructions, it's really at your own risk.

Usually, in VirtualBox you create a virtual disk where you install your guest operating system (e.g. Windows 10 Pro). Everything runs "inside a virtual box". However, here we want to do something different. We want to run the pre-installed native Windows 10 Pro on top of Ubuntu.

Basically, we are going to install VirtualBox in Ubuntu and follow GreenAsh's Running a real Windows install in VirtualBox on Linux instructions, slightly modified and with a couple of extra steps at the end.

Prep work

First, we want to install VirtualBox. Ubuntu provides a package virtualbox (5.1.6 at the time of this writing), but we want the latest version (5.1.18 at the time of this writing). For that, we are going to get the deb package virtualbox-5.1 directly from the VirtualBox repository.

The reason is that the Guest Additions silently fail to work with the default Ubuntu 16.10 version, thus preventing us from resizing the Windows virtual machine to full resolution and full screen.

  1. From the Ubuntu dash, "Software & Updates" -> "Other software" -> "Add". Following the VirtualBox linux downloads instructions, we add the deb source

    deb http://download.virtualbox.org/virtualbox/debian yakkety contrib
    
  2. Download and register the keys for the repository

    wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
    wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
    
  3. Refresh the list of packages, and install the latest version of VirtualBox and the Oracle VM VirtualBox Extension Pack so that we can mount USB 2.0 and 3.0 devices, and other extended functionality.

    sudo apt-get update
    sudo apt-get install virtualbox-5.1 virtualbox-ext-pack
    
  4. Troubleshooting: If you had virtualbox installed, and have replaced it by virtualbox-5.1, when you try to start an existing virtual machine, you are going to get an error message saying that the VirtualBox kernel modules don't match the VirtualBox version. All you have to do is remove the old modules and rebuild them

    sudo rmmod vboxnetadp vboxnetflt vboxpci vboxdrv
    sudo /sbin/rcvboxdrv setup
    
  5. Because virtualbox-ext-pack is the extension pack of the older 5.1.6 VirtualBox, when you launch VirtualBox, you may be asked whether you want to upgrade the Extension pack to 5.1.18. If so, accept and follow the upgrade process.

  6. Add yourself as a VirtualBox user and to the disk group by running on a terminal

    sudo adduser $USER vboxusers
    sudo adduser $USER disk
    
  7. Log out of Ubuntu and log in again for the changes to take effect.

Now, some basic set up to prepare VirtualBox.

  1. Reboot, and press F12 during the Dell logo to enter the BIOS configuration.

  2. Check that you have Secure Boot -> Secure Boot Enable -> Disabled.

  3. Save and exit, and boot into Ubuntu.

  4. Launch VirtualBox (you shouldn't have any virtual machines here), and go to File -> Preferences. Rename the default machine folder from /home/$USER/VirtualBox VMs to /home/$USER/VirtualBox_VMs. Rename the /home/$USER/VirtualBox VMs folder on your filesystem too, if it already exists. The reason for this is that whitespaces cause problems if you forget quotes, etc.

Letting VirtualBox boot the native Windows 10 Pro installation as a virtual machine

Now we are getting serious. This is the bit where we basically follow GreenAsh's Running a real Windows install in VirtualBox on Linux instructions

  1. Install gparted

    sudo apt-get install gparted
    
  2. Run gparted and write down the partitions used by Windows. In my case, it was partitions /dev/nvme0n1p1 (/boot/efi), /dev/nvme0n1p2 (Microsoft reserved partition), /dev/nvme0n1p3 (OS / "Windows C drive"), /dev/nvme0n1p4 (WINRETOOLS), /dev/nvme0n1p5 (Image) and /dev/nvme0n1p6 (DELLSUPPORT).

  3. Create the "raw disk", which is a file with a pointer to the actual Windows partitions. In the example above, Windows is using partitions 1-6.

    sudo VBoxManage internalcommands createrawvmdk \
    -filename "/home/rcasero/VirtualBox_VMs/win10pro.vmdk" \
    -rawdisk /dev/nvme0n1 \
    -partitions 1,2,3,4,5,6
    
  4. Change the owner and group of the pointer files, so that you can use them as a user and not superuser (otherwise, VirtualBox won't be able to use these files)

    sudo chown $USER:$USER VirtualBox_VMs/win10pro*
    

After creating that pointer to the actual Windows partitions, we create a virtual machine for Windows 10 Pro in VirtualBox.

  1. In VirtualBox, click on "New"

  2. Set Name = "Windows_10_Pro", Type = "Microsoft Windows", Version = "Windows 10 (64-bit)".

  3. Set Memory Size, e.g. 4096 B = 4 GB.

  4. In "Hard drive", select "Use an existing virtual hard disk file", and select /home/$USER/VirtualBox_VMs/win10pro.vmdk.

  5. Click "Create".

  6. In the "Oracle VM VirtualBox Manager" you will see your new "Windows 10 Pro" virtual machine. This virtual machine is "Powered Off".

If you try to boot now, you'll get a "FATAL! No bootable medium found" error. So we need a couple of final tweaks.

  1. In VirtualBox, select the new Windows 10 Pro virtual machine, Settings -> Storage. Select win10pro.vmdk under Controller: SATA and check "Solid-state drive", as the Dell XPS 15 comes with an SSD.

  2. Now select "System", and check "Enable EFI (special OSes only)".

Enabling full resolution for the guest Windows 10 Pro virtual machine

We are going to enable graphics acceleration and provide enough video memory for full resolution.

  1. In VirtualBox, select the Windows 10 Pro virtual machine, "Settings" -> "Display", and check "Enable 3D acceleration" and "Enable 2D video acceleration".

  2. Increase video memory to 256 MB.

At this point, if you click "Start", the virtual machine will launch and boot your Windows 10 installation. But Windows 10 runs in a small size. To be able to increase the resolution, we need the Guest Additions.

  1. Start the Windows 10 virtual machine.

  2. On the virtual machine menu bar, "Devices" -> "Insert Guest Additions CD Image".

  3. A dialogue will tell you that no CD is present and whether you wish to download from the internet. Click "Download", and then "Insert". This doesn't install the guest additions, only mounts the ISO as a CD.

  4. Log into Windows. Open the File Explorer, "This PC" -> "CD Drive (D:)". Double-click on VBoxWindowsAdditions.exe. Follow the installation process, that at the end will ask to reboot Windows.

  5. Shut down the virtual machine and close VirtualBox. From a terminal create a custom video mode (1920x1080 is the screen resolution, and 24 is the colour-depth in bits)

    VBoxManage setextradata "Windows_10_Pro" "CustomVideoMode1" "1920x1080x24"
    

Now we can use the laptop's screen at full specs for the Windows 10 virtual machine. This only needs to be done once, as afterwards every time we start the virtual machine, it'll remember the settings.

  1. Launch VirtualBox and start the Windows 10 virtual machine.

  2. In the menu, select "View" -> "Virtual Screen 1" -> "Resize to 1920x1080".

  3. "View" -> "Full screen mode".

With this settings, the whole screen will display a Windows 10 Pro session, indistinguishable from running Windows natively, except for a thin gray line at the bottom that corresponds to a VirtualBox pull-up menu.

Bidirectional interaction between Ubuntu host and Windows guest

  1. Launch VirtualBox with the virtual machine shut down.

  2. Go to "Settings" -> "General" -> "Advanced".

  3. Select "Bidirectional" for "Shared Clipboard". This enables copying something in Ubuntu and pasting to Windows, or vice versa.

  4. Select "Bidirectional" for "Drag'n'Drop". This enables dragging a file from the Ubuntu file manager, and drop it in Windows, making a copy. For me, this works from Ubuntu to Windows, but not the other way around.

Shared folders

  1. With the virtual machine shut down, open "Settings" -> "Shared folders".

  2. Click on "Add new shared folders", and point it to your linux home directory. "Folder path" = /home/$USER, "Folder name" = linux_$USER, where $USER is your linux username, , "Read-only" = No, "Auto-mount" = Yes.

  3. When trying to start the virtual machine, I got the error

    Kernel driver not installed (rc=-1908)
    
    The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing
    
    '/sbin/vboxconfig'
    
    as root.
    
    where: suplibOsInit what: 3 VERR_VM_DRIVER_NOT_INSTALLED (-1908) - The support driver is not installed. On linux, open returned ENOENT.
    
  4. Running the suggested command fixed the error

    sudo /sbin/vboxconfig
    
  5. Start the Windows 10 Pro virtual machine. In File Explorer now you have a linux_$USER folder assigned to unit E:\. This way, Windows can access the Ubuntu partition, so that you can store your data and documents there.

Outstanding problems

Office detects hardware change when booting natively/virtual machine

Booting Windows alternatively as native or as virtual machine makes Office 2013 detect a hardware change and ask for re-activation (you only have a couple of online activations before you have to go through a slow phone process, so you probably want to stick to running Office either natively or on the virtual machine).

Possible source of information (I have only skimmed it): https://mazimi.wordpress.com/2007/07/11/getting-around-windows-activation-when-virtualizing/

Drag'n'Drop from Windows to Linux not working

At this moment, when I try to drag a file from the Windows guest to the Ubuntu host, I get an error

Drag and drop operation from guest to host failed.
Drag and drop error from guest (VERR_FILE_NOT_FOUND).

Result Code: 
VBOX_E_IPRT_ERROR (0x80BB0005)
Component: 
GuestWrap
Interface: 
IGuest {13a11514-402e-022e-6180-c3944de3f9c8}

Bluetooth stops working after suspend/resume

I'm currently using the Microsoft Sculpt Comfort Mouse that connects via bluetooth to the laptop.

However, suspending/resuming the laptop crashes the bluetooth, and it cannot be brought back to life without rebooting.

Manual bluetooth blocking/unblocking works, so user Ferux suggested blocking the bluetooth before suspend, and unblocking afterwards. However, I still get some problems after two suspend/resume in a row. Create the script with the right permissions and open it in an editor

cd /etc/pm/sleep.d
sudo touch 10_bluetooth
sudo chmod 0755 10_bluetooth
sudo emacs 10_bluetooth

Then add the code

#!/bin/bash
#Code from http://ubuntuforums.org/showthread.php?t=1387211

. /usr/lib/pm-utils/functions

case "$1" in
    hibernate|suspend)
    rfkill block bluetooth
    ;;
    thaw|resume)
    rfkill unblock bluetooth
    ;;
    *)
    ;;
esac

exit

References

  1. Ubuntu on Dell XPS 15 9560 (Early 2017)