Categories
Software Engineering

Tricks I needed to install Fedora 26 on a Dell XPS 13 9365 (2 in 1)

Update: I ended up getting a new job which came with a new laptop, so don’t have the XPS 9365 anymore. I hope this post is still helpful to people but I won’t be able to provide any more support. The official Fedora support page is over here: http://ask.fedoraproject.org/ Good luck everyone!


While having breakfast on Friday morning, my 5 year old laptop was going fine.  Then Firefox froze.  I pressed alt-tab, nope, everything is frozen except the mouse. Then the mouse was frozen.  Then I reset the computer, and got this message “Operating System Not Found”.  My hard drive had died.

Rather than spend a weekend fiddling to repair it, I decided to spend my tax-return money to buy a new laptop – a Dell XPS 13 9365 2-in-1.  Fancy as!  But, whenever you buy a fairly knew and fancy laptop, less than 12 months old, with the intent to install Linux – you should probably set aside some time because you just know there’s going to be issues.

One weekend later, I’m the happy owner of a XPS 13 2-in-1 running Fedora 26.  Here’s all the tips and gotchas and cry-into-a-pillow moments that I had to get through to make it this far.

Trying Fedora instead of Ubuntu

Before I made the purchase, I was doing some Googling to see if Ubuntu would even load on an XPS 13 9365.  The verdict seemed to be that it would load, but there was some difficulty getting suspend/resume to work, but it was possible.  I decided to go ahead with the purchase. But in my reading, I came across this comment:

I was unable to uninstall Ubuntu on the XPS at all. And out of frustration I tried Fedora and I was simply BLOWN away by the polish. And today we have Fedora 26 that is even better. I am semi-validated by Ubuntu moving to Gnome as well. Ubuntu was simply too unpolished with Mir + Unity.

I decided to give Fedora a go.  Now that most of my development work happens in Docker, I’m not too worried about which distro I have running on bare-metal – and I’m up for trying something new!

Verdict: I’ve enjoyed Fedora – the polish in Fedora 26 really is there compared to Ubuntu 16.04 (admittedly – it is 12 months newer so that is to be expected).

To get started with Fedora, download the “Fedora Media Writer” which will prepare a Live USB for you. See the Fedora installation guide for more info.

Shrinking a Windows Partition is beyond my pay-grade

At first I was interested in keeping Windows 10 installed and dual booting, because it might be nice to occasionally see test how it works etc.  But part of the dual-boot process involves resizing the Windows partition to make space for Linux.

I had a 460GB Windows partition, with 30GB used.  For the life of me I couldn’t shrink it smaller than 445GB – leaving only 15GB for Linux.  I tried following different tips, tricks and tutorials for about 30 minutes, and then decided that I’ve lived without Windows for a decade, I can keep going without it now.

SATA mode has to be AHCI

By default the 9365 has it’s SATA hard drive configured to be in “RAID” mode rather than “AHCI”.  To be able to install Fedora, I needed to change this to AHCI. Not sure why.  Here’s a question / answer that prompted me to make the change.

It’s worth noting that if you intend to dual boot, changing from “RAID” to “AHCI” can cause serious problems for Windows unless you do some prep work first.  You can change it and change back, but if you want to dual boot, you will need both to be on AHCI.

A painful firmware bug (that makes you think your laptop is dead forever)

See: http://en.community.dell.com/support-forums/laptop/f/3518/t/20009547

This bug had me thinking my laptop was bricked and would need to be sent for warranty.  It would literally sit on the DELL logo for what felt like forever, but turned out to be 5 to 10 minutes.  I can’t explain how relieved I was to read a blog post where someone described the same symptoms:

When changing the SATA drive setting from RAID to AHCI, and disabling the “Secure boot” option in the BIOS (both actions are needed to install Ubuntu), the booting process gets stuck in the Dell logo for a long time, around 5 minutes, before it makes any progress. Even trying to enter the BIOS again to change those settings makes me have to wait that long.

Also, when booting when those settings on and entering the BIOS, the whole user interface of the BIOS menu, even just moving the mouse cursor around, is extremely slow. Clicking on a menu option on the BIOS makes the screen refresh to the next screen with a very slow transition of about 3 seconds.

I’m have upgraded to the latest BIOS firmware as of April 8, 2017 (Version 01.00.10, 3/9/2017). This bug is currently preventing me from setting up a dual-boot mode with Windows 10 + Ubuntu, which makes the system not usable for my specific use cases. I’d really appreciate if these issues could be resolved soon.

The fix:

  • You can’t have “SATA MODE = AHCI” and “SECURE BOOT = FALSE” at the same time.
  • Because “SATA MODE = AHCI” is required for a Fedora install, we need “SECURE BOOT’ to be true.  Turns out, this is actually okay.

That one hurt.  I also found a poor user on Reddit who was bit by the same problem and was offering money to anyone who could help – too bad I didn’t find the fix 2 months earlier!

Configuring BIOS to boot from USB

One final thing to do in BIOS: configure it to boot from USB.

Because we’re using SecureBoot, this is not as straight forwarded as choosing an option from a boot menu.

Steps:

  • Ensure “Disable Legacy Boot ROMs” is ticked.  It will need to be ticked for secure-boot to be ticked.
  • Ensure “Secure Boot” is ticked.  It’s on a different page in the settings.
  • Ensure “Boot mode” is “UEFI” not “Legacy”.
  • This will show a list of boot options.  The terrible GUI interface will require you to scroll down to find the “Add Boot Option” button. Click it.
  • Add a boot option named “Fedora” and click the “…” to open the file browser.
  • Find your USB drive in the list (mine was named “Anaconda” by the Fedora Media Writer).
  • Load the file “/EFI/BOOT/grubx64.efi
  • Save the new boot item.  Use drag and drop to move it to the top, so it has the highest priority.
  • Save your settings, and restart – and hopefully – Fedora will load up and kick into Live CD mode.

Before you install

Before I hit install, I did a quick check:

  • Wifi works: yes
  • Sound works: yes
  • Touchscreen works: yes
  • Webcam works: yes
  • Suspend / Resume works: no. Bummer – but my research had suggested this was probably going to be an issue, so I continued anyway.

In the install options I deleted the Windows 10 partition, and got it to auto-partition from there.  Then hit install.  Woo!

Getting suspend and resume to work.

**Update:** It turns out I’m still having supend/resume issues.  I think figuring out how to install the 4.13 version of the kernel while SecureBoot is enabled is what I will need.

After the install, almost everything worked as expected, and the whole experience was really nice – it’s a beautiful laptop, and the new version of Fedora with Gnome 3 is quite pleasant.  Until you close the lid and it suspends.  Because then it won’t wake up again.

What would happen:

  • The screen would go dark, but the keyboard backlight would stay on.
  • Pressing the tiny power button on the side of the case does nothing at first.
  • If you keep holding the power button for like 10 seconds, the login screen lights up, and everything is still there, but the moment you let go, it suspends again.
  • If you hold it down long enough, it eventually turns off.  You’ll need to do this to get out of the broken suspend, but it takes forever and feels like you’re pressing the little power button so hard you’ll break it.

What I learned about why it doesn’t work:

  • It’s a Linux kernel issue.  See this bug report.
  • You can check your kernel version by typing
    [jason@jasonxps enthraler]$ uname -a
    Linux jasonxps 4.11.8-300.fc26.x86_64 #1 SMP .....
  • I read a bunch of Q&A suggestions on tips for getting this to work, but none helped that much – reading through the bug report above though convinced me that I needed to upgrade from 4.11 to 4.12 or 4.13.
  • Upgrading to the very latest kernel (4.13-rc4) seems easy, but as the wiki page notes, it won’t work with SecureBoot – so that turned out to be a dead end for me.  (Signing the kernel for SecureBoot might be possible, but I couldn’t be bothered learning enough to understand the tutorials).
  • 4.12 isn’t released yet, but it’s supposed to be in testing.  Unfortunately, enabling the “updates-testing” repository and running “dnf upgrade” didn’t install the new kernel.  I’m not sure if it was supposed to.
  • In the end, I installed 3 RPMs manually.  (GASP!)
  • Here is the page with the packages I need.  Apparently it’s only been in testing for 9hours – perhaps that is why it wasn’t coming through the update channel?
  • I had to download these 3 files:
  • Once downloaded, I ran this to install them:
    dnf install kernel-modules-4.12.5-300.fc26.x86_64.rpm kernel-core-4.12.5-300.fc26.x86_64.rpm kernel-4.12.5-300.fc26.x86_64.rpm

    Be careful here that you don’t override the kernel you’re currently using.  You may need to add options to “dnf” if it suggests that it’s going to remove the package for the kernel you’re currently on.

  • And then you update grub:
    sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
  • After restarting, test that the new kernel is working:
    [jason@jasonxps enthraler]$ uname -a
    Linux jasonxps 4.12.5-300.fc26.x86_64 #1 SMP ...
  • And now, you can close the lid and expect it to suspend and resume.  For me, I still have to hold the power button for like 6 seconds to get it to resume, but hey, at least it comes back.  I’m hoping 4.13 will come out and fix that problem too.
  • Note – I also changed the setting in Gnome Power Settings for “When the Power Button is Pressed” from “Suspend” to “Nothing”.  Reason: sometimes holding down the power button that long to resume it would then trigger another “supsend”.  So I set the button to do nothing.  I can just close the lid to supsend.

Ubuntu Unity-like keyboard shortcuts

Overall I’ve really enjoyed Gnome 3 over Ubuntu Unity.  One thing I missed though was being able to press “Win+1” to open my file manager, “Win+2” to open Firefox, “Win+3” to open Visual Studio Code, “Win+4” to open Chrome etc. Basically, my most common applications all sit in the dock on the left, and I can use a quick keyboard shortcut to switch to that app – and if it’s not open already, it will open it.  Gnome doesn’t have this by default.

Luckily, there’s an extension that adds this behaviour: https://github.com/franziskuskiefer/app-keys-gnome-shell-extension

Conclusion

Well, that was certainly not something I’d trust my Grandma to complete successfully.  But hey – at least it works.  If I learn any new tricks for getting Fedora to run nicely on a Dell XPS13 9365 2-in-1, I’ll post here.

If you have any questions, feel free to ask – no guarantees I’ll be able to help though :)