Homeserver: NUC vs Raspberry Pi

I have tried at various points to write a followup to my “so what’s it like using a NUC for a homeserver/HTPC?” post. Mostly it strands on there not really being anything new to add. It works. The added workload of more applications (and maybe more traffic?) over the past two years has made it run a bit warmer and louder than it used to despite being de-dusted a couple of times. But it’s still doing it’s job. I have thrown in some docker containers and they work just fine. Run a virtual machine with kvm? Sure. As of now the main threat to it’s immortality is it’s inability to transmit 4K over HDMI. Not that I’m about to buy a 4k TV but some day, yeah?

The main thing that has kept me wondering if it is the right pick is the question: Did I splunge needlessly? Could I have gone for something cheaper without sacrificing anything? Specifically: Could a Raspberry Pi have done the job just as well?

I picked a Raspberry Pi 3 up at the post office on monday so I should finally be able to get an answer. I’m not replacing my own machine; my dad need a new home server after his Atom-powered fit-pc2 gave up the ghost. I quizzed him about his needs and found that they were fairly basic: A ‘LEP’ web server (Linux, Nginx, PHP, no MySQL) and for HTPC purposes access to the national broadcaster whether through browser or a Kodi plugin would suffice. This, I thought, had to be a good test case for picking a Pi over a full x86-based machine.


Trying out Fedora 26: No way-land?

My relationship with Fedora is of the sort where every two years I look at screenshots and go ‘Nice, why am I not running this again?’ Then I install it and everything looks fine. Then bit by bit the seams start to show.

Fedora 26 was to have been my grand entry into all things Wayland. The laptop running Ubuntu 16.04 started to feel like it needed something fresh or maybe I was just bored. I went in with open eyes, knowing that the move from Xorg to Wayland would invalidate a whole swathe of hacks I have used since times immemorial. It was going to be painful but a) it’s the cost of progress, might as well bite the bullet now and b) something something profit? Profit being some unforeseen advantage to doing things the new way.

To cut to the punchline, Wayland-Gnome runs and is perfectly servceable and I applaud the Fedora team for being the vanguard of the future and all that. I’m just not convinced that I as a regular user want to be on that frontline.


Why my udev backup script kept failing and how I fixed it

I wanted to use udev to sync my backups to an external usb drive but the rsync-based shell script kept mysteriously stopping before the job was done.

When I say ‘use udev for backup’ what I mean is to use udev’s discovery of me plugging in the offline backup drive to fire off the backup script. Plug it in and the synchronization starts automatically. When it’s done it will automatically unmount the drive and inform me of the outcome via email. Sometimes there would be several weeks of new backups equalling gigabytes of data and so it would be convenient to just plug it in and leave it to do it’s thing.

The script was not apparently crashing wildly, just at one point it is running and the next it is not.  htop shows it to be running. iotop shows that data are being transferred. And then poof, suddenly it’s gone, even though there were still tens of Gbs left to transfer.

Luckily, the explanation is simple. Udev can fire off scripts but they are supposed to be very shortlived. Syncing 40 Gb over a USB 2.0 connection takes over an hour. The script is killed by the system after a few minutes. I found this elegant solution in an opensuse forum post.


Steam In-home Streaming lags with NetworkManager revisited: Replacing NetworkManager with systemd-networkd

Back in early 2015 I encountered an issue with NetworkManager: Even if you have ever only told it about your one single wireless network (or AP, access point) it insists on scanning the airwaves at regular intervals (about every two minutes) looking for a better connection. I thought that was dumb. This behaviour is known to the developer and is working-as-intended. There is no off-switch. I thought that was really, seriously dumb. I still do.

It was not an issue for me until I tried live streaming, specifically using Steam’s in-home streaming that allows you to play a game on a different computer to the one you’re sitting at and streaming the ‘playback’ to your current machine. Then NetworkManager cuts into the smooth streaming every two minutes, turning it into a screenshot slideshow instead for 3-5 seconds. If you’re playing a game that requires attention to not dying/crashing/clicking-the-wrong-button, this is a bad thing for a long time.

Now, my gaming desktop died shortly afterwards (note to self: Never buy another (cheap) Corsair PSU as long as you live) so it quickly became a non-issue. I recently got a new gaming computer, dual-booting Windows 10 and Ubuntu 16.04 17.04.  Coupled with a new 802.11ac wireless network  it seemed obvious to try to make in-home streaming work with the desktop-to-HTPC streaming, essentially making the HTPC a high-end Steam Link, rather than a low-end gaming computer in it’s own right. Running the streaming ‘server’ from Windows, everything works. Streaming from linux I was instantly reminded of the problems I had two years ago.

About half a year ago, commenter William Bernting kindly added some information to my original post suggesting how to make NetworkManager stop the scanning routine. I hope it works for whoever finds this information and I should probably have tested his solution before forging ahead with my own, more radical one. However, I have no patience with NetworkManager anymore, I do only connect to one network and I had the impetus last night so here is what works for me: Rip out NetworkManager, replace with systemd-networkd.


Chorus2 + Firefox 51 = Easier music streaming

One of many new features in Kodi 17 is the new default  web frontend, Chorus2. The old Kodi frontend was an extremely basic web remote that allowed you to start, pause and select media. Chorus2 does all that in much slicker package AND has a ‘local’ tab for local playback, i.e. streaming from the Kodi instance to whatever device you’re controlling it from.


Running Kodi as a pure client on linux

When I got rid of the last Windows partition on any of my home computers, I thought I would finally give NFS a chance to replace CIFS as the reigning network file system in my house. To it’s credit, NFS took that chance and ran with it and it’s worked pretty much flawlessly ever since. Seeing how reliable it has been, it has become my primary means of accessing media located on my HTPC when not in front of/within earshot of the my TV/hifi but still on the local network.

That approach, however, has some serious shortcomings. I can’t see what I have and have not watched. I can’t see if I’m halfway through a movie – something that is depressingly common in this ADD world of media abundance. I have to move between file managers and video players, something that isn’t that practical when my 2-in-1 laptop is in a position that hides away the keyboard and I have to rely on the touch screen. And I find myself missing the inviting presentation of Kodi from my HTPC.

So recently the thought struck me: Could I not just set up a second Kodi instance on my linux laptop only as a client? Turn a full-fledged Kodi application into a dumb terminal? An… *makes sign of the cross* ‘app’? Only then I did I remember that, wait, wasn’t that sort of the selling point of Plex over Kodi? Apps aplenty? Streaming everywhere and anywhere? Well, yes. But it can be done with Kodi. Sort of. Here’s what I got.


A Systemd service unit for Redshift

Redshift is a small utility that gradually – as day turns into night – shifts the colour composition of the light from your monitor. The later it gets, the ‘warmer’ (i.e. redder) the colour becomes. This may sound odd but the effect is really pleasant and (literally) easy on the eyes. Once you’ve grown used to it, looking at a screen late at night you’ll really notice how harsh and cold the light will appear without it. I owe this discovery to Graham Morrison from Linux Voice. You can read more about it in Graham’s piece on page 78 in the now free issue 14 of Linux Voice (you should also subscribe to LV as it’s a really good magazine).

Redshift is the sort of thing you want to have running as soon as you log into your desktop but occasionally, you want it to turn it off. I occasionally play Spelunky into the wee hours of the night and running redshift while playing the game makes dark levels, well dark. Pitch black, more like. So a classic Gnome autostart file is not ideal as we can’t interact with it (apart from killing the resulting process). Redshift does come with a small tray utility that should allow for turning on and off but I really dislike tray litter and anyway Gnome’s trying to do away with this sort of thing. So systemd to the rescue.

Sadly the redshift package in Ubuntu 16.04 comes without a systemd .service file so I put together one myself.