I realize that most people have moved away from watching TV over cable or broadcast these days. We still use it at my house, and have become quite used to running it with MythTV as our DVR (skipping commercials, etc). Recently I decided that it was time to shift the MythTV setup off the dedicated system it had been running on - that system is several years old and has crashed a few times recently with hardware-like errors, so it was time to do something else before the machine died and I had to do it unplanned. Rather than buy or build a new computer to run it, I decided to continue drinking the container/VM coolaid (so tasty), and run the backend as a VM on the QNAP NAS we have to keep pictures and other shared media.
In particular, we’re running MythTV with a SiliconDust HDHomeRun Prime network tuner. I like it, but it turns out that this makes the setup of MythTV a bit more complicated. In the interest of saving some other poor slob who’s trying to do this also, here’s the steps I took to get all this wired together & working. Note: this is just building the backend. The frontend can be a simple ubuntu desktop with the mythtvfrontend application installed.
To manage pack-rat/digital hoarding tendencies, I decided to make the actual disk storage for mythtv a dedicated volume on the NAS. This is fairly easily done:
If you already have a folder for this purpose and just want to move that folder to a dedicated Volume, you follow the same procedure to make space as above (step 1), and then right-click on the folder and select “Transfer to Dedicated Volume”
The communication between the HDHomeRun and the MythTV backend isn’t something that I’ve looked at carefully, but a number of sites online mention that it tries to call back to the MythTV backend directly, on random ports…which means that you can’t have a many-to-one NAT between the HDHomeRun and the backend. The way I got around this was to use one of the other interfaces on the NAS as a dedicated “containers” interface. I configured the second interface of the NAS as a bridge, and connected all the containers running on the NAS to that bridge so that they appeared directly on my home network, rather than trying to map host ports to VMs.
Here’s what I did for networking:
Next we need to make the actual VM, and attach it to the network. In this case, I wanted to use Docker, but it became very complicated. MythTV assumes a lot about its install environment, especially that it has access to a desktop GUI. (we’ll get to that a bit below) Docker containers almost never have that, and the pre-built QNAP ones also minimized Ubuntu itself. I kept running into things it was missing, so I eventually bailed on the Docker images and used the LXC one. The steps I followed:
Now you’re ready to actually install the MythTV backend.
To actually configure MythTV, you’ve going to need to be able to pull the display back to a system somewhere. Basically, there is no headless way to configure the MythTV backend. That’s a shame, but that’s the state of things. So, you’re going to need to be able to connect X-Windows somehow back to your system. Personally, I used a Mac to do this, and ssh’d from the command line to the MythTV VM.
One note to make before you dive into this: my Mac had dual displays. OSX handles tunneling X-windows, but does not handle drawing X-Windows applications across both displays. This means when you launch the MythTV configuration application, if you have dual displays it will only draw half of the screen. This is not helpful. I ended up having to unplug one monitor for the time I was configuring MythTV.
My steps:
ssh -X <user>@<IP of VM>
the -X option tells SSH to tunnel X-Windows alsosudo apt-get install software-properties-common
you need this to get the add-apt-repository
command that you’re
going to use in a momentsudo add-apt-repository ppa:mythbuntu:31
. (version 31 is the most recent as of the writing of this, you may want
to check the MythTV installation instructions to see if there’s a more recent one when you read this.)mythtv-setup
Some notes about mythtv-setup: