Enable pci passthrough for QEMU/KVM

I have a couple older HP ProLiant DL360 Gen 6 and Gen 7 Server I want to use as virtual machine hosts with some PCIe devices mapped through to the guests running there, let’s say so they can directly access the Fibre Channel ports on the host or whatnot. Here’s how to do it (running Ubuntu 14.04 LTS that is, YMMV with other distributions):

  1. Edit your /etc/default/grub and add the intel_iommu=on boot option, it should look something like this (serial console for ILO enabled as well)
  2. Add the vfio module to the list in /etc/modules
  3. Create a file like /etc/modprobe.d/vfio.conf setting the allow_unsafe_interrupts option for the vfio module.

    Otherwise you’ll get an error when trying to start a VM with a PCI device passed through: “failed to set iommu for container: Operation not permitted”
    Apparently the IOMMU interrupt remapping is kinda broken on this platform.
  4. Reboot your server and create a VM with one of your PCIe adapters passed through – it should show up just like if was a native device on a real, physical server.

Husqvarna chain-brake fix

Can’t get the cover on your Husqvarna chainsaw back on after working on your chain? Chances are you forgot to disengage the chain brake before removing the cover (it probably didn’t come off quite that easy, remember?) and now you’re stuck with a chainsaw you can’t reassemble without getting the chain stuck…

There are quite a few videos on YouTube with different methods on how to fix this, but most of them aren’t exactly easy or risk-free (it’s a quite strong coil with a lot of energy stored) and take way longer than they need to. Apparently Husqvarna even has a dedicated tool to do this… Well, here’s an easy 5-10 second fix that worked just fine for me on a Husky 135, once I figured out what the problem was:

  1. With the cover, blade and chain removed – move the brake handle forward into the “engaged” position.
  2. Put the cover in place and wiggle it (and the brake handle) a bit so the star-like metal piece slips into place, aligned with the notches on the brake handle.
  3. With everything aligned, pull the handle carefully back to disengage the brake, using the handle as a lever exactly the way you’d normally use it when working with your chainsaw. You’ll hear it click in place.
  4. Remove the cover again, attach the bar and put on the chain. Put the cover back on the way it’s supposed to work: without much resistance at all.

No disassembly of the brake required and certainly no special tool, only takes a couple seconds. Possibly even works without removing the bar and chain, though I haven’t tried it that way.

XMPP notifications for check_mk

Want to have your check_mk notifiy you via XMPP / Jabber if something goes boom? Here’s a little Python notification script which does just that…

You’ll need sleekxmpp installed, either via pip install sleekxmpp  or apt-get install python3-sleekxmpp  if you’re running Ubuntu.

Next, just add the script to check_mk by placing it here: […]/share/check_mk/notifications/xmpp

Now call the script with the destination ([email protected]) you want notified as custom parameter from within check_mk and give it a try by triggering some alert.

(Originally from here, but last time I checked indentation was broken and the site mostly down)

Event Console not showing up in check_mk

After spending the last couple hours trying to figure out why the event console wasn’t showing up in my manually upgraded OMD/check_mk install (that is OMD 1.2 w/ check_mk 1.2.4p5 upgraded to 1.2.6b10) even though mkeventd is running – here’s what you got to do: manually copy the files from your check_mk source directory into the install director. The setup script does everything else for your, except that.

That’s it. WATO should now show the event console again and things like rule based notification will also work.

Eating with (really bad) aphthous ulcers

Aphthous stomatitis or mouth ulcers (aka canker sores) can be be a real pain in the ass, well, mouth – those 5-20% of people occasionally suffering from it know what I’m talking about. Especially if one happens to be at a spot your teeth rub against, or as it is currently the case for me, if a bunch of ’em cover pretty much your whole throat making swallowing food quite uncomfortable or downright painful.

Here’s a little gem that took me decades to figure out, even though it really is quite simple if you think about it: Instead of eating regular food, just switch to drinking your nutritional basics for a couple days. Bodybuilder and professional athletes have been doing it for decades to increase their daily intake and it works just fine for them. Lately, there’s even Soylent marketed to regular folks, but it’s basically not much different from so called meal replacement shakes that have been around since the last century.

Even though I currently can’t even eat cereal or soaked and soft muesli (granola for you american folks) without pain, let alone anything even mildly spicy or somehow granular grainy, downing a big jug of my own soylent-like mixture was no issue at all.

If you’re not really into the whole nutritional science, just go and order yourself some Soylent – it’s basically the one-size-fits-most of meal replacements. If you don’t live in the US or can’t be bothered to wait for a shipment (as probably you found this article because your throat/mouth/whatever hurts right now), go to your nearest supplier for bodybuilder or sports shop and get yourself meal replacement shakes and a shaker. Preferably a couple flavors, since you’ll be eating/drinking pretty much nothing else once you notice the distinctive lack of pain. And if they don’t have any pre-mixed meal replacement powders, just get some protein powder and something like (really finely ground) oatmeal or another form of carbs, like Maltodextrin. Put some water and/or milk in your shaker, add the right amount of powder, mix it up and your meal is ready.

Even if it’s unfamiliar and odd at first, you can live of that just fine – you’ll feel full and if you add some multivitamins, you’re body should have everything it needs to sustain you for another half a day or so, until the next shake. Hell, for some people out there it will probably be a better diet than they’re currently having.

Once your ulcers are gone, just switch back to your normal eating habits. Or stay with Soylent if you decide to actually enjoy it.

Maybe this will help some currently miserable folks out there – it sure did for me. You can thank me in the comments…

Cloudflare Universal SSL and WordPress

Cloudflare just rolled out their Universal SSL enabling pretty much any site to use SSL without any associated costs – which is pretty awesome…

But when using it on one of my test-sites, it turned out the site looks pretty much broken. Apparently WordPress doesn’t yet use protocol relative URLs, so CSS, JS etc. may still have a http:// prefix, causing some browsers not to load that content over an insecure channel. Furthermore, trying to access the WordPress dashboard results in an infinite loop, since the request from Cloudflare to your server is still HTTP and handled accordingly by WordPress.

The quick way to fix this is to simply add a few lines to woud wp-config.php

And maybe install some kind of HTTPS plugin to get rid of the mixed-content warnings due to residual http:// content from other plugins.

Wet tumbling and the weight of brass

so-shiny-im-gonna-dieAfter wet-tumbling my first batch of brass the first thing that came to my mind was that scene from Despicable Me: It’s so fluffy shiny I’m gonna die!

So I went ahead and did my already dry-tumbled “clean” brass over again, leaving my with piles of oh so shiny brass. But… how much? Well, counting brass kinda sucks when you’re talking thousands per caliber, so better put it on a scale and do the math.

Here’s a handy breakdown for future reference:

Case grains per case grams per case cases per lb cases per kg lb per 1000 kg per 1000
9×19 59,5 3,86 118 259 8,5 3,9
.357 Mag. 78 5,05 90 198 11,1 5,1
.38 Special 68 4,41 103 227 9,7 4,4
.40 S&W / 10mm / .357 Sig. 70 4,54 100 220 10,0 4,5
.44 Mag. 115 7,45 61 134 16,4 7,5
.45 ACP 90 5,83 78 171 12,9 5,8
.223 Rem 95 6,16 74 162 13,6 6,2
.308 Win 175 11,34 40 88 25,0 11,3
.50 BMG 865 56,05 8 18 123,6 56,1

* the bigger the cartridge, the bigger the margin of error of course