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.

Reminders

Things I ocassionally need a refresher on.

More Notes:

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.

linrunner.de is the home of TLP, a very useful utility for getting laptop Power Management under control.

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.

Source Control

Mercurial GUI:

SVN and GIT (and Mercurial) GUI:

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.

SDL2

Prerequisites stolen from here.

Get the latest code, build, and 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:

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

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:

Now you’ll be free to change files.

CPU and Network Usage Mini Graphs

Restart X (or reboot).

Setting up Windows 7 VM

Download the 64bit Linux ‘Bundle’ file.

Instructions borrowed from here.

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.

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

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.

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

Execute:

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).

Calculator

Install SpeedCrunch.

gDEBugger

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.

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.

Then to run:

Restart Audio

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

Source.

Silence gedit warnings

Install Android SDK

Easy. First install Java and 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.

Done.

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.

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 PVRGeoPODScript.py and libPVRGeoPod.so to your /opt/blender/2.69/scripts/addons folder.

Copy libQtCore.so.4 and libQtGui.so.4 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.

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/default.pa“.

Find the following line:

https://wiki.archlinux.org/index.php/PulseAudio#Glitches.2C_skips_or_crackling

Change it to:

Restart audio.

Sources: Audacity Forum, Pulse Audio Wiki.

Setting up the 3DConnexion Space Navigator 3D Mouse

Get the open source driver.

Build and install the Daemon.

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

Build and install the config tool.

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).

Source.

Making Backspace work as a back button in Nautilus

Open ~/.config/nautilus/accels

Add a line (without a “;”)

Restart Nautilus.

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.

Add the following to the file.

Source.

GDB: ptrace operation not permitted

Fix is here.

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

Adding the following line:

Re-enable whitelisting in the SysTray

From here.

Restart Unity (Logout, then log back in).

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

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:

To disconnect:

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.

Then use it to purge the data.

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.

Ubuntu 13.10 ships with Mesa 9.2

Installing OIBAF

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

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.

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:

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:

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:

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

To search the package database for something, use search:

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:

Another way, with a slightly different output:

List just the install options:

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.

* * *

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).

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

Then I explicitly installed these packages using dpkg.

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.