So whoa, I decided to do something outlandish: I switched my primary laptop to Ubuntu Linux.

Here are some setup notes (mainly for my own reference). My Laptop is a Lenovo X220.


Things I ocassionally need a refresher on.

gedit FileIWantToEdit
sudo gedit FileIWantToEditAsRoot
find . -name FileIAmLookingFor
grep pattern filename.txt
grep pattern * -r          # Recursive
grep -i pattern * -r       # Ignore case in pattern
grep pattern -r -I         # Recursive, ignoring binary files (-rI)
ln -s /target/file SymLinkName
# without -s creates a hard link.
# Symbolic Links are to a specific file name, meaning the file can change in place.
# Hard Links are to a file (not file name). Link still works if original is renamed.
ps -A                      # list all processes
ps -A | grep pattern       # filter ps results by a pattern (i.e. "fire" for firefox)
kill -9 PID_NUMBER         # Kill a process. Get PID_NUMBER from the above

More Notes:

file /path/to/filename     # Reports the type of file it is (notably 64bit or 32bit binary, uses shared libs, etc)
printenv                  # list all environment variables
printenv | grep pattern
xxd                       # like 'cat' but outputs hex

BIOS Tweak

Before I was able to get Ubuntu to boot correctly, I had to change my BIOS from “both Legacy and UEFI” mode to just “UEFI Mode”. To bring up the BIOS menu you press the blue ThinkVantage button. This setting can be found on the startup (?) page.

Lenovo Thinkpad Utils (Better Power Management)

Some notes here. is the home of TLP, a very useful utility for getting laptop Power Management under control.

sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get update
sudo apt-get install tdp tlp-rdw tp-smapi-dkms acpi-call-tools

sudo tlp start

More details here.

Key Remapping

The Lenovo X220 has Web Forward/Back keys beside the arrow keys. I prefer that they act like alternative PageUp and PageDown keys.

Open up /usr/share/X11/symbols/inet (i.e. sudo gedit /usr/share/X11/symbols/inet)

Find a key named ****. Change “XF86Back” to “**Prior**“.

Find a key named ****. Change “XF86Forward” to “**Next**“.

Browse to /var/lib/xkb/

Delete *.xkm in the /var/lib/xkb folder. You need to do this to force a keyboard code refresh.

Logout, then Login to refresh. (Or reboot)

Resources: Thinkpad Special Keys, XKB Question

* * *

Use XEV to check keycode information (if remapping other keys).


NOTE: This DOES NOT work anymore.

# This used to remap the Forward/Back keys to PageUp and PageDown #
xmodmap -e "keycode 166 = Prior"
xmodmap -e "keycode 167 = Next"
xmodmap -pke >~/.Xmodmap

Source Control

sudo apt-get install subversion mercurial git

Mercurial GUI:

sudo apt-get install tortoisehg tortoisehg-nautilus

# To Commit via GUI (checkin) #
thg ci

# To Push/Pull via GUI #

# NOTE: These are probably not needed. For reference, this is what I found suggested. #
sudo apt-add-repository ppa:tortoisehg-ppa/releases
sudo apt-get install tortoisehg python-nautilus

SVN and GIT (and Mercurial) GUI:

sudo add-apt-repository ppa:rabbitvcs/ppa
sudo apt-get update
sudo apt-get install rabbitvcs-nautilus3 rabbitvcs-cli

NOTE: RabbitVCS has a somewhat ugly icon set (bombs!?). Also at this time, you cannot disable individual modes, thus running both RabbitVCS and TortoiseHG at the same time doubles the icons. Uncool.


Prerequisites stolen from here.

sudo apt-get install build-essential xorg-dev libudev-dev libts-dev libgl1-mesa-dev libglu1-mesa-dev libasound2-dev libpulse-dev libopenal-dev libogg-dev libvorbis-dev libaudiofile-dev libpng12-dev libfreetype6-dev libusb-dev libdbus-1-dev zlib1g-dev libdirectfb-dev

Get the latest code, build, and install.

hg clone SDL2
mkdir SDLBuild
cd SDLBuild
make -j
sudo make install

Updating Graphics Drivers (to WIP)

Mesa 10.0 was released in December 2013 (now Mesa 10.1), which introduces OpenGL 3.3 support. Ubuntu 13.10 came out back in October (i.e. 2013-10), so it lacks this update.

Details can be found here.

To install Oibaf’s updated drivers:

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

To revert to your stock drivers (before updating Ubuntu Major versions):

sudo apt-get install ppa-purge
sudo ppa-purge ppa:oibaf/graphics-drivers

NOTE: The current MESA drivers (10.0.2) only support OpenGL 3.0 on the Intel HD 3000 (where as Windows supports OpenGL 3.1, plus many 3.2 and 3.3 extensions). Newer Intel GPUs (the HD 4000 and the HD 2500) should support up to OpenGL 3.3.

NOTE 2: The Intel HD 3000 does not support OpenCL. Newer Intel GPUs do.

Recovery Mode

Especially while playing video drivers, if you screw something up, you can hold SHIFT during boot to bring up the GRUB menu.

Start a Recovery Console (which is by default in Read Only mode) and do the following:

mount -o rw,remount /

Now you’ll be free to change files.

CPU and Network Usage Mini Graphs

sudo apt-get install indicator-multiload

Restart X (or reboot).

Setting up Windows 7 VM

Download the 64bit Linux ‘Bundle’ file.

Instructions borrowed from here.

chmod +x VMware-Player-?????.x86_64.bundle
sudo ./VMware-Player-?????.x86_64.bundle

Follow instructions. Fairly straightforward.

Attach a DVD drive, and insert a Windows 7 CD (NOT a restore CD). Create a VM. Adjust settings accordingly (half your RAM, equal number of CPU cores, ~60 GB of space).

To support Intel GPU drivers, open up the “???.vmx” file (where ??? is your VM name). Add the following line. = TRUE

NOTE: VMWare Player 6.0.1 only supports OpenGL 2.1 on Windows 7 (i.e. on par with OpenGL ES 2.0).

Disable Touchpad

I use a Lenovo laptop for a reason: It has a nub-mouse (joystick). I prefer this to touchpads. However, by default both input methods attempt to work at the same time. This can cause weird glitches, like random copy/pasting or focus loss. An easy fix is to just outright disable the

# To list all input devices. Look for a Synaptics TouchPad #
xinput list

# To disable a device, match up the Id number (12) with the Synaptics #
xinput set-prop 12 "Device Enabled" 0

Firefox Backspace Key

Due to some sillyness, it was decided that backspace on Linux should do nothing. For the “better” use, as a “Page Back” button, make the following tweak.

about:config                # in the url #
browser.backspace_action = 0

Custom Right Click Actions

Place files in ~/.local/share/nautilus/scripts/ that you want to make available from the right click menu. If a shell script, be sure to set it Executable (chmod +x). Also feel free to ignore adding a “.sh” file extension.

Useful Script: Run as Root




exit 0

Music Player

Install Audacious.

Current Track can be found under the Speaker Icon in the Panel (I wish there was a track/name up there). A preinstalled plugin AOSD can be enabled for a “Current Track” popup, whenever the song changes. There’s another plugin which enables media keys (FN+Arrows).

Image Editing

Install GIMP. For reals.

Run it. Go to the Windows menu and click Single-Window Mode.

Suddenly, it’s 100x more tollerable.

PNG files are exported, not saved (unlike Paint Shop Pro and Photoshop).


Install SpeedCrunch.


This doesn’t actually work, but…

Download it. Unzip it to /opt/gDEBugger/ (or some other nice folder).

Create a symlink so gDEBugger can find the 64bit GL libraries.

sudo ln -s /usr/lib/x86_64-linux-gnu /usr/lib64
sudo ln -s /usr/lib64/mesa/ /usr/lib64/

Then run /opt/gDEBugger/gDEBugger to start it. NOTE: gDEBugger-bin wont run directly.

More OpenGL debug tools are here (glslDevil?).

CodeXL (OpenGL/OpenCL Debugger)

Seems easy to install, but REQUIRES an OpenCL capable GPU. Sorry Intel HD 3000. 🙁

APITrace (OpenGL command logger and post-run trace tools)

Apparently this is the only Linux GPU debugger worth a damn.

git clone apitrace

sudo apt-get install cmake
sudo apt-get install phonon-backend-gstreamer phonon-backend-vlc     # To shut up qt-sdk
sudo apt-get install qt-sdk 
sudo apt-get install build-essential                                 # If not already done

make -C build -j

sudo make install -C build

Then to run:

apitrace trace BinaryName Args           # To Trace
qapitrace BinaryName.trace               # To View Trace

Restart Audio

It happens. Linux seems to sometimes get confused when I plug in a bunch of devices.

pulseaudio -k && sudo alsa force-reload


Silence gedit warnings

** (gedit:24433): WARNING **: Could not load Gedit repository: Typelib file for namespace 'GtkSource', version '3.0' not found

(gedit:24433): IBUS-WARNING **: The owner of /home/mike/.config/ibus/bus is not mike!
sudo chown mike ~/.config/ibus/bus
sudo apt-get install gir1.2-gtksource-3.0

Install Android SDK

Easy. First install Java and Ant.

sudo apt-get install openjdk-7-jdk
sudo apt-get install ant

Download the “SDK Tools Only” bundle. Unzip it somewhere (i.e. /opt/android-sdk/)

Run the SDK Manager


Download the NDK Package. Put it somewhere similar as the sdk (i.e. /opt/android-ndk/)

Set path and variables.

export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export PATH=$PATH:/opt/android-sdk/platform-tools:/opt/android-sdk/tools:/opt/android-ndk


Install NVidia PerfHud ES

IMO this is the best OpenGL debugger available (it shows geometry!), but it only supports NVidia Android devices.

Download the Tegra Android Development Pack. It’s an executable that downloads.

chmod +x
sudo ./

Deselect everything but PerfHud ES. Install it somewhere common (i.e. /opt/NVPACK/).

Setting up the POD Blender Exporter

Download PowerVR SDK.

Browse to /opt/Imagination/PowerVR/GraphicsSDK/PVRGeoPOD/Plugins/Blender/Linux_x86_64

Copy and to your /opt/blender/2.69/scripts/addons folder.

Copy and to your /opt/blender folder.

Start Blender. Go to File->User Preferences->Addons. Search for “pod”, and click the checkbox beside Import-Export: PVRGeoPod.

Done. Exporter can now be found under File->Export->PVRGeoPod.

Setting up Spine

Spine just works, so long as you have Java installed (see Android).

Download it, move it to /opt/, paste in your reg code, and go.

Lower Compiz CPU usage

Compiz has “Sync to VBlank” enabled by default. Causes a wasted 10% extra CPU usage.

sudo apt-get install compizconfig-settings-manager

Open Compiz Config Settings. Click on OpenGL (not the checkbox, the name). Unselect Sync to VBlank. Reboot.

Fix Audio Playback in Audacity

NOTE 2: Solved. Ignore everything below. To get audio playback working correctly in Audacity (and not silly weird glitch fast), simply select the “Samson GoMic: USB Audio (hw:1,0)” for output, instead of one of the many defaults. Fixed!

NOTE: This is incorrect. A good try though. Problem is the Samson Go Mic that I’m using as an audio interface. Audacity works fine with the internal sound card (which has a horrible mic). Oddly though, recording via the Samson appears to work though.

Open up “/etc/pulse/“.

Find the following line:

load-module module-udev-detect

Change it to:

load-module module-udev-detect tsched=0

Restart audio.

Sources: Audacity Forum, Pulse Audio Wiki.

Setting up the 3DConnexion Space Navigator 3D Mouse

Get the open source driver.

svn co svn:// spacenav

Build and install the Daemon.

cd spacenavd
sudo make install

Daemon must be run as root (otherwise it uses 100% CPU usage)!

sudo spacenavd

Build and install the config tool.

sudo apt-get install libgtk2.0-dev
cd spnavcfg
sudo make install


Run Blender.

Disabling Bluetooth Simple Sync

I assumed this was the problem with my PS4 controller not working wirelessly (disconnecting right away). This is not the case though. Default detection via Bluetooth works fine under Linux. Now I’m just hoping the problem is that the battery is low (have it plugged in charging).

sudo hciconfig hci0 sspmode 0


Making Backspace work as a back button in Nautilus

Open ~/.config/nautilus/accels

Add a line (without a “;”)

(gtk_accel_path "<Actions>/ShellActions/Up" "BackSpace")

Restart Nautilus.

nautilus -q

This is a regression introduced in Nautilus 3.6. The Ubuntu folks appear to have solved it, but only as of the current beta of Ubuntu 14.4. My 13.10 will have to wait to get it. 🙁

Make file sorting *NOT* ignore special characters

Set the current locale to the “C” language locale.

gedit ~/.profile

Add the following to the file.



GDB: ptrace operation not permitted

Fix is here.

Generally speaking, editing /etc/sysctl.d/10-ptrace.conf

Adding the following line:

ptrace_scope = 0

Re-enable whitelisting in the SysTray

From here.

sudo add-apt-repository ppa:timekiller/unity-systrayfix
sudo apt-get update
sudo apt-get upgrade

Restart Unity (Logout, then log back in).

To whitelist things (Xchat, xchat, Truecrypt, etc):

sudo apt-get install dconf-tools

Go to Desktop->Unity->Panel and add your whitelist.

Whitelist source, xchat source.

SSHFS/Fuse: Mounting remote SSH connections as part of the file system

To connect:

sshfs hostname: mountpoint

To disconnect:

fusermount -u mountpoint

The Dangers of the OIBAF drivers

Don’t get me wrong, the OIBAF MESA drivers are great. Bleeding edge Linux graphics drivers, with the very latest supported OpenGL features (GL 3.0 on my Intel HD 3000 GPU). We’re in a transition period though. Mesa just reached a very important milestone, several months after Ubuntu 13.10’s release: OpenGL 3.x support (i.e. Mesa 10.x). The upcoming Ubuntu 14.4 will ship with these new Mesa drivers, but gosh darnit, I’m doing serious GL shader development, and I need them now!

When I first installed them, everything was great. According to /var/log/apt/history.log, my version of OIBAF was from January 10th, 2014. A few days ago I upgraded to the very latest, and that broke both Chrome and more importantly VMware. My game stuff unusually is working fine with the new drivers, but the current drivers from today are busted.

So what I need to do: Uninstall OIBAF, then reinstall an older version of OIBAF.

Uninstalling a PPA (OIBAF)

First install PPA Purge.

sudo apt-get install ppa-purge

Then use it to purge the data.

sudo ppa-purge ppa:oibaf/graphics-drivers

Now I’d recommend a reboot, but Logging out and in *may* work (I can’t remember).

Checking Installed Mesa/GL version

To see your currently installed Mesa version.

glxinfo | grep OpenGL

Ubuntu 13.10 ships with Mesa 9.2

Installing OIBAF

Is easy. I’d suggest checking your Mesa version first (see above).

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

You may need to reboot/logout for it to take effect (I forget).

Resources: Phoronix, Launchpad (PPA)

Upgrading Packages (drivers)

With the repository already added (ppa:oibaf/graphics-drivers), it’s just a matter of updating.

sudo apt-get update
sudo apt-get upgrade

Notably, the 2nd line is just upgrade, not dist-upgrade. Both functions do the same thing, but if I understand correctly, upgrade doesn’t uninstall obsolete packages, while dist-upgrade does. So dist-upgrade is the smart one. This means that downgrading to Mesa 9.2 (as I had to do) required a full re-download of Mesa 9.2, as it was already removed from my machine.

Upgrading Major Ubuntu Versions

When April rolls around Mike, do this:

sudo do-release-upgrade

Gotta get away from this awful version of Nautilus. Ugh!

NOTE: Uninstalling OIBAF before doing a release upgrade is recommended!

The Apt Cache

/var/cache/apt/archives/ contains cached copies of packages you’ve downloaded. I lucked out, finding my January 10th version of the OIBAF drivers here, so there may still be some hope to downgrade.

Reference: Here.

To list all installed packages, do:

apt-cache pkgnames

This is an extremely long list that omits version numbers. If you know roughly what the package you want is named, you can include the first part of the name like so:

apt-cache pkgnames blah

Though, this is really only useful if you know what a package is named.

To search the package database for something, use search:

apt-cache search blah

This also includes descriptions of packages, which can be extremely helpful for discovering exactly what package you’re looking for.

Get information about a package:

apt-cache showpkg packagename

Another way, with a slightly different output:

apt-cache show packagename

List just the install options:

apt-cache madison packagename

Yeah, whodathunk. “Madison” ‘eh?

OIBAF Adventures

Long story short, don’t mess with DPKG! I had to reinstall Linux.

* * *

So uh, after much digging, there may not actually be an easy way to install the older packages. OIBAF is a PPA that only has the very latest version. Older versions appear to be discarded.

Start-Date: 2014-01-10  14:42:45
Commandline: aptdaemon role='role-commit-packages' sender=':1.158'
Upgrade: libgl1-mesa-dev:amd64 (10.1~git1401081930.31ec2f~gd~s, 10.1~git1401100730.903688~gd~s), aptdaemon-data:amd64 (1.1.1-0ubuntu3, 1.1.1-0ubuntu4), libegl1-mesa:amd64 (10.1~git1401081930.31ec2f~gd~s, 10.1~git1401100730.903688~gd~s), libopenvg1-mesa:amd64 (10.1~git1401081930.31ec2f~gd~s, 10.1~git1401100730.903688~gd~s), libssl1.0.0:amd64 (1.0.1e-3ubuntu1, 1.0.1e-3ubuntu1.1), libegl1-mesa-drivers:amd64 (10.1~git1401081930.31ec2f~gd~s, 10.1~git1401100730.903688~gd~s), libkms1:amd64 (2.4.50+git1401071830.9fa22a~gd~s, 2.4.51+git1401090630.dc864c~gd~s), libdrm-intel1:amd64 (2.4.50+git1401071830.9fa22a~gd~s, 2.4.51+git1401090630.dc864c~gd~s), libdrm-intel1:i386 (2.4.50+git1401071830.9fa22a~gd~s, 2.4.51+git1401090630.dc864c~gd~s), libdrm-dev:amd64 (2.4.50+git1401071830.9fa22a~gd~s, 2.4.51+git1401090630.dc864c~gd~s), libgl1-mesa-dri:amd64 (10.1~git1401081930.31ec2f~gd~s, 10.1~git1401100730.903688~gd~s), libgl1-mesa-dri:i386 (10.1~git1401081930.31ec2f~gd~s, 10.1~git1401100730.903688~gd~s), libdrm-radeon1:amd64 (2.4.50+git1401071830.9fa22a~gd~s, 2.4.51+git1401090630.dc864c~gd~s), libdrm-radeon1:i386 (2.4.50+git1401071830.9fa22a~gd~s, 2.4.51+git1401090630.dc864c~gd~s), libglapi-mesa:amd64 (10.1~git1401081930.31ec2f~gd~s, 10.1~git1401100730.903688~gd~s), libglapi-mesa:i386 (10.1~git1401081930.31ec2f~gd~s, 10.1~git1401100730.903688~gd~s), gnome-control-center:amd64 (3.6.3-0ubuntu45.1, 3.6.3-0ubuntu45.2), python-aptdaemon.gtk3widgets:amd64 (1.1.1-0ubuntu3, 1.1.1-0ubuntu4), libgnome-control-center1:amd64 (3.6.3-0ubuntu45.1, 3.6.3-0ubuntu45.2), python3-aptdaemon.gtk3widgets:amd64 (1.1.1-0ubuntu3, 1.1.1-0ubuntu4), libgles2-mesa:amd64 (10.1~git1401081930.31ec2f~gd~s, 10.1~git1401100730.903688~gd~s), libgl1-mesa-glx:amd64 (10.1~git1401081930.31ec2f~gd~s, 10.1~git1401100730.903688~gd~s), libgl1-mesa-glx:i386 (10.1~git1401081930.31ec2f~gd~s, 10.1~git1401100730.903688~gd~s), libxatracker1:amd64 (10.1~git1401081930.31ec2f~gd~s, 10.1~git1401100730.903688~gd~s), xserver-xorg-video-intel:amd64 (2.99.907+git1401081930.a2fc9e~gd~s, 2.99.907+git1401101930.b351f4~gd~s), xserver-xorg-video-ati:amd64 (7.2.0+git1401071930.bcc454~gd~s, 7.2.0+git1401090730.3213df~gd~s), python3-aptdaemon.pkcompat:amd64 (1.1.1-0ubuntu3, 1.1.1-0ubuntu4), libdrm-nouveau2:amd64 (2.4.50+git1401071830.9fa22a~gd~s, 2.4.51+git1401090630.dc864c~gd~s), libdrm-nouveau2:i386 (2.4.50+git1401071830.9fa22a~gd~s, 2.4.51+git1401090630.dc864c~gd~s), python-aptdaemon:amd64 (1.1.1-0ubuntu3, 1.1.1-0ubuntu4), aptdaemon:amd64 (1.1.1-0ubuntu3, 1.1.1-0ubuntu4), libgbm1:amd64 (10.1~git1401081930.31ec2f~gd~s, 10.1~git1401100730.903688~gd~s), python3-aptdaemon:amd64 (1.1.1-0ubuntu3, 1.1.1-0ubuntu4), xserver-xorg-video-radeon:amd64 (7.2.0+git1401071930.bcc454~gd~s, 7.2.0+git1401090730.3213df~gd~s), mesa-common-dev:amd64 (10.1~git1401081930.31ec2f~gd~s, 10.1~git1401100730.903688~gd~s), openssl:amd64 (1.0.1e-3ubuntu1, 1.0.1e-3ubuntu1.1), libdrm2:amd64 (2.4.50+git1401071830.9fa22a~gd~s, 2.4.51+git1401090630.dc864c~gd~s), libdrm2:i386 (2.4.50+git1401071830.9fa22a~gd~s, 2.4.51+git1401090630.dc864c~gd~s), gnome-control-center-data:amd64 (3.6.3-0ubuntu45.1, 3.6.3-0ubuntu45.2)
End-Date: 2014-01-10  14:43:28

* * *

Ah ha! Okay, so I figured out a (nasty) way.

I was able to get this working because all of the many copies of the OIBAF Mesa drivers have dates in their filenames. So I listed all the files in the archive folder, and grepped the results for all that matched that date. I copied those to a new folder (because from what I’ve read the cache or the log may only stick around for a month).

cd /var/cache/apt/archives/
mkdir ~/gfxdriver
cp -t ~/gfxdriver/ `ls | grep 140110`

This wasn’t enough though. As it turns out, the Intel ‘libdrm’ files were from January 9th, and not January 10th.

cp -t ~/gfxdriver/ `ls | grep 140109`

Then I explicitly installed these packages using dpkg.

cd ~/gfxdriver
sudo dpkg -i *deb

And that did it. *phew*

EDIT: WHOOPS! Nope! Long story short, after a reboot this ruined everything. I was able to fix it, but thereafter I had no hardware acceleration.

* * *

This post is long enough.