- Running away from Mac? How come?
- XPS 9570
- XPS 7590
Running away from Mac? How come?
20190806 UPDATE: this guide was born for XPS 9570 and Ubuntu. Then it was updated for XPS 7590 and Arch Linux with LUKS.
20200926 UPDATE: I lost many hours today trying to bring my installation back to work, I’ve added a postmortem with useful links.
I’ve been a Mac user for 6 years. Back in 2012 I had been a really happy Gentoo user for many years, but by then some iOS development (a simple iOS “game” and a freelance project) moved me to OS X. In addition, I also take pictures and even make videos from time to time. So, switching to Apple was a nice move: I’d keep the good parts of a *nix sistem and get rid of Windows for the Adobe suite. In addition, Macbook Air was a great computer for its price, powerful enough and extra light.
I used two Macbook Airs (personal and work) for 4 years. Past year, when I wanted a more powerful machine, I moved to the new Macbook Pro (yes, the one with the infamous Touchbar). A ~$3k device. It should’ve been great. Spoiler: it wasn’t.
Here are some of my pains:
- The Touchbar is not a good addition. It provides no value at a cost: you miss the physical feedback of the buttons. I wouldn’t have chosen it, but it’s a must if you want a top of the line 15” device. The theoretical benefit is having a context-aware key set, but it just doesn’t work. I haven’t taken advantage of it a single time in a year and a half. Why would you look at the keyboard? For context-aware interface you already have the UI, and for quick functions you have shortcuts. Anyway, I wouldn’t have got rid of it just because of this.
- The infamous keyboard. During the last weeks, 5 keys were malfunctioning. Really. Throughout my life I’ve used ~15-20 keyboards in a daily basis and this is the first time that a keyboard has been a problem. It’s not even the first generation of the design, which was introduced for the Macbook, so there’s no single excuse for this. At least, Apple has conceded.
- In CARTO we use Vagrant and Docker A LOT, specially at backend. Performance is far from great in Mac, and Data team deal with large datasets, so this is a huge pain and source of frustration. It’s not only slow: long tasks on USB drives with NTFS format would hang (I corrupted a PostgreSQL 4 times running batches), and a simple
rm -rf node_modulesmade the system crash. This is arguably not a macOS issue, maybe it’s just that Linux is a much better fit for me.
- Battery didn’t last 4 hours with basic use. Not even 3h with videoconference.
- A lot of small annoyances:
- For some reason, switching among tasks that were maximized to occupy full desktops (and I was a heavy user of that) stopped working.
- Some that might not be directly macOS fault, but wasn’t mine either: Tunnelblick wouldn’t deal with VPN DNSs properly (Ubuntu does, with a nice native UI).
- HDMI support was horrible (at least with my monitor, until the last update.) For more than a year, plugging my external monitor always led to a blue screen that was only fixed by locking and unlocking (?).
- My monitor has a USB Hub where a Ethernet adapter is plugged. 90% of the times that I plug the computer back I have to unplug and plug the adapter for it to work.
- About the last 2 complaints: no, an official Apple hub didn’t fix it either.
- An additional external power adapter costs 90€, and it doesn’t even includes the needed USB-C (which Apple sells at 30€).
So, I asked for a computer change. Other person in CARTO (designers? frontenders?) can enjoy the powerful Macbook Pro more than I would, and my life might be happier.
After some research, I chose the XPS 9570. In fact, I chose the 9560, but when I was going to ask for it the announcement of the new model was too close, so I preferred waiting :). XPSs are known as good machines for developers, with good Linux compatibility. Highlights:
- Did you know that a laptop can be thin enough and still keep USB 2 and HDMI ports? Mind-blowing!
- I admit that I wanted the higher resolution one, but 4k for a 15”4 laptop is certainly an overkill. FHD screen is nice enough and improves battery live.
- While it’s slightly wider it’s slightly “shorter” than the Macbook Pro, so the size is more or less equivalent. I use a vertical layout for my displays (it’s feels better for my neck), placing the laptop below my main monitor, so those dimensions happen to be more comfortable to me.
- The webcam is placed under the screen. I guess that it makes the frame thinner. That’s nice, but I look like Jim Carrey at Bruce Almighty during the meetings. That might cause me a meme, but it’s still a good tradeoff :). If I could upgrade my iPad to iOS 10 I’ll try using it for videoconferences, but that’s no longer true :(. BTW, 0 problems for webcam, sound or microphone. It just works.
- ~$1000 cheaper than the equivalent Macbook Pro.
- Keyboard seems to work, so far. Crazy.
Although I love Gentoo, I don’t have too much time and my Linux skills are a little rusty, so I kept things simple and installed Ubuntu. There are plenty of guides for the 9560. Read this first, and this, and other useful references:
- XPS 9560 and Ubuntu.
- DELL XPS 9560 - The Perfect Linux Laptop? video series + the Full List of Changes.
- Change SATA Operation from “RAID On” to “AHCI”, including restart into safe mode.
- Disable Secure Boot –> Secure Boot Enable.
- Enable General –> Advanced Boot Options –> Enable Legacy Option ROMs.
- POST Behavior –> Fastboot –> Thorough.
- Turn off device encryption. I’m not 100% sure if this is needed, but I think it is if you want Ubuntu to be able to find the drive.
- Resize partition to make room for Ubuntu.
- Ubuntu installation:
After user and password, I got an empty desktop and a frozen cursor. CTRL + Alt + F2 allowed me to run this fix: 1, 2:
sudo dpkg --configure -a sudo apt-get update sudo apt-get upgrade -y sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt-get install nvidia-390 sudo reboot
In addition, this also fixes an issue that wouldn’t allow Ubuntu to shutdown or reboot.
Read this and this to learn a couple of things about sleep levels. In addition to that, I had to expand swap size beyond my RAM. With that and
/etc/default/grub I have a working suspend mode that wastes almost no energy.
As usual, graphic card drivers are a pain. As I don’t take advantage of the nVidia card at Linux*, I chose to power it off by removing nouveau module. I also set powertop to autotune on boot. Although I haven’t tested it yet, that should grant ~10h of battery autonomy.
*: this might change soon, as I’m considering giving Darktable a try.
This is my accumulated
apt install so far.
For Docker to work without
sudo you need this:
sudo usermod -aG docker $USER
Vagrant needed manual installation because of an issue (1, 2).
IntelliJ is my main development environment. Although it’s available through Snap (
sudo snap install intellij-idea-ultimate --classic --edge) you still need JetBrains Toolbox for license management and sync settings, so it’s not useful enough. In addition, Toolbox is a nice launcher that helps picking recent projects.
Spotify, though, can be installed with Snap:
sudo snap install spotify.
/home/USERNAME/snap/spotify/16/.config/spotify/Users/USERNAME-user/prefs and add
storage.size=1024 to reduce disk usage from 10GB to 1GB.
I used Linux for years, but I moved to Mac ~7 years ago. Although some of the configuration files (such as
.vimrc) might be taken from my old
.dotfiles repo, I created a new, simpler configuration files repo from scratch.
I’m trying Lepton as a Github Gists client.
Extra ball: some suggestions, via @elmendalerenda, thanks!
Sound output disappearing
From time to time there’s no sound and only “Dummy output” appears at sound configuration. Running
pulseaudio -k && sudo alsa force-reload usually makes it work again.
From time to time WiFi stopped working because of a driver crash (sorry about not pasting syslog output). I just followed the manual firmware update process 🤞.
Check that you’re using Xorg instead of Wayland (you can choose them in the login window, with the gear icon) and install and configure fusuma.
- I might’ve spent ~3 days installing and configuring stuff. But running anything inside Vagrant with LXC support is SO FAST that I think that I’ve already paid it off.
- Gnome is very user friendly, specially for a developer. Built-in support for VPNs (with good DNS resolution), options to restrict background downloads in some WiFis (for phone tethering), task switching works, no matter the status of the window…
- :heart: USB ports.
- Trackpad is pretty good and big enough.
I still sometimes lose the focus because I trigger clicks, thoughI’ve disabled “tap to click” and I’m happy.
- Keyboard layout is slightly different, I still have to get used to it as well, specially because I’m using FXX and Fn a lot. Mac Pro butterfly keyboard felt slightly better but, as you know, it’s broken. Dell one might be the second best I’ve ever used after that one, and hopefully it will last longer.
- In order to make “workspaces” (“virtual desktops”) span both displays in Ubuntu you have to install Gnome tweaks application.
- Research about nVidia drivers.
- Gentle power down: shutting down kills applications without mercy, and Chrome and Firefox think that they crashed.
- Fingerprint reader doesn’t work in Linux yet, there’s no available driver.
- I need Windows for my amateurish Lightroom, Photoshop and Premiere tasks. I’ll give Darktable a try.
- Gnome can’t remember the applications that you were running when you logged out. I’ve workarounded it with “startup applications”.
- Three finger gesture to display running applications. I workaround it with the simpler task switcher shortcut and the worplaces switcher shortcut, but it’ll be hard to forget (although workarounds are arguably faster).
- Terminator (still) doesn’t support native tmux integration (like iTerm does).
I’ve already spent more than two weeks with this setup and I’m really happy. In my case, there’s no single reason to stay with Apple for software development (I’m not alone here). For me, this computer with Linux is just better, faster and cheaper. Let’s revisit this in some months!
One year later, I bought the next version of that computer, the XPS 9570 (same configuration, i7). The only remarkable change is the camera placement, which is great, no more Carrey-sh look :-)
My goal was a dual boot system (Linux + Windows) with LUKS cypher in Linux (for security and Dropbox support). While I had a good experience with Ubuntu, many colleagues suggested Arch Linux as a better alternative, so I decided to give it a try (everybody told me to forget about Gentoo complexities nowadays). This distro comparison also helped:
- Installing Arch is based on precompiled binaries (so it’s quicker than a normal source-based Gentoo installation).
- Simpler than Gentoo (I don’t need/want more powerful settings).
- Rolling-based (instead of discrete as Ubuntu).
Arch Linux documentation is just gorgeous. I’ve written down here some notes for my future self. If you’re interested, check the references.
- Dell XPS 15 7590 > 9570 > 9560.
- Installation guide.
- Suspend and hibernate, with encryption.
- General recommendations.
- List of applications.
- SSH keys and agents.
- pacman tips and tricks.
- Created a Windows Bootable pendrive with this Microsoft Tool, just in case…
- Disabled Fast Startup: Power Settings –> System Configuration –> uncheck “Turn on fast startup”.
- Reduced Windows partition to 150GB (with Windows disk management).
- Followed “SOLUTION: Switch Windows 10 from RAID/IDE to AHCI operation” guide.
- Additional BIOS setup (F2 at POST):
- Disable Secure Boot –> Secure Boot Enable (not supported by Arch Linux). Restarting Windows led to a Bitlocker recovery page, but adding the key from their site worked. You only need to do this once.
- Change SATA Operation from “RAID On” to “AHCI” so SSD can be detected.
- Behavior –> Fastboot –> Thorough.
- Booted USB Arch Linux image (F12) and followed the installation guide until “Partition the disks”, where
I begun LUKS on a partition:
- As the computer already has an EFI partition and I don’t need encrypted root, I just created a partition with all the remaining free space for
(parted) print devices (parted) select /dev/nvme0n1 (parted) mkpart primary ext4 # ... accept the realignment
- Then, mounted boot partition at
/mnt/bootand resumed the installation steps.
- As the computer already has an EFI partition and I don’t need encrypted root, I just created a partition with all the remaining free space for
- Installed rEFInd as boot manager. Some peopled complained and suggested that systemd-boot is even simpler :shrug:
Additionally installed software:
Some of this will eventually get to my configuration files repo.
- Base packages:
sudoisn’t installed by default (:shrug:). I followed @sksergio suggestion to make my life a little more comfortable:
pacman -Sy # update database pacman -S sudo usermod -a -G wheel juanignaciosl visudo
%wheel ALL=(ALL) NOPASSWD: ALL.
WIP disclaimer: I’ve tried all this, no luck yet.
Tried automatic management with bumblebee.
In addition, I had to…
- Add my user to
- From this:
sudo mkinitcpio -p linux.
rcutree.rcu_idle_gp_delay=1to the boot options.
/etc/bumblebee/bumblebee.confunder [optirun] I changed the bridge method to
/etc/bumblebee/xorg.conf.nvidiaI set the BusID of my NVIDIA card (
lspci | grep VGA | grep NVIDIA):
pcie_port_pm=offto boot options (source).
- Pending: this.
This is the error that I see:
[juanignaciosl@127 ~]$ optirun glxgears [ 436.562997] [ERROR]Cannot access secondary GPU - error: Could not enable discrete graphics card [ 436.563124] [ERROR]Aborting because fallback start is disabled.
[juanignaciosl@127 ~]$ journalctl | tail -n 10 Aug 07 10:59:07 127.0.0.1localhost bumblebeed: Could not enable discrete graphics card Aug 07 10:59:07 127.0.0.1localhost kernel: bbswitch: enabling discrete graphics Aug 07 10:59:07 127.0.0.1localhost kernel: pci 0000:01:00.0: Refused to change power state, currently in D3 Aug 07 10:59:07 127.0.0.1localhost kernel: pci 0000:01:00.0: Refused to change power state, currently in D3
- Will Windows keep asking for Bitlocker key?
- Swap and hibernation.
- Working dedicated graphic card on/off.
Restoring an overwritten boot
After some Windows updates you can find yourself stuck into Windows :scream: . Just reinstalling rEFInd worked for me. Boot the USB stick that you used for installing.
- If you don’t remember which are your
/bootpartition you can check it at
- If you need network connection, after chrooting you can use your already existing configuration:
$ ip link set <link> up $ wpa_supplicant -B -c /etc/wpa_supplicant/<your_ssid>.conf $ dhclient <link>
Here are my steps:
$ loadkeys es $ cryptsetup open /dev/nvme0n1p7 cryptroot $ mount /dev/mapper/cryptroot /mnt $ mount /dev/nvme0n1p1 /mnt/boot $ arch-chroot /mnt $ refind-install
Everything goes wrong
2020 couldn’t end without a crashing system.
sudo pacman -Syu and
yay -Syu in a weekly basis to keep the system up to date. It had caused no problem so far.
Today, upgrading crashed (the last line that I saw was an update of systemd).
The computer wouldn’t boot because of a corrupted kernel.
Starting with a USB and chrooting lead to a non-working pacman that wouldn’t allow to reinstall the kernel.
I didn’t keep logs, you can see me crying here, including
the initial kernel panic. While I didn’t check
it, it seemed to be a corrupted image. Anyway, having a broken
pacman is even worse. After logging with a USB recovery
image, I chrooted and tried to run
mkinitcpio to rebuild the kernel, but it failed with a lot of
Missing module errors.
If I tried to run
pacman -S linux, I got
/usr/lib/libcrypto.so.1.1 file too short. That file had zero-length, it
was corrupted during the broken installation. There’s
a guide about what to do if pacman crashes during an upgrade,
but it would keep returning the
file too short error. It looks like there’s a hard dependency on
openssl that I
wasn’t able to workaround. I tried moving the symlinks at
/usr/lib, but it wouldn’t work.
pacman to run I had to delete
There are statically-linked pacman packages. I downloaded it, but
it wasn’t a solution either, I got plenty of
<filename> already exists in filesystem.
At that moment it became obvious that any workaround would require a lot of manual fixing (file deletion and so on),
so I chose to reinstall. That wasn’t as straightforward as I would’ve wanted, because
pacstrap doesn’t override, and keeps
some of the
pacman checks, so I had to manually rename the base folders.
BTW, I also got a
invalid value Path error related to a hook, but the cause was using the USB image that I used for
the installation one year ago, which was outdated. A new image addressed that.
Other useful links
- iwd, a command line assistant for the Wi-Fi.
- Arch Linux mkinitcpio: Possibly missing firmware for module.md.
- l-page of the Arch archive for downloading old versions.
The good parts
/homewasn’t lost, so all the data and most of the configuration was kept (creating the users with
useradd -d <oldpath> usernameworked like a charm).
- I was (almost) sure of not losing anything, even in an encrypted hard drive, mostly because of the support of the great documentation and the nice tooling.
The bad part
- I lost one full day. Maybe I shouldn’t have been so stubborn about bringing
pacmanback to live and reinstalled earlier.
- Being able to install from the boot environment with
--sysrootis nice, but it’d be great if allowed fixing a broken pacman.
The actions that worked
- I booted with a USB recovery image, and mounted root and boot (see “Restoring an overwritten boot”).
- I renamed
...backupso it wasn’t used by
pacstrap. I should’ve renamed
mkinitcpio.conffile to support LUKS encryption.
- As during the process I had wiped the pacman cache (because it might’ve been corrupted) I manually downloaded
linux-headerspackages for downgrading the kernel and crossed my fingers very hard, because my hypothesis at that moment was that the kernel was the root cause of the crash.
- Resumed the installation guide from the
- Created my user with
-dto keep the existing home directory.
- Reinstalled most of my software with my install script.
IgnorePkgsections, so they’re not always updated.
IIRC, back in Gentoo times, upgrading the kernel kept old versions so rebooting with a working one was easier. I have to bring that back to my current setup.
One more thing
Arch has a
linux-lts package for installing a long-term support version of the Linux kernel. That’s a good way to
keep both the most up-to-date kernel and a stable version.
New summary when things go wrong
- Boot with a USB recovery image.
- Mount drives:
$ cryptsetup open /dev/nvme0n1p7 cryptroot $ mount /dev/mapper/cryptroot /mnt $ mount /dev/nvme0n1p1 /mnt/boot
- Resume installation from
pacstrap. Don’t forget running
useradd -m USERNAME -d EXISTING_HOME,