Enabling Bumblebee on an XMG P304

Note that this article is more accurate & useful. Read that instead.

Optimus uses the integrated graphics controller to render to a surface when the discrete graphics card is not in operation. When discrete graphics is in operation, it renders to the surface hosted by integrated graphics.

There’s a good and detailed explanation of this here.

To find the integrated graphics on the PCI bus:

To find the discrete graphics on the PCI bus:

This is needed for the next step.

Install Bumblebee

Note that when the bumblebee installer runs, it only finds the discrete graphics card, not the VGA integrated graphics:

Update & upgrade afterwards.

Install a recent Proprietary Nvidia Driver

Tell Bumblebee where the integrated graphics is

As mentioned above, Bumblebee needs to know where the integrated VGA card is as well as the discrete 3D card.

Distressingly, it needs to know this information in the correct order. VGA must be specified first, then 3D:

After a reboot, you should be able to use optirun to run using discrete graphics. You’ll know it’s running discrete graphics because it’ll run at crazy fps, and the fan will sound like a vacuum cleaner!

To try out your new blitzbox, you can try this:

This should produce something like:

You could then turn on the graphics card to run this test again on faster hardware by doing:

On my box, glmark2 is actually showing a lower performance for the Nvidia card:

I probably need a more up to date driver, but at least the correct hardware is in use!

The above was wrong because the GPU bridge wasn’t in operation

Install the VirtualGL bridge.

Enable vsync

Some tearing while using the intel graphics can be fixed using information from this page: https://wiki.archlinux.org/index.php/Intel_graphics#Tear-free_video.

Setting up Linux Mint on an XMG P304

As mentioned, last week, I got a new toy.

Yesterday evening, it’s replacement Samsung EVO 840 mSATA SSD arrived. Since I’d already added a Crucial M550 SATA SSD, and installed Windows 8.1 on it, the Samsung mSATA SSD would get Linux Mint – probably the easiest to use Linux distro.

Getting started

I first (uncharacteristically of me) have a complaint about Mint’s installer. The default installation of Mint 17.1 (Rebecca) takes an entire disk, and allows you to encrypt it without much hassle. Great, you might say, and it is! Except that there is no way to specify which disk. When you’ve just spent a few hours installing Windows 8 & updates, then upgrading to 8.1 & updates… you don’t want to accidentally overwrite that junk.

In Mint’s defence, there is a dialog that pops up later that tells you exactly which disk is going to get nuked, but you have to make a leap of faith before seeing that by clicking the “Install Now” button.

I’ll post a feature request to Linux Mint’s community about this. I think they’re aware that the installer sometimes doesn’t give enough information for a user to tell exactly what it’s going to do.

Paranoid workaround

Because I’ve buggered up enough systems in my time, resulting in a certain paranoia about future buggeration, I physically removed the Crucial M550 SSD, then ran the Mint installation on the Samsung SSD, and re-added the Crucial drive.

So far so good.

Basic setup

I have a bunch of encrypted data stored on Dropbox. Usually, I get that first before proceeding with further installation steps. This time was no different:

This got me:

  • gparted (even though this is available on the Linux Mint live image, it does not get installed on the machine)
  • Dropbox UI client for Nemo
  • KeePassx, a password manager
  • Clam Antivirus & UI
  • A Graphical frontend for a firewall, and the firewall to go with it
  • A bunch of updates not provided by the GUI updater because it typically runs apt-get upgrade, not apt-get dist-upgrade
  • A gpg package for Python – Dropbox is implemented in Python, and needs this to validate its daemon which the UI client downloads

I launched the Dropbox UI from Mint’s menu and logged in, which prompted Dropbox to download the daemon & begin syncing.

While this was happening, I carried on with other steps.

A note on physics

Despite SSD algorithms and hardware improving, the fact remains that in order to write data to a region of SSD storage, the storage must first be discharged by being flashed by high frequency light. I think these days “high frequency” means ~UV frequencies. Certainly high enough to make E=hf generate a high value of E. Anyone who’s familiar with quantum physics will know that photons that are absorbed by a molecule’s electrons cause the electrons to move to a higher energy state. In the case of flash memory, the intention here is to allow the charge to leak away, resetting the memory for fresh charge configurations. However, having energetic electrons banging around in your molecular structure is not good for said structure. Flashing memory slowly causes the memory to deteriorate.

In short, SSD writes bad; SSD reads good.

Decreasing Swappiness

To reduce SSD writes because of swapping memory pages, the swappiness tendency can be reduced:

 Other signing in and setting up

I signed into Firefox sync and set up my Thunderbird mail client.

I used this note to figure out where Thunderbird put my profile information. I do this rarely enough that I never remember this. Turns out in this case, it was in

I copied my standard msFilterRules.dat  from Dropbox to my profile folder, to get all my message filters, then restarted Thunderbird.

I noticed that my folders could do with a clean out, so I looked for a solution. This came very quickly with wangvisual‘s Awesome Auto Archive plugin. I think it’s as awesome as it’s name suggests. This buzzed through my mail folders, deleting, archiving & generally cleaning up the junk that had accumulated there. Nice!


Even though this isn’t getting security patches any more, it’s the only encryption solution getting a full 3rd party public security review. Also, I have a bunch of stuff encrypted with it that I’d like access to. For this reason, I have a copy of the binary and it’s associated keys in storage.

The binary had downloaded from Dropbox by this time, so I verified the signature:

That checked out ok, so I installed Truecrypt, and opened my 509 certificate, and installed it to Thunderbird.

Additional messing around

As mentioned, I’ve broken a lot of systems. I wanted to back up what I had at this point, and I also found a USB drive with a broken file system ;).

 Further SSD optimization

Typically, every time a file is read, it’s access time is written. Writing to an SSD should be minimized. For this reason, this guide suggests turning off the access time writing behaviour.

 Trim the SSD

Trim the SSD at every login.

And turn the weekly trimming off, since it’s happening at every login.

Limit the write access of Firefox:

Firefox menu button>Preferences>Advanced Tab Network section “Cached Web Content”: tick Override automatic cache management and set the cache to 0 MB.

Install Thunderbird beta

There’s been a lot of development since Thunderbird 31, which, at the time of writing (22-08-2015) is still the version packaged with Trusty , and I don’t want to wait for it.

I first added the Thunderbird Next PPA using “Software Sources”. It’s ppa:mozillateam/thunderbird-next .

This gets me to v40.


If I have any complaints about my laptop, it’s the audio, or rather, it’s other people’s complaints about the audio. It is a little tinny.

This adds an equalizer, allowing me to take the edge off the tin.


This music manager is perfect for automatically (or manually) editing your music metadata.

Set Up Optimus

This is the subject of my next post.

New Toy


Last week I received a new laptop. I purchased a pretty tricked out custom-built P304 from these charming people, or these people, for those who like their sites in English.

There was a problem with the SSD; I seem to have fallen afoul of the bathtub curve, and after installing half an OS, it failed, and would no longer announce its existence to the motherboard.

Bad luck

I spoke to the guys at Schenker, who were friendly and knowledgeable, and generally behaved like competent human beings who didn’t spend their days getting bombarded with basic questions – a fate that seems to befall a lot of poor front line tech support people.

So, given verbal & email assurances that opening the back of my machine wouldn’t invalidate my warranty, I moved the SSD, tried various power cycle combinations that hinted more at desperation-driven voodoo than diagnostic driven behaviour. Once I’d described this to the Schenker folks, they were quite happy to send out a new SSD.

In the meantime, I put another SSD in this machine, and it is a thing of beauty.

Lovely organisation

I can’t recommend Schenker (or XMG, as their gaming PC branding has it) enough. They provided me with an efficient and competent service at a competitive rate, and the end product, based on a Clevo W230SS, is a gaming laptop that weighs 2kg and has a battery life of ~5 hours.

I ended up installing Windows 8.1 on the SSD I put in. Once the mSATA SSD from Schenker shows up, I’ll put a Linux distro on that.


When I installed Windows (from a W8 DVD), I accidentally used the legacy BIOS setting and not UEFI. To avoid tediously reinstalling, re-updating and re-upgrading to Windows 8.1, I used this excellent guide to rewrite the MBR boot partition into a GPT partition.

I also switched the clock time format so as not to conflict with *nix runs using information from this page.

If I had any gripe, it would be that the only explicit driver support is for Windows. Recent Debian-based distros, like Linux Mint 17.1 seem right at home on this box, because the hardware is all pretty standard.

The P304 comes with an Nvidia GTX 860 as well as onboard Intel graphics. I haven’t yet got over the Bumblebee hurdle to get the graphics card recognized by the Linux OS.

I’ll post again when I figure that out.