Farewell, iTunes, Almost

For the past seven years or so, and despite ‘s continued neglect of Home Sharing, all our home media was served by running on a dynasty of sitting in a closet (the last being a 2008 Core Duo running Lion). A I decided to put an end to that and started trying out Plex on a , belatedly realizing what I’ve been missing out on all these years.

My setup is trivial: The Synology NAS holds all the media, and I get to it via a front-end machine running Plex, which handles all the indexing, transcoding and navigation.

This weekend I replaced the I have been using with something a little beefier: I got a white-label Z83ii mini-PC from eBay, which sports an Intel Atom x5-Z8350–a CPU rather ironically pitched as being for “next generation IoT Edge Devices”.

The Pi 3 sitting on top of the Z83ii

For less than $70 (which is, all things considered, less than twice the cost of a plus a nice box and 2A PSU), I get what is an effective 2x speedup when compared to the , which translates into much smoother media transcoding for the Chromecast dongles I’m using at the moment (and the ability to use more than one at a time).

I picked it because it comes with 32GB of EMMC storage, 2GB of RAM, and a fair selection of IO ports that make it ideal for stuff like digital signage. The Intel 400 integrated graphics are serviceable, but in truth I’m not likely to make much use of anything else but the Gigabit Ethernet port.

Wi-Fi and Bluetooth

Well, almost. I’d love to be able to use Wi-Fi and Bluetooth on this as well, but they’re not detected by the current mainline kernel and reading up on other cheap z83-like machines that use the AP6234 chipset (which is what it’s supposed to have), I surmise the devices’ power_state defaults to off.

In a typical approach of low-end Chinese knock-offs, the BIOS lists two other Broadcom combo chipsets (AP6255 as the default and AP6212 as a second option), but neither comes up in lspci and dmesg isn’t very helpful, although these entries intrigue me:

# dmesg | grep ACPI | grep mmc
[    2.736805] mmc0: SDHCI controller on ACPI [80860F14:00] using ADMA
[    2.741507] mmc1: SDHCI controller on ACPI [80860F14:01] using ADMA
[    2.747434] mmc2: SDHCI controller on ACPI [80860F14:03] using ADMA

I’ll keep poking at this, mostly because I’m interested in getting Bluetooth audio to work, but the gist of this setup is doing transcoding, so let’s get to it.

Update: July 2019

I eventually got another of these (they’re super handy), but that one came with an AP6255. I installed the Ubuntu 18.04.2 server image on it, and got Wi-Fi working by doing this:

sudo apt-get remove broadcom-sta-common broadcom-sta-source firmware-b43*
sudo apt-get install bcmwl-kernel-source
sudo vi /etc/modprobe.d/blacklist-bcm43.conf # comment out brcmfmac

For the required firmware and settings, I fetched brcmfmac43555-sdio.bin and brcmfmac43555-sdio.txt from this repository and placed them in /lib/firmware/brcm/:

sudo cp brcmfmac* /lib/firmware/brcm/
sudo modprobe brcmfmac
wpa_passphrase SSID PASSWORD | sudo tee /etc/wpa_supplicant.conf
sudo wpa_supplicant -c /etc/wpa_supplicant.conf -i wlan0 & # for testing
sudo systemctl enable wpa_supplicant.service

I then had to deal with the weirdness of netplan:

 cat /etc/netplan/50-cloud-init.yaml
 network:
    ethernets:
        enp1s0:
            dhcp4: true
    wifis:
        wlan0:
            dhcp4: true
            access-points:
                "NETWORK_NAME":
                    password: "PASSWORD"
    version: 2
sudo netplan apply

I haven’t upgraded the original machine yet, but will update this when I have done that (or gotten Bluetooth to work on this one).

Update: August 2022

I have since upgraded the new machine to Ubuntu 22.04.1, and Bluetooth now works (I had no real reason to get it to work before). I have also gotten a slightly different brcmfmac43555-sdio.txt file that works with the shipped .bin drivers.

sudo modprobe brcmfmac; sudo iwlist wlan0 scanning works and shows me both 2.4GHz and 5GHz access points. sudo netplan apply with the above config brings up the interface, but I had to add it to /etc/modules and go to /etc/modprobe.d/blacklist-bcm43.conf to comment out the blacklist brcmfmac line for it to be loaded across reboots, which is understandable but the annoying kind of Linux experience that I could do without.

Docker All The Things

The Z83ii shipped with Windows 10 Home (which was actually rather nice), but I hit F7 upon boot and re-imaged it from a USB key with Ubuntu Server 16.04.3, which can deal with the UEFI peculiarities of this box. I then set the BIOS to power it on automatically, and was good to go.

As a side benefit from switching to Intel, I no longer need to use my custom Plex container–I just built a docker-compose file to run the official container image along with a DAAP server for non-UPnP clients, pointed the whole thing at my NAS via SMB, and called it a day:

version: '3'

services:
  plex:
    image: plexinc/pms-docker:latest
    container_name: plex
    restart: always
    network_mode: "host"
    environment:
      - PLEX_CLAIM="${PLEX_TOKEN}"
      - ADVERTISE_IP="http://${HOSTNAME}:32400/"
      - PLEX_UID=${USER_ID}
      - PLEX_GID=${GROUP_ID}
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /dev/rtc:/dev/rtc:ro
      - ./config/plex:/config
      - /tmp/transcode/:/transcode
      - data:/rw/media
      - video:/ro/video
      - music:/ro/music

  daapd:
    image: linuxserver/daapd:latest
    container_name: daapd
    restart: always
    network_mode: "host"
    environment:
      - PUID=${USER_ID}
      - PGID=${GROUP_ID}
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./config/daapd:/config
      - music:/music

volumes:
  data: 
    driver: local
    driver_opts:
      type: none
      device: /mnt/plex-data
      o: bind
  music:
    driver: local
    driver_opts:
      type: none
      device: /mnt/music
      o: bind
  video:
    driver: local
    driver_opts:
      type: none
      device: /mnt/video
      o: bind

Incidentally, the above is a decent enough sample of using the local volume driver under compose, which isn’t well covered in the docs right now.

I didn’t run any extensive benchmarks, but Plex now responds instantly regardless of the device(s) used to access it, and all that remains now is sort out the usual kinks where it regards remotes, music streaming and whatnot (which, truth be told, has more to deal with furniture and speakers than anything else).

Home Sharing, Done Right

I know this is atypical in this age of streaming music, but I prefer listening to my own CD collection, and I can finally do it properly again–much to my surprise, forked-daapd can also pair with the Remote app on , through which I can redirect playback to any endpoint, including Chromecasts.

Apple completely broke access to personal libraries when they decided Home Sharing was the future (and then promptly forgot all about it), but with this setup and some experimentation with other services (both Google Play Music and Groove let me access my favorite albums on the go) I suspect I’ll soon be opting out of iCloud Music Library (which I only keep using out of inertia, really).

Ironically, all that’s missing now is a suitable replacement for the . I’m trying to get used to the Plex Mac app, but in that context I really only want the music bits.

I’d rather the app were fully native rather than a somewhat brittle shell around the Web UI (it takes up too much screen real estate and lacks hotkeys), but I guess I can give a little more time.

This page is referenced in: