XBMC/ Kodi headless on a recent Debian

After struggeling for some time with random segfaults of a headless XBMC, pardon Kodi, in libxbmc.so I found this forum post:


which fixed it for me. I made a diff that applies to a recent git checkout from XBMC Gotham 3.2 and includes the fix as well as all other patches for the headless mode. So you can just follow the nice HowTo from Fma965.


but use this patch:


For the reference, the segfaults looked like

Sep 8 19:17:17 kernel: [4101574.165138] EventServer[18820]: segfault at 0 ip 00007fc3bc61f27d sp 00007fc3a67332b0 error 4 in libxbmc.so[7fc3bbc73000+1897000] 

while the logfile stopped with

19:17:17 T:140478287922944 NOTICE: Thread EventServer start, auto delete: false
19:17:17 T:140478287922944 NOTICE: ES: Starting UDP Event server on
19:17:17 T:140478287922944 NOTICE: UDP: Listening on port 9777 19:17:17 T:140478279530240 NOTICE: Thread TCPServer start, auto delete: false

or after disabling all server services

09:04:03 T:139805209810688 NOTICE: Thread AlarmClock start, auto delete: false
09:04:04 T:139805727848320 DEBUG: LogindUPowerSyscall - Received unknown signal NameAcquired
09:04:04 T:139805727848320 DEBUG: Checking repositories for updates (triggered by XBMC.org Add-ons) 09:04:04 T:139805201417984 NOTICE: Thread JobWorker start, auto delete: true 

Using Sachesi with Debian

In order to update my BlackBerry Q5 I wanted to use the handy Sachesi program to install all the .bar files. It proved to be more complicated than I thought.

Problem is that Sachesi does in fact use a USB connection to communicate with the BB10 device but not via some serial protocol but instead IP. Therefor the device registers itself as a USB network device and acts as a dhcp server providing the computer with a link local IPv4 in a /30 network. And here lies the problem. Sachesi doesn’t recognize your BB if there are other Network connections going.

Long story short, I disconnected LAN and Wireless, put usb0 as

iface usb0 inet manual

into /etc/network/interfaces, restarted the network-manager service and run dhclient manually

sudo dhclient -v -d usb0

Make sure that Tethering and USB mass storage are off and the device is set to Windows Mode instead of Auto or Mac.

Sometimes it does work with WiFi enabled, but I have to stick with manual dhclient.

Update 2:
If you get random crashes with Sachesi and XFCE just disable the xfwm4 compositor while using it.

Online resize a Linux RAID

Today we want to swap the 2 hard disks in a RAID 1 array for 2 bigger ones. Let’s avoid downtime and try to do this online.

I found a HowTo here:

And basics about RAID on Linux here:

These are the steps:

  1. Do the Backup
  2. Hotplug one of the 2 new disks (make sure that your SATA-Controller is in AHCI mode…….
  3. Partition it in a convenient way
  4. Add it to the RAID1 (as a 3rd disk)
  5. Go out, jump around on a slackline, play some badminton, throw a frisbee, go climbing…
  6. Remove one of the 2 old disks from the RAID and the computer
  7. Add the 2nd one of the new disks
  8. Wait again
  9. Throw out the remaining old disk (don’t forget to remove it from the RAID before
  10. Grow the RAID Device
  11. Grow the filesystem
  12. Make sure your computer can still boot afterwards – especially if you messed around with the /boot partition

Okay. Let’s look at some steps a bit closer:

Adding a third partition to a RAID1:

mdadm /dev/md0 --grow -n3
mdadm /dev/md0 --manage --add /dev/sdc3
watch cat /proc/mdstats

Slacking of

Removing the 1st one of the old disks

mdadm /dev/md0 --manage -f /dev/sdb3 -r /dev/sdb3

Add the 2nd new one, remove the 2nd old one, change RAID back to 2 drives

mdadm /dev/md0 --manage --add /dev/sdb3
watch cat /proc/mdstats
mdadm /dev/md0 --manage -f /dev/sda3 -r /dev/sda3
mdadm /dev/md0 --grow -n2

Grow MD and ReiserFS

mdadm --grow /dev/md0 -z max
resize_reiserfs /dev/md0
watch cat /proc/mdstat

The first step again takes quite a long time because of the resync of md0. Nevertheless I ran the resize_reiserfs command directly afterwards und it worked fine.

Tell Debian to look after your Grub and initramfs

As we use Debian Squeeze and use grub (“grub-pc”) I did the following

cp /etc/mdadm/mdadm.conf /etc/mdadm/mdadm.conf_back
/usr/share/mdadm/mkconf > /etc/mdadm/mdadm.conf
dpkg-reconfigure grub-pc
dpkg-reconfigure grub-pc
dpkg-reconfigure initramfs-tools

I had to do the first 2 steps because the UID of the RAID did change (why?). 3rd and 4th step are the same but grub didn’t want to install itself into the new boot sectors in the first place because I also changed the /boot partition to now be a RAID1 on its own (and not to reside on one hd only). It can’t do any harm, so I propose it here as well. 5th is necessary because the mdadm.conf was changed.

In case you – like me – forgot the very last step, you are presented Debians initrams busybox rescue prompt. Here I did

mdadm /dev/md0 --assemble /dev/sda3 /dev/sdb3
...wait some time... (why that?)
mdadm -r /dev/md0 (why?)
mount -t reiserfs /dev/md0 /root

Now normal boot process jumped in.

And that’s it. It wouldn’t had been easier if we had used LVM on top of the RAID1 as we didn’t add disks but had to replace them. You don’t necessarily have to deal with 3 disks at a time but degrade the array before. But as I was dealing with old disks I didn’t have much trust in any of them.