I use beets for keeping my music library on my Kodi install clean. I also like beets to copy files from their source, to leave its source intact.

Now, beets doesn't alter a lot of the files (if you don't let it transcode), it merely adds some tags to the files and puts them in clean directories, with a cover image. Most of the file stays the same.

That made me think about deduplicating files. As I'm using btrfs as storage for my multimedia system, it's pretty easy to use something as duperemove to get rid of duplicates, and even parts of files. That being said, I should check whether it really finds duplicates and gets to dedupe them.

Anyhow, to make my life easier, I wanted to give the xbian user passwordless sudo access to duperemove. So, one uses visudo for that, right? I read the man page,

SYNOPSIS
     visudo [-chqsV] [-f sudoers] [-x file]

and I notice you can supply a file with the -x flag. Oh boy, was I wrong. Been to quick. visudo actually destroyed my /etc/sudoers.d/xbian file! Turns out that flag is for a json output of whatever visudo parsed after saving.

This actually locked me out of my Raspberry PI. Kodi didn't start anymore (apparently it needs some sudo access somewhere?), I couldn't edit the file, as sudo didn't work anymore.

But that's easily fixed, right? Put it into a Linux computer, reset the file from a backup, and there you are!

Wrong again. xbian, for some odd reason, uses lz4 as inline compression system. lz4 is not mainlined into the kernel, and is not compatible with standard btrfs compiles.

xbian has these lz4 patches available for a bunch of kernels, but not for 4.8 (which, as of writing, is current stable, and what's default in Arch and Fedora). It's there for 4.4 and 4.6 though. Long story short: it turn out that 4.4 is a long term support kernel, and that there are PKGBUILD's available for linux-pf-lts. I downloaded the PKGBUILD, added this

+        'https://github.com/xbianonpi/xbian-sources-kernel/commit/e23b8d3e628d7a9f2dd6237d2385f91873b050a7.patch' #Subject: [PATCH] BTRFS lz4 code Fix for 4.1.y
+        'https://github.com/xbianonpi/xbian-sources-kernel/commit/20eb043895301c216e56021559ecfc86898bdd3b.patch' #lz4

and

+  patch -Np1 -i "${srcdir}/20eb043895301c216e56021559ecfc86898bdd3b.patch"
+  patch -Np1 -i "${srcdir}/e23b8d3e628d7a9f2dd6237d2385f91873b050a7.patch"

compiled it, rebooted into it, changed the file, and our Kodi works again! Next time, read the man page carefully, and use visudo -f...