Notes on switching from a Windows desktop to an Ubuntu 15.10 Linux desktop

Published 2015-11-17, last updated 2016-07-18. This document will be a work in progress for a while.

Motivation

(TODO, Windows 10 problems with audio and Telemetry and having to flip 40 privacy options)

My hardware

I'm listing it here because some of the things below will be irrelevant with different hardware.

First impressions

Speed

Compared to Windows 8.1/10, the Linux desktop felt ridiculously fast and responsive, to the point where I wondered why I'd ever boot into Windows again. Why does the Linux desktop feel so much faster in comparison? Probably for the reasons mentioned in I Contribute to the Windows Kernel. We Are Slower Than Other Operating Systems. Here Is Why:

Windows is indeed slower than other operating systems in many scenarios, and the gap is worsening. The cause of the problem is social. There's almost none of the improvement for its own sake, for the sake of glory, that you see in the Linux world.

Granted, occasionally one sees naive people try to make things better. These people almost always fail. We can and do improve performance for specific scenarios that people with the ability to allocate resources believe impact business goals, but this work is Sisyphean. There's no formal or informal program of systemic performance improvement. We started caring about security because pre-SP3 Windows XP was an existential threat to the business. Our low performance is not an existential threat to the business.

See, component owners are generally openly hostile to outside patches: if you're a dev, accepting an outside patch makes your lead angry (due to the need to maintain this patch and to justify in in shiproom the unplanned design change), makes test angry (because test is on the hook for making sure the change doesn't break anything, and you just made work for them), and PM is angry (due to the schedule implications of code churn). There's just no incentive to accept changes from outside your own team. You can always find a reason to say "no", and you have very little incentive to say "yes".

There's also little incentive to create changes in the first place. On linux-kernel, if you improve the performance of directory traversal by a consistent 5%, you're praised and thanked. Here, if you do that and you're not on the object manager team, then even if you do get your code past the Ob owners and into the tree, your own management doesn't care. Yes, making a massive improvement will get you noticed by senior people and could be a boon for your career, but the improvement has to be very large to attract that kind of attention. Incremental improvements just annoy people and are, at best, neutral for your career. If you're unlucky and you tell your lead about how you improved performance of some other component on the system, he'll just ask you whether you can accelerate your bug glide.

More specifically, I've found Linux to be ~20x faster at starting a process, many times faster at traversing filesystem trees, and (at least without a compositor) it seems to respond to user input at least 2 frames faster than Windows. I also noticed (using evhz) that Linux polls my USB mouse at 500hz, while Windows is locked to 125hz.

Difficulty of setup

Even having used Linux for 15 years, I was surprised by the numerous installation and setup difficulties.

Accessing encrypted NTFS volumes

TrueCrypt volumes

I used tc-play and ntfs-3g (both packaged in Ubuntu) to access my TrueCrypt NTFS volumes read-only. Read-write probably would have worked as well, but I decided to migrate all of my data to XFS. I used a script similar to this one to mount all of my drives:

# get the by-partuuid/ UUIDs from `blkid`

cat /root/password | tcplay -m NTFS-X -d /dev/disk/by-partuuid/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
cat /root/password | tcplay -m NTFS-Q -d /dev/disk/by-partuuid/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
cat /root/password | tcplay -m NTFS-R -d /dev/disk/by-partuuid/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

# streams_interface=windows for ADS access via :ads_name suffixed to path
NTFSOPTS="ro,uid=1000,gid=1000,umask=077,show_sys_files,streams_interface=windows"
for drive in X Q R; do
    mkdir -p /mnt/$drive && mount -t ntfs-3g -o $NTFSOPTS /dev/mapper/NTFS-$drive /mnt/$drive &
done

VeraCrypt volumes

I did not have any VeraCrypt volumes, but the code in this tc-play pull request might work. Either that or VeraCrypt itself.

BitLocker volumes

I built the develop branch of dislocker to access my only BitLocker volume. But I found that it did not read one of my files correctly (now fixed).

# dislocker-fuse --readonly --verbosity --user-password -V /dev/sda4 /mnt/bitlocker-C    
Enter the user password: 
# mkdir -p /mnt/C
# mount -t ntfs-3g -o ro,uid=1000,gid=1000,umask=077,show_sys_files,streams_interface=windows \
  /mnt/bitlocker-C/dislocker-file /mnt/C

GNOME 3 problems

I was planning on using GNOME 3 because it seemed like a well-integrated environment that supported all the Windows shortcuts, but with the nvidia-355 or nvidia-358 drivers, gdm and gnome-session always crashed with something similar to this segfault:

kernel: gnome-shell[1178]: segfault at 64 ip 00007f7157aee970
sp 00007ffeb811f8d8 error 4 in libcogl.so.20.3.0[7f7157a9d000+a0000]

from https://bbs.archlinux.org/viewtopic.php?id=195866&p=3

There were reports that this is related to outdated Intel microcode, so I installed intel-microcode and made sure my Intel microcode was being updated. No luck, though, even after many attempts.

I gave up on GNOME 3, went with XFCE4 and was quite happy with it, except for the compositor.

When I revisited GNOME 3 for this article, it started up just fine, without any segfaulting. I have no idea why this resolved by itself. I don't think I changed anything that would be relevant to libcogl. I installed and uninstalled many peripheral gnome/gtk packages, rebooted many times (including a real power-off), disabled Fast Boot, and enabled Intel Virtualization Technology (VT-x) in my BIOS settings. Unfortunately, I can't pin down the root cause yet.

XFCE4 problems

Compton problems

I needed Compton to solve screen tearing in Firefox (see below), but the configuration on the Ubuntu forums introduced strange display lag, where I would press a key in gnome-terminal and see the update only a full second later. The problem was not with the configuration, but with a NVIDIA-related bug in the old version of Compton in Ubuntu 15.10.

The https://launchpad.net/~richardgv/+archive/ubuntu/compton PPA lacked a package for wily, but https://launchpad.net/~kelleyk/+archive/ubuntu/compton has one that works (via this comment). Installing compton from that PPA and then modifying my configuration fixed the 1-second lag issue:

backend = "glx";
paint-on-overlay = true;
glx-no-stencil = true;
glx-no-rebind-pixmap = true;
vsync = "opengl";
xrender-sync = true;
xrender-sync-fence = true;

vsync = "opengl-swc", "opengl", and "none" all seemed to work and provide vertical sync, but "opengl-swc" was noticeably sluggish, while "opengl" seemed to be ~1 frame faster than "none".

See man compton for the full list of vsync methods.

Unfortunately, even with Compton set up correctly, having a compositor enabled made the desktop noticeably less snappy than compositor-free X. But this is something you'd only notice if you switch between having compton on and off. Most people used to Windows/OS X/GNOME 3/Unity wouldn't care about this at all.

This is probably not a Compton problem but a more general compositor problem. So I have to choose between a tearing-free Firefox and a completely lag-free desktop. Because of the compositing lag and other problems, I stopped using Compton and got used to screen tearing in Firefox.

Could compositing be done with fewer frames of lag? This comment suggests it is possible:

Also, I wish all GPUs would keep compositing fast and minimum depth, only 1 frame shallow where possible, by doing just-in-time compositing in-GPU during VSYNC. Then it has no lag penalty over proper triple buffer. Memory bandwidth is fast enough to finish compositing in just a few hundred microseconds, so compositing can be done just-in-time in GPUs. Manufacturers that do not, need to get with that ball already being done in some GPUs, and optimize compositing to be as shallow as possible. Then, there is only the double buffer style lag penalty, and reduced by VSYNC OFF and compositing becomes the defacto proper triple buffer. Some say it is 'emulated', but it is a duck (it looks like a duck, it quacks like one, it reduces lag without tearing). It is a real proper triple buffer occuring, then potentially tape-delayed a bit again by inefficient compositing! (But still less lag than double buffering in windowed mode on same GPU!)

NVIDIA problems

Tips

X / Xorg problems

AutoHotkey / binding the 4th and 5th mouse buttons

I used AutoHotkey on Windows to bind my fourth and fifth mouse buttons (the side back/forward buttons) to switch tabs in all of my applications. AutoHotkey doesn't run on Linux, but I managed to get this functionality with xbindkeys and xautomation (thanks to this answer for the tip).

apt-get install xbindkeys xautomation

I wrote an ~/.xbindkeysrc:

"xte 'keydown Control_L' 'key Page_Up' 'keyup Control_L'"
  b:9

"xte 'keydown Control_L' 'key Page_Down' 'keyup Control_L'"
  b:8

and ran xbindkeys. My fourth and fifth buttons (8 and 9 in Xorg) could now switch tabs in all applications that used Ctrl-PgUp/PgDn for tab-switching.

To get the names of the keys for xbindkeys or xte, apt-get install x11proto-core-dev and read /usr/include/X11/keysymdef.h.

Fonts

Sound / PulseAudio problems

PulseAudio has actually been mostly unproblematic for me: after a little tweaking, my audio works fine everywhere, without any skips or glitches (unlike Windows 102). I encountered these things:

systemd problems

Windows trained me to hit Ctrl-Alt-Delete before unlocking, but this key combination makes systemd reboot the system, at least when pressed at the console. I disabled this behavior with:

systemctl mask ctrl-alt-del.target
systemctl daemon-reload

Note that systemd will still reboot the system immediately if you press Ctrl-Alt-Delete 7 times within 2 seconds.

Stopping non-root users from shutting down or rebooting the system

Ubuntu lets any local user shut down or reboot the system, and xfce4 presents a giant confirmation-free reboot button when you're logging out, so it's very easy to accidentally reboot the system. I stopped non-root users from being able to press these buttons by adding a polkit configuration file as described here.

GTK2 file chooser dialog problems

Chrome

Chrome works fantastically well on Linux, probably even better than it does on Windows. This is not a surprise: developers at Google use Ubuntu workstations, and ChromeOS is Linux-based, so any serious Linux-specific bugs are very likely to get fixed. On Windows, I saw serious regressions in Chrome, including a bug that caused new tabs to crash on Windows 8.1. This regression remained in stable Chrome for about 6 weeks.

vsync: On my system, the entire Chrome window exhibits no screen tearing, even when running without an X compositor.

Video support: YouTube playback, whether using mp4 or webm, worked perfectly fine.

Missing/broken functionality

Firefox

Firefox does not work quite as well on Linux as it does on Windows. Fortunately, most of these are just odd defaults that can be fixed. I eventually gave up Tree Style Tab and switched to using Chrome as my primary browser, because it's better-sandboxed and much faster at running real web applications.

Missing/broken functionality

GNOME Terminal

I initially used gnome-terminal, but abandoned it because it had problems:

Tips

ROXTerm

ROXTerm is a great replacement for GNOME Terminal that is capable of opening tabs to the right of the current tab, as well as indicating new output in a tab via a small icon (Profile Preferences -> Tabs -> 'Show terminal status in close buttons').

The tips in the GNOME Terminal section apply here too, except ROXTerm --tab doesn't seem to create more than one tab when specified multiple times.

Broken functionality

Sublime Text 3

There is a report that Sublime Text 3 crashes on Ubuntu 15.10, but it works perfectly here (tested: build 3095 x64).

After moving my preferences from Windows, I needed to rename Default (Windows).sublime-keymap to Default (Linux).sublime-keymap.

Missing/broken functionality

Emacs

I used Emacs on Windows for org-mode, and after fixing all the paths in my ~/.emacs.d, it works near-identically on Ubuntu, except several times faster.

HexChat

HexChat works the same as it does on Windows, except faster and with a working spell checker.

I have not yet tested this yet, but I doubt it has the Windows GTK bug that lands the IME input widget in the top-left corner instead of at the cursor.

qBittorrent

qBittorrent appears to work just as well as it does on Windows, except for a Qt context menu problem (maybe only on a hidpi display): right-click and the first context menu item is automatically selected and activated on right-click release. More annoying than it sounds.

Tips

gitk

gitk looks fine on Windows but is incredibly ugly on Linux. I switched to tig for reviewing commits. gitg lacked some keyboard shortcuts I needed.

foobar2000

foobar2000 worked incredibly well in wine-staging (I did not test wine) with one minor exception: it appeared to hang for 5-10 minutes on startup while scanning my media library with 134K tracks. This did not happen on Windows, where the main thread was unobstructed by the rescan. To fix this, in Preferences -> Media Library -> Music folders, I right-clicked on each folder and unchecked both 'Rescan on startup' and 'Monitor for changes while running'.

foobar2000 in wine-staging (lodpi)
foobar2000 in wine-staging 1.7.54, configured to use Arial Unicode MS to make CJK characters render. foo_wave_seekbar and foo_dumb work fine as well. Note foo_wave_seekbar works only in GDI mode.

foobar2000 in wine-staging (GTK3 + Noto Sans)
foobar2000 configured to use GTK3 theming and Noto Sans CJK SC to make CJK characters render. This font is hinted properly while Arial Unicode MS is not. Unfortunately, the GTK3 theming is unusable because it causes foobar2000 to lock up about once or twice an hour.

foobar2000 in wine-staging (hidpi)
The first foobar2000 setup on a 4K display with wine after winecfg tweaks: 165dpi for text and bigger scrollbars.

VLC / mpv

I had problems with VLC not scaling some of its widgets properly on a 4K display, so I switched to mpv. I made it behave a little more like VLC with this ~/.config/mpv/input.conf:

AXIS_UP    add volume 2
AXIS_DOWN  add volume -2
MOUSE_BTN3 add volume 2
MOUSE_BTN4 add volume -2

[ add speed -0.1
] add speed 0.1

F11 cycle fullscreen

Viewing lots of images

On Windows, I used Directory Opus' built-in image viewer, which inherits the sort order from the file manager, automatically zooms images, and allows using the mousewheel to switch images.

On Linux, after trying nomacs, eog (Eye of GNOME), eom (Eye of MATE), viewnior, and feh, I settled on feh. nomacs was unable to automatically zoom in a useful manner when going through images fullscreen. Neither eog or eom could be configured to switch images using the mousewheel, though eom seemed better for not showing a menubar when fullscreen. viewnior had a setting for making the mousewheel switch images, but it was broken. feh had none of these problems and I'm pretty happy with it.

feh's context menu doesn't expose all of its functionality, so look at man feh. feh -Z to automatically zoom, -F to start fullscreen, -S mtime to sort by mtime, and --font yudit/20 --menu-font yudit/20 to have legible fonts on a hidpi display. If you use another font, note that feh looks up fonts by filename and that you'll probably need --fontpath.

Note that by default PgDn and PgUp move by 5% of the image set rather than to the next or previous image. I use this .config/feh/keys to make it behave a little more like Directory Opus' viewer:

zoom_in equal
zoom_out minus
toggle_fullscreen F11 v
next_img Next Right Down
prev_img Prior Left Up

Taking screenshots

Failed attempt 1: ImageMagick's import

I found that using ImageMagick's import5 to take screenshots caused display output to freeze for 200-400ms on my 4K display.

Failed attempt 2: xwd

Taking screenshots with xwd -silent -root -screen -icmap | gm convert xwd:- out.png resulted in no hiccups, but it got the the z-order completely wrong on many of my screenshots. For example, with multiple maximized gnome-terminal windows, the wrong gnome-terminal appeared in the screenshot.

Success: ffmpeg

ffmpeg has an x11grab device that works well for taking both video and single screenshots of the X screen. I wrote these scripts to take screenshots (they all output to stdout):

Note that ffmpeg will include your mouse cursor in the screenshot.

Making a video recording of the X screen

The methods on the ffmpeg wiki result in serious frame drop issues (including the command with -preset ultrafast) , but this stackexchange answer works.

Unreal Tournament 2004

I worked with an existing UT2004 install directory, so I did not have to install the game again.

I had some trouble with setting up UT2004 to use the native Linux binaries (though the crashes on multiplayer can perhaps be fixed by using these binaries or this install script), so I decided to use Wine to run the 32-bit UT2004.exe instead. I used wine regedit to import a .reg file with my CDKey into the registry:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Unreal Technology\Installed Apps]

[HKEY_LOCAL_MACHINE\SOFTWARE\Unreal Technology\Installed Apps\Unreal]
"Folder"="C:\\Games\\UT2004"

[HKEY_LOCAL_MACHINE\SOFTWARE\Unreal Technology\Installed Apps\UT2004]
"CDKey"="XXXXX-XXXXX-XXXXX-XXXXX"
"Folder"="C:\\Games\\UT2004"
"Version"="3369"
"ADMIN_RIGHTS"="You need to run this program as an administrator, not as a guest or limited user account."
"NO_DISC"="No disc in drive. Please insert the disc labelled Unreal Tournament 2004 Play Disc to continue."
"NO_DRIVE"="No CD-ROM or DVD-ROM drive detected."
"TITLEBAR"="Unreal Tournament 2004"
"WRONG_DISC"="Wrong disc in drive. Please insert the disc labelled Unreal Tournament 2004 Play Disc to continue."
"YEAR"="2004"

The game worked fine, but there was an unacceptable amount of stuttering with the Direct3D renderer, especially at the beginning of a match. I edited UT2004.ini to switch it to the OpenGL renderer6, which worked perfectly, even at 3840x2160. I played a few online matches and it worked just as well as it did on Windows.


  1. This video describes the refinement (actually worsening) of Roboto, intended to make it more "friendly".

  2. Exacerbated by the network traffic that qBittorrent generates?

  3. You can take a look at its contents with sqlite3 content-prefs.sqlite .dump

  4. SecureCRT actually creates a new session inside the existing connection, which is why opening > 10 tabs requires raising MaxSessions in /etc/ssh/sshd_config.

  5. Tested ImageMagick 6.8.9-9 Q16 x86_64 2015-08-06

  6. The WineHQ page suggests another possible fix: disable GLSL Support