My experiences with XEN VGA passthrough

The following post gets quite technical, and employs a bit of jargon. You can read the whole anecdote if you want, or just scroll down to the bottom if you want some advice related to Linux Mint Debian Edition, XEN and VGA Passthrough.

I recently built myself a new computer, and after jumping through many hoops (involving Intel’s Haswell Refresh I believe – seems trying a “Devil’s Canyon” processor with an 8-series chipset isn’t a good idea – D’oh #1!), I got a machine up and running with Linux Mint Debian Edition 64-bit. There is an nVidia card in one PCIe slot, an AMD card in another PCIe slot, and an integrated GPU on my Core i7 that is disabled in the BIOS. Once I had this all set up, I thought it would be child’s play (well, not really, but quite simple) to follow this tutorial and get Windows Vista up and running, and using my AMD card, while leaving the nVidia card for Mint.

Boy, was I wrong! At first everything seemed to be going smoothly, but I had a niggling feeling that it was going too well – this was, after all, a tutorial for normal Mint, not the Debian Edition. My first stumbling block came at step 17, which didn’t give the output hoped for. However, I assumed that this was because I skipped steps 9 and 10, opting for Synergy instead. I forged on, and ended up unable to pass through any devices to the VM – D’oh #2!

At this point, I had Vista up and running, able to control it via VNC, but with no VGA passthrough. Therefore, I backtracked, and I’m not sure what I did, but I ended up with a “no such file or directory” error upon attempting to start the VM, with the unhelpful question “Is xend running?”. Seemingly I could no longer use the XM toolstack for whatever reason. Therefore, I switched to XL with the command:

sudo sed -i 's/TOOLSTACK=.*\+/TOOLSTACK="xl"/' /etc/default/xen

Of course, now problems with QEMU versions started to rear their ugly heads. XEN couldn’t find the right QEMU binaries anymore, and following the instructions wasn’t enough, because I was on Debian rather than Ubuntu. My suspicions were correct after all! I was eventually able to start the VM with the following config file:

firmware_override = '/usr/lib/xen-default/boot/hvmloader'
memory = 8192
name = 'vista'
vif = [ 'mac=00:16:3e:68:e1:01,bridge=xenbr0' ]
disk = [ 'phy:/dev/mapper/guest-vista,hda,w' , 'file:/home/mgkeyes/Vista.iso,hdc:cdrom,r' ]
#device_model = '/usr/lib/xen-default/bin/qemu-dm'
device_model_version = 'qemu-xen'
device_model_override = '/usr/bin/qemu-system-x86_64'
#pci=[ '02:00.0', '02:00.1' ]
pci=[ '02:00.1' ]

Now, you may notice that I’ve commented out the line passing through both the GPU and its sound chip, in favour of one passing through only the sound chip. This is because the sound chip is passed through successfully, and detected by Windows. The GPU, on the other hand, causes the VM to not boot, with the only way to shut it down being:

sudo xl destroy vista

Unfortunate, especially after I had spent so much time trying to get the Radeon driver blacklisted so the card was even available for passthrough.

I was puzzled. Surely my card should pass through fine. After all, all Radeon HD 7000 are supported, and I had bought a card from that series, albeit a low-end one. Or so I thought. What I had bought was a “Radeon R7 250″, which I misinterpreted as “Radeon 7250″. Turns out it’s part of a new series of cards altogether – D’oh #3! It is with considerable shame that I divulge this.

=====The rest of this isn’t really related to VGA passthrough, but it is interesting, and somewhat related to XEN. You can still scroll down to the bottom to see my lessons.=====

So, having cursed my inability to properly research components for my new build, I decided to wait until, some time down the line, support for these cards is properly programmed. (But in the meantime, I wonder how I will play Rayman Legends…) Having given up on the VM’s graphics, I had a look at the host’s. The “nouveau” open-source drivers were being used, which caused the Cinnamon desktop environment to run in software mode, and when I tried to install and run Steam, it didn’t even start for me. Therefore, I decided to give the proprietary nVidia drivers a try. After all, they had worked well on my old system, with the same card (a GeForce GTX 550Ti by the way).

Bad idea. Cinnamon, instead of running in software mode, crashed upon login, leaving me in “Fallback Mode”, which was very unpleasant. To make matters worse, Firefox also crashed any time it was even slightly over-taxed, making even regular browsing quite a frustrating experience. Also the screen went irrecoverably blank any time I tried to exit to command-line to install an updated version of the driver (obtained from nVidia’s site). Defeated, I returned to the nouveau driver, an action which itself involved jumping through a few hoops.

On the up-side, it turned out that I could get proper OpenGL rendering by installing the libgl1-mesa-dri-experimental package. This got Cinnamon out of software mode, allowed me to run Steam, and even play through Portal! Afterwards, I tried a few other things, like playing recordings in MythTV, but ended up coming across this little kernel bug, which affects the version still being shipped with this distro (3.11). Still, I was happy, and was looking forward to seeing what would happen with Portal 2.

What I saw was really ugly, and unfortunately the system became too unresponsive to take a screenshot. nouveau decided to spam all ttys (accessible by Ctrl+Alt+F(1-6)) with error messages, making it basically impossible to even try to kill the game from the command line. After a hard reboot, I thought it might be the same kernel bug again, so I disabled the option “Wait for Vertical Sync” in the advanced video settings. It seems I was on to something, because this time the game didn’t go ugly, but it did freeze with three dots left in the loading progress bar for the first map.

Having already found that exiting to command line no longer turned the screen blank, I decided to have another shot at installing the updated driver from nVidia’s website. It installed successfully, but a reboot produced – you guessed it – a blank screen! D’oh #4!

At this point I realised that I was still booting into the XEN hypervisor, which wasn’t much good to me when VGA passthrough wasn’t working. Therefore, I decided to try the normal kernel, and what did I get? Cinnamon running perfectly and Portal 2 playable! I do have a few visual glitches in normal apps, but I can overlook them (for now).

Now, I publish this in the hope that others can benefit from my experience, so I’ll try to boil it down to a few little lessons that I have learned, and that I hope others may be able to take away from this:

  • DO YOUR RESEARCH! If you see something like “Devil’s Canyon” on a processor, be sure you know exactly what it means. Don’t assume that “R7 250″ means the same thing as “Radeon 7250″. This is probably obvious to most, but I failed to do it, and, as mentioned, I am ashamed of that.
  • Try not to assume that tutorials for normal Mint work with the Debian Edition.
  • device_model_version = 'qemu-xen'
    device_model_override = '/usr/bin/qemu-system-x86_64

    seems to work on Linux Mint Debian Edition with the correct QEMU packages installed. These packages include qemu and qemu-system.

  • AMD R7 250 cards DO NOT WORK with VGA passthrough at this time, and it’s probable that other members of the Rx 200 series don’t either.
  • Proprietary nVidia drivers don’t work well with the version of the Linux kernel used in the XEN hypervisor (at least in Debian, or it might just be a Linux Mint Debian Edition thing).

I hope this has been in some way helpful, or at least amusing! Suggestions for improvement or clarification are more than welcome.

Happy 85th Anniversary to the Warners!

Well, I posted back in September to celebrate the twentieth anniversary of the initial airing of Animaniacs season 1 episode 1, so I might as well also celebrate the anniversary of the 65th and last episode of that season!

Because of a “newly discovered” cartoon of the Warners revealed late in the first season, the date that their red noses were first somehow printed onto black and white film was found to be 1929, rather than 1930, so the season was terminated in 1994 with an in-universe 65th Anniversary celebration. That makes today their 85th anniversary!

So, Happy (in-universe) 85th Anniversary to Yakko, Wakko and Dot!!!

Happy Anniversary!

I can hardly believe it! This blog has now been in existence for an entire year! This is also the third anniversary of the release of Portal 2 (at least in this time zone), another fact which some of you may find scarcely credible.

What a year it’s been. Proof finally emerged that the US government was spying on everyone and, well… Rather little has been done about it! Oh well… We also observed the anniversaries of two great television programmes, Animaniacs and Frasier.

In terms of activity on this blog and the building in which it is hosted, the Subatomic Particle Simulator was conceptualised, developed and published in the course of the last year. Also, YouTube saw the upload of three animated histories of Sony Pictures Television (with a fourth coming in the next few days).

All in all, I’m quite satisfied with what has graced this blog in the preceding twelve months, and I hope that the next twelve will be just as fruitful!

P.S. Once again, I was considering naming this post “Happy Explosion Day!”, but even one year on, I couldn’t be sure whether or not that would be PC, so I’m erring on the side of caution.

On the subject of Portal 2, to clarify the issue from yesterday’s post, it seems that the GNU/Linux beta has been around for two months. Once again, I apologise profusely for not observing this earlier on. However, work on Sony Pictures Television History Mark IV has taken precedence anyway, so Aperture Ireland’s state probably wouldn’t be any different even if I had been aware.

Status of Aperture Ireland 2.0 and other things

I was just browsing through the archives of this blog and saw a post mentioning Aperture Ireland. I realised I’d never actually checked whether or not Valve had gone about porting Portal 2 to GNU/Linux. I fired up Steam and it seems that this port recently entered beta.

Had I known this earlier, Aperture Ireland 2.0 would probably be underway right now. However, at this late date, it seems unlikely that I will be able to release on this side of June, since I will be otherwise engaged for much of next week. I apologise for what may seem to have been an avoidable delay.

On the plus side, Sony Pictures Television History Mark IV is almost done. I am half-way through documenting 2011 and the animation work should be all done by Easter Sunday. After that, putting it all together should be simple enough, so expect it to appear on Tuesday!

Some observations about the proposed Comcast-TWC merger

First of all, allow me to apologise for the recent week-and-a-half of downtime. Storm Darwin took out my phone line. Seemingly, while my connectivity with the outside world was a lot more tenuous than what I’m used to, Comcast announced that it wanted to merge with Time Warner Cable. It’s not my prerogative to complain. I don’t live in America and am not particularly affected by its telecoms market, though I was startled to learn that I have faster broadband than 66% of America (I do now, that is :-P ). Besides, the last week has seen more than enough complaints about this thing on various sites. All I wish to do is share a few humorous/ironic observations of my own, which I have been formulating during this extensive downtime.

The torch of “The Octopus” has finally been passed

It’s no secret that Comcast owns Universal Studios. Even when their shareholding was only a controlling 51% stake, the 2012 Universal logo announced to the world for the first time that it was “A COMCAST COMPANY”.

The 2012 Universal logo

In the olden days, Universal was owned by the MCA conglomerate, which I discussed last June in my “Sausage Factories” post. Before MCA owned Universal, it was the largest talent agency in the United States of America. With its shady dealings and relentless buying-up of other agencies, it earned the title of “The Octopus”. The agency was dissolved when the company took control of Universal, because of antitrust concerns, among other things.

However, MCA and Universal became more and more closely associated over the years, with the Universal name eventually replacing “MCA” altogether at the hands of Edgar Bronfman Junior. Now, it can be said that Comcast owns what is left of the original MCA, and it is now seemingly vying for the title of “The Octopus” of cable operators, rather than “The Octopus” of talent agencies.

A combination of the current Comcast logo and an old MCA-TV "bug"


One less confusing brand-name on the market

Well, whatever about the implications for competition of this particular deal, I’m glad someone is getting rid of the Time Warner Cable name. From the information available, one would be forgiven for thinking that two of the “Big Three” music companies were about to merge. We have Universal Music, which looks like it is owned by the same company as Universal Studios. We also have Warner Music, which looks like it is owned by the same company as Warner Bros., which is Time Warner. Time Warner Cable also looks like it is owned by the same company.

None of this is true, however. Both Warner Music and Universal Music separated from their respective film studios a decade ago. Time Warner Cable separated from Time Warner half a decade ago. Unfortunately, trademarks are licensed. They all get to keep using each other’s names, under the terms of some obscure agreements. One needs look no further than the comments on this Techdirt post about the lawsuit against Warner/Chappell Music over “Happy Birthday” to see the confusion caused by this.

Therefore, I sincerely hope that Comcast will not renew their trademark licence once the deal comes through, so that this nonsense can finally start coming to an end.

The NBC Peacock finally gets an eye?

Peacocks have fake eyes in their plumage. The well-known NBC Peacock, however, seems to be an exception.

Peacock Closeup vs. NBC 2014 Indent Style

What about Time Warner Cable though? That weird Celtic-esque graphic that it uses as a logo surely qualifies as an eye:

The logo of Time Warner Cable

An eye or what?

What if Comcast got rid of the Time Warner brand, but kept the logo in some way? Would the NBC Peacock finally get something resembling an eye?

Time Warner Cable and Comcast logo fusion

Perhaps needs a bit more polish...

So anyway, that’s my two cent on this Comcast-TWC thing!

Why we shouldn’t use “Splenda”

Lately, I’ve been seeing this ad for Splenda, showing various “want versus should” situations, before claiming that the sucralose-based sweetener satisfies both. The ad is about health. For years, sucralose has been marketed as a healthy alternative to sugar, which is made from sugar and is just as sweet (in fact it’s much sweeter), but has negligible calorific value. Therefore, it doesn’t lead to weight gain or diabetes or anything like that. However, to me, it seems that sucralose may indeed be a “want”, as a supposedly healthy alternative to sugar, but by no means a “should”.

Unlike in the case of aspartame, this is not an issue of health. This is a moral/ecological issue. Let me start by explaining the way in which sucralose works. As widely advertised, it is “made from sugar”. The initial substance is sucrose, or normal sugar. This is called a disaccharide, because it is two sugar units stuck together. In the small intestine, it is split up into glucose and fructose, which can then be absorbed into the blood and used to make energy. Creating sucralose involves subtly changing the chemical structure so that this can’t happen.

Sucrose molecule Sucralose molecule
Spot the difference!

As you can see, three of the hydroxyl groups (OH groups) in the structure are replaced by chlorine atoms. The result is a molecule that seems similar (hence we taste it as sweet) but is actually quite different (hence our bodies can’t break it down to release energy). Since only tiny amounts of this substance can be actually used by our bodies, the rest is excreted and ends up, dare I say it, in the sewage system. Of course, from there, it ends up in rivers and seas, where it is no good as a food source for micro-organisms or anything. But that’s grand, right?

WRONG! The original sucrose that was used to make the sucralose was obtained from plant material. The plant had photosynthesised, taking in sunlight and using its energy to combine carbon dioxide and water into carbohydrate. The natural order of things would have this used, either by the plant or an animal, to produce energy, releasing the carbon dioxide and water back into their respective cycles. Instead, we end up with carbon, hydrogen and oxygen dumped uselessly in some body of water, where they may never be returned to their proper places. Carbon is a fundamental element of life, required to build most plant matter and also very important in animal biochemistry. Is it really right for us to squander it like this?

Granted, lots of plant matter from millions of years ago was turned into useless coal and oil, but that was perfectly natural. In a world where resources are increasingly strained, can we really afford to waste them this way? I think this is a real moral issue, and something that is often overlooked by people who talk about sucralose and artificial sweeteners in general.

Subatomic Particle Simulator now on GitHub!

Well, I have just spent an entire weekend using Windows, amounting to probably more hours than I had spent with this operating system in the previous six months! Of course, this meant that I had to endure loads of automatic updates, their drain on bandwidth and automatic restarts! It was worth it though to get the Subatomic Particle Simulator up, working just as well as it does on GNU/Linux! It’s nice to know that I’ve made this thing cross-platform.

More good news: In the process of porting the code, I realised that the best thing to do was to fork the Source SDK repository on GitHub, and that way avoid all the problems of contaminating a working copy to compile the simulator. It is here, so you can now clone it in a ready-to-compile state, or even download a ZIP file if you would prefer.

Again, same legal restrictions apply – due to incompatible licences, it is not currently possible to (legally) distribute binaries. Once again, I apologise for this, and hope I can sort it out in the future.

PS. If you would like to express your opinions on how legal restrictions like this should apply in the future, please go to this new campaign website.

Release of Source Code of Subatomic Particle Visualiser

Well, this is kind of embarrassing. In October, I implemented the GNU Scientific Library as part of the science project I mentioned in the previous post. Since I was working towards an actual deadline, I guess I was too hurried to thoroughly check what licence the GSL uses. Apparently, I assumed it was licensed under the LGPL, which many GNU libraries tend to be. However, it is actually under the much more restrictive GPL, which forbids me from distributing it combined with any proprietary programme. The code given by the Source SDK for the server DLL (the only thing I actually modified) counts as proprietary, since it is distributed under a licence that forbids selling. Therefore, while experimenting with the two pieces of software together is fine, if I were to distribute my compiled server library, I would be in breach of the GPL.

Therefore, the long and the short of it is that my only option is to distribute my code and the GNU Scientific Library on their own, and let you, the user, actually compile it. To that end, here is an archive containing my code plus the GSL code, in a directory structure that will let it fit right into a fresh download of the Source SDK, plus instructions for getting it up and running:
It is currently designed to compile only on GNU/Linux. A Windows version will be made in the coming days.

Here is a game directory to put in your SteamApps/SourceMods folder:
Once you put it there, don’t forget that you need to add in a bin folder, with the libraries compiled from the source code. They can be found in “sp/game/mod_episodic/bin” and “sp/game/vigov_simulator/bin”, under the Source SDK directory structure.

I apologise for not being able to release a compiled game. In order to do so, I would need to either pick a different game engine or a different mathematical library (or write the code myself…). I may do one of those in the future.

My return to the blogosphere

The time has come for me to return to this blog and explain my absence for the last few months. I was spending a lot of time working on a project for a prestigious science and technology exhibition. As such, between that and school work, I had basically no time to blog, or upload anything more than trivial logo videos to my YouTube channel.
Well, the project is now “finished”, and a selection of the fruits of my labour has been uploaded to YouTube.

The files for this game/tool will be uploaded to this site in a few days’ time, when I have had a chance to sort through them.

Here are some of the things I could have mentioned had I been actively blogging:

  • The change in Saorview frequencies, and how it left everyone with eight extra dud channels in their EPG.
  • The introduction of RTÉ One HD, and the stretching of classic programmes that came therewith.
  • The court cases involving the NSA.
  • Halloween
  • Christmas
  • The New Year

So what’s on the cards now? Well, apart from school, there’s:

  • Sony Pictures Television History Mark IV – I know, when does it stop, right? Well, significant info has been discovered since Mark III was made. Hopefully I can reuse lots of animation from previous videos – the thought of starting from scratch really doesn’t appeal to me!
  • Updates to the spreadsheet-based corporate timelines published on this site.
  • That new Aperture Ireland release I promised but never delivered. Speaking of which, I wonder if Valve will ever get around to porting Portal 2 to GNU/Linux…

US avoids default – is this really a good thing?

Well, the US government is finally back up and running, and the debt ceiling was raised in the nick of time to prevent the first US default in 152 years (sorry, couldn’t resist pointing out that mathematical curiosity!). Such a default would reportedly have had disastrous consequences for the entire world economy, negatively affecting every citizen on the planet.

Is this really true though? The US debt ceiling was already a whopping $16,700,000,000,000 and is now apparently even higher! With all the talk of “disastrous consequences” of the default, all I could think was that, yes, there would be disastrous consequences, but no, not for ordinary people. There would be disastrous consequences for the banksters, but everybody else would benefit hugely. The centuries-old smokescreen set up by the Bank of England, and amplified in the last century by the Fed, would finally collapse as the dollar went down the tubes.

When something catastrophic like that happens in a system like the one set up by the central banks, I can’t see any other outcome than that system’s exposure as the fraud-driven, intrinsically corrupt juggernaut that it really is. After the initial fallout, people would realise that we don’t need fractional reserve lending, that we don’t need a debt-based monetary system, and that there are much better alternatives out there (Bitcoin, for example). The world’s other problems and injustices could then finally be properly tackled.

But who am I kidding. We always knew that the corporate puppet-masters and misinformed public across the pond just weren’t going to let that happen! Ah well, looks like it’s back to the same old dollar-driven routine, for the next few months anyway.