Vagrant & Ansible

I’ve been getting back into Vagrant and Ansible lately, as I decided I needed a platform to do some Continuous Integration testing of Arduino and packaging of arduino-mk; and also building Kodi on a faster platform than my Atom HTPC.

As luck would have it, the Debian package for Ansible 1.9.2 just hit Sid, so I don’t have to build my own from git with “make deb”, which is a bit Ubuntu-centric and doesn’t work too well on Debian.

So I’ve made a Fedora 22 VM that I can make arduino-mk packages on, an Ubuntu 12.04 VM that I’m building Kodi 15 packages on, and an Ubuntu 14.04 VM that I’m using for both. I also made a Debian Jessie and another Ubuntu Trusty VM along the way.

As I am using the new VirtualBox 5.0rc2, Vagrant 1.7.2 needs this patch.

The Precise VM (with 8 cores and 4Gb RAM assigned) builds Kodi in 35mins – about half the time it takes the Atom, which isn’t that impressive, but its an improvement.

Setting up an Ubuntu 12.04 build environment for Kodi again was a right PITA though, mainly as “apt-get build-dep” doesn’t actually fetch half the dependencies, and you need newer versions of libyajl2, libyajl-dev, taglib and JsonSchemaBuilder, as well as now having to install gcc 4.9 as they’ve just switched to C++11 today!

So that’s basically this lot wrapped in an Ansible playbook:

add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update
apt-get build-deps xbmc
apt-get install libssh-dev libxslt1-dev git libmp3lame-dev swig libcec-dev openjdk-7-jdk gcc-4.9 g++-4.9
dpkg -i libyajl2_2.0.4-4_amd64.deb libyajl-dev_2.0.4-4_amd64.deb libtag1x8_1.8-0precise17_amd64.deb
cp /home/vagrant/kodi/packaging/deps/JsonSchemaBuilder /usr/local/bin/JsonSchemaBuilder
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 40
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 60
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 40
update-alternatives --install /usr/bin/x86_64-linux-gnu-gcc x86_64-linux-gnu-gcc /usr/bin/gcc-4.9 60
update-alternatives --install /usr/bin/x86_64-linux-gnu-gcc x86_64-linux-gnu-gcc /usr/bin/gcc-4.6 40
update-alternatives --install /usr/bin/x86_64-linux-gnu-g++ x86_64-linux-gnu-g++ /usr/bin/g++-4.9 60
update-alternatives --install /usr/bin/x86_64-linux-gnu-g++ x86_64-linux-gnu-g++ /usr/bin/g++-4.6 40

Ubuntu 14.04 is much easier, and you just need some basic tasks in your Playbook.yml

- name: install dependencies
  apt: name=xbmc state=build-dep

- name: install libxslt
  apt: name=libxslt1-dev state=present

- name: install git
  apt: name=git state=present

- name: install libcec-dev
  apt: name=libcec-dev state=present


I’ve recently been using VMWare ESXi 5.5 in anger – with real VM’s rather than just testing shell commands. Plus it seems the last couple of versions of VirtualBox can no longer run ESXi as a guest.

Anyway, its soooo Windows-centric vendor-locked its unbelievable. I mean you can’t even load a bunch of ISO’s on a USB stick and put them in the back of the machine, you have to transfer them using the VSphere client over the network. I’ve not tried scp but I doubt that would work due to the cut-down SSH server and shell. Seems its not even called ESXi anymore, its VSphere Hypervisor or something.

Also there’s no way to find the physical network interface name/number/ID from the virtual nics! It seems VMWare assumes everyone is either using flat networks with no vlans/subnets or only use multiple interfaces for nic teaming/bonding; and have never needed to know which ethernet cable should go to which switchport and map to which network device in the VM.

The only good point is that the vmware-tools are now in some distro’s like RHEL so you don’t need to install kernel source, gcc and make to rebuild the kernel modules every time you do an upgrade.

There’s an annoying “feature” with the console – if you click on the console tab in VSphere it shows the console, but if you click the console icon, it then shows another one, and there doesn’t seem to be a way to disconnect the tab one and you get an annoying popup telling you there’s 2 connections all the time!

It still seems a bit flaky regarding screen resizing and networking, and the whole virtual switch thing is a mess as you end up having to define one switch per interface with only that interface in it if you want your guest to have multiple network cards. It seems more like a virtual router to me.

I’ve also installed a CentOS7 virtual machine, but don’t like it much, networking seems very buggy – especially the new interface naming conventions described here, and that NetworkManager doesn’t seem to track changes made with ifconfig. Systemd is a pain and I even found that rpcbind can’t be disabled using the systemdctl command, you have to symlink rpcbind.service and rpcbind.socket to /dev/null

I’ve just soldered the pins on my Arduino Pro Mini, and found its not well documented – probably because its not an official Arduino (its kind of based on the Arduino Mini) its a SparkFun board that’s been revised and cloned a lot. I finally figured out the pinout for uploading using a CP2102 – its RX-RX, TX-TX, GND-GND, 5V-VCC, DTR-DTR and don’t connect the reset pins or use resistors or capacitors as some sites say.

The Makefile for the 5V 16MHz ATmega328p board is:

BOARD_TAG    = pro5v328
include /usr/share/arduino/

Rather annoyingly I’d soldered the rear analogue headers on before I realised that it wouldn’t fit breadboard anymore, so I’ve removed them again and may put right-angled headers on at some point. I much prefer the Nano or even Pro Micro.

I just compiled XBMC 14a4 from git and pretty much nothing seems to have changed from 13.2 other than the Kodi name. Had to disable the Google Test Framework to get it to build as its now enabled by default.

I also upgraded the blog to WordPress 4.0

XBMC On Ubuntu 12.04

I’ve replaced the Fedora14 on my Revo 3610 with Ubuntu 12.04 now its a dedicated HTPC and not “the visitor box”.

I found out pretty much straight away that Unity2D uses too much background resources for XBMC to run alongside, so I’m making use of the XBMC session, which doesn’t load a window manager underneath and can stream 1080p over PowerLineHD to the NFS server just fine.

I compiled XBMC 12 alpha (Froyo) from git but found that the database schema has changed so much that XWMM 2.0.6 doesn’t work with it. So I went back to the Ubuntu-packaged 11.0 (Eden).

Anyway, here’s the instructions I used (kind of based on these) it takes about 50mins to compile on the Revo, not much slower than in a VM:

make distclean
git reset --hard
git clean -xfd
git pull

./configure --prefix=/usr --enable-vdpau --disable-pulse --disable-crystalhd \
  --disable-debug --disable-avahi --disable-airplay --disable-airtunes \

make -C lib/addons/script.module.pil
make -j4
sudo make install prefix=/usr

I received my Anyware HA-IR01SV MCE remote control, installed lirc (configured as MCE remote) and it worked straight away, its so much better than using a keyboard.

I changed the default shutdown type to “suspend” in the XBMC settings, and now the remote control power button suspends the PC. To get it to wake the PC up again though, I had to figure out the device ID:

# lsusb
Bus 002 Device 003: ID 1784:0011 TopSeed Technology Corp. 

# dmesg | grep mceusb
[13347.492286] mceusb 2-4:1.0: Registered Topseed Technology Corp. eHome Infrared Transceiver with mce emulator interface version 2

Then added this line to /etc/rc.local:

echo enabled > /sys/bus/usb/devices/2-4/power/wakeup

Update: a few other things to optimise Ubuntu 12.04:

1. Disable Avahi by changing AVAHI_DAEMON_DETECT_LOCAL=1 in /etc/default/avahi-daemon to 0

2. Disable IPv6 by adding this to /etc/sysctl.conf

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

3. Install Unsettings and a few other tweaks to make Unity more usable: howto

4. Unmute HDMI audio by running alsamixer as root and pressing “M” on any muted SPDIF channels.

Wire speed!

Dad came over the other day and helped me run some CAT6 cable from my computer room to my lounge so I can stream video’s etc at gigabit speed over NFS from the fileserver upstairs to the Mac Mini which is now hanging off the LCD TV using my new HDMI-to-DVI cable.

MacOSX at 1920×1080 on a 37″ screen is incredible! I’m awaiting my wireless keyboard/trackerball so I can use it to surf downstairs as well as running Plex (Xbox Media Center ported to the X86 Mac) with the Mac’s remote control. I’ve watched my first 720p and 1080p movies, and you can actually see the difference from a regular 480p XviD or DVD – not just the resolution, but the detail like hair and leather textures and lack of compression artefacts, plus you get DTS 5.1 sound and so on that the Xbox1 simply can’t cope with.

I’m going to order 15m of white CAT6 or 5e from ebay though, as the blue looks a bit naff against my white walls.

I’ve been playing with Windows Vista today under VirtualBox3, it really is a pile of poo – can you believe that to install Service Pack 2 you actually have to first install SP1? They each take about an hour, and afterwards there’s still more to get from Windows Update. Literally to install Vista, Norton and Office (plus service packs etc.) must have taken well over four hours! Nothing like RedHat where you install 5.0, type “yum -y update”, go make a cup of tea and come back to 5.3 with OpenOffice and so on pre-installed.

Weather’s still boiling hot, in fact I’ve come out in prickly heat/heat rash, so am showering every few hours to keep my core body temperature down and minimise sweat.

I also finally found my old GnuPG key, so I’ve revoked the Jedi one from the keyservers, leaving the more up-to-date Synaptic one which uses better encryption.

New Home Theatre setup

I’ve just bought a 37″ LCD TV, 1080i FullHD all the bells and whistles. Its lovely. I’m awaiting a HDMI->DVI cable for my Mac Mini, and then that will be hooked up to replace my Xbox as my media centre box (running Plex).

Someone is seriously inflating the cost of computer accessories in France though – a 1.5 metre HDMI->DVI cable was 30e in the supermarket where the LCD came from, or four quid including postage from ebay UK for 2m!

I’ve moved the CRT telly into the snooker room, along with the Xbox. I tried overclocking my OpenWRT wireless routers to get the signal through the two 3 foot walls, and it just managed it at 15dbm (up from 7dbm!) but there’s more noise and heat and less signal now, so streaming video doesn’t work, even though http/ping/ssh are usable. So I’m going to have to run some CAT5e up from my bedroom through the lofts and down I think – which I already did when we renovated the snooker room, although its on the opposite wall to where I need the TV, and we’ve sealed up where the a cable could run behind the skirting boards!

I’ve got to do the same down to the Mac, as I tested and even 720p video’s can’t stream over 54g wireless (regular DivX does of course) and VNC is a bit slow too, gigabit will be much nicer. So I should be able to run a cable from a switch in my computer room, through the ceiling where the gas pipes go, and along the beam in the lounge to the Mac. I’ve got to look into the effects of running UTP cable alongside copper pipes, and then either beg some cable from PP, or see if the couple of 25m lengths I’ve got are enough – should be for the Mac, dunno about the snooker room though.

If I cable those two up, I can completely disable wireless in my house, it is an awful piece of technology really – too many “standards” with differing implementations, way overstated speeds and far too vulnerable to interference from microwaves, phones etc. Fine for some casual web surfing from a laptop, although I don’t have a laptop anymore – another piece of technology I don’t really have a use for.

I’ve also got to get a friend to help me run some more satellite cable (which I’ve got to measure and buy too) for the snooker room, I’ve got a spare Sky box, card and LNB socket, so might as well plug it into the telly.

It’s sweltering hot the last couple of days, I’ve been over to the folks and used their jacuzzi, but it doesn’t cool you much when its over 31c outside. My lounge is about the coolest place at the moment, being all thick stone walls and tile floors, as long as I keep the door shut.

Update: I just moved my 24″ LCD onto my main desktop machine, seems like a waste on the laptop docking station (it used to share with the Mac Mini) and wow, 1900×1200 is a lot of desktop space! You can play 1280×1024 games in a window, or have what used to be a fullscreen VirtualBox session in a window and still have about a third of the desktop free. Websites can look a bit odd though. An 80-column text editor only fills about a third of the screen too, so it should be useful for programming. The sound is a bit tinny compared to the 19″ though – as that was a TV as well, so had good speakers. Of course its handy for watching movies with the widescreen aspect ratio.

Update 2: I found that even the wireless speed of the Mac Mini was unacceptable – scp’ing a 700Mb DivX took ages, so I’m currently hanging a 15m piece of CAT6 out of the window and in through the back door! Getting around 35MBytes/sec over GigE now, so copying a 4.4Gb Matroska file took under 3mins!

I’ve also figured out how to sleep the Mac Mini remotely, as if you use shutdown it won’t wake using WOL. So you just make the following AppleScript:


tell application "System Events" to sleep

chmod a+x it and run it over SSH.