Install Mythbuntu 16.04.01
These notes were first published by Jim A in the forum http://www.gossamer-threads.com/lists/mythtv/users/605147 and are being extended.
How to install Mythbuntu 16.04.1
Since I have to rebuild my Mythtv ATSC OTA DVR once in a while I forget what I did in detail so I always miss a critical step and spend hours looking for something I figured out months earlier. So now I’ve created a document to save me that trouble. It should not leave out a step for the average Ubuntu Linux user and may help others besides me. So here are the steps I used:
1. I use an Intel® Core i5 system with Hauppauge HVR 2250 Dual Tuner PCIe card and a SiliconDust HDHomeRun Connect networked tuner.
2. I ran a mythtv database backup so I could restore it after the install and keep my current recordings and settings: /usr/share/mythtv/mythconverg_backup.pl
3. I moved of copy of the database backup file to my NAS.
4. Boot Mythbuntu 16.04.1 installation image via USB Flash drive created with Startup Disk Creator from Ubuntu 16.04 system, or installation CDROM.
5. Ensure the host name you enter during the install is identical to that on the old system so the restored database will work.
6. Install standard options, some noted below:
a. Download updates while installing b. Install 3rd party software c. Erase and reinstall d. In my case I have 3 drives; an SSD to boot, and 2 hard drives for recording storage. Make sure you pick the right drive to install and format. My SSD was /dev/sdc so I picked that. e. Pick your timezone location. f. Pick your keyboard layout g. Setup login information and auto login option. h. Primary backend w/Frontend i. Select, VNC, SSH, Samba, NFS, and MythTV Service j. Android remote or whatever you use.
7. After the boot from the hard drive, it tries to run the mythtv-setup program GUI, but I exit and make sure no mythtv programs are running.
8. Update the system using sudo apt update and sudo apt upgrade. Reboot. DON’T USE SOFTWARE UPDATER AS IT LOCKS UP AFTER FRESH INSTALL; at least it does every time for me.
9. I then run mythbuntu-control-center and change a few options like:
a. Mysql – enable remote frontends b. Repositories - set for updates using 0.28 and also mythbuntu updates. c. Startup behavior - disable running mythfrontend on boot.
10. I updated the system again to bring in the new mythtv updates.
11. In my case I need to auto mount the 2 recording data drives, so I need to modify /etc/fstab. NOTE! If GID or UID changed from last time these drive were used in mythtv system, it might pay to recreate the file systems on these drives with Gparted (This has been questioned since it will remove any data in them! Change directory and file permissions recursively instead).
12. From terminal:
13. Edit /etc/fstab using UUID from the output of the ‘blkid’ command to add drives to list of drives mounted at boot. Or you could use the label option. In my case:
# # sdb1 recorded-tv-1 UUID=84f59b6c-7cbb-4126-9101-c5af3989eb74 /media/recorded-tv-1 ext4 defaults 0 0 # sda1 recorded-tv-2 UUID=a9196a4c-a8ad-4a6d-b57e-2a890eba3067 /media/recorded-tv-2 ext4 defaults 0 0 #
LABEL=recorded-tv-1 /media/recorded-tv-1 ext4 defaults 0 0 LABEL=recorded-tv-2 /media/recorded-tv-2 ext4 defaults 0 0
14. I also add an entry in /etc/fstab for my NAS:
192.168.0.250:/mnt/media /media/media nfs defaults 0 0
15. After reboot, make sure drives and NAS are mounted at desired mount points
16. Change owner and group of new mounted drives/NAS to user and group ‘mythtv’. i.e.
sudo chown –R mythtv:mythtv /media/recording-tv-1
17. Also need to make the directories R/W for others. Make sure you use this wisely i.e.
sudo chmod 777 /media/recording-tv-1
18. I needed to add drivers for my Hauppauge HVR2250 card. At a terminal session: (Or get files from a local backup)
sudo apt-get install unzip wget http://www.steventoth.net/linux/hvr22xx/22xxdrv_27086.zip wget http://www.steventoth.net/linux/hvr22xx/HVR-12x0-14x0- 17x0_1_25_25271_WHQL.zip wget http://www.steventoth.net/linux/hvr22xx/extract.sh wget http://www.steventoth.net/linux/hvr22xx/firmwares/4019072/NXP7164- 2010-03-10.1.fw sudo sh extract.sh sudo cp *fw /lib/firmware
19. Setup a fixed IP address by adding to /etc/network/interfaces. Make sure you know which enet interface you are using if you have multiple. Note eth0/1 are now eno1/2 in mythbuntu 16.04.
auto eno1 iface eno1 inet static address 192.168.0.205 netmask 255.255.255.0 network 192.168.0.0 gateway 192.168.0.1 dns-nameservers 184.108.40.206
It may be simpler to use network manager or even to still rely on DHCP but give a fixed address in your router.
20. Now we need to fix some startup issues because of the move to ‘systemd’ instead of the ‘upstart’ in mythbuntu 16.04. Here’s some guidance I used from Stephen Worthington.
21. Because I have network tuners and remote frontends, the default systemd file for mythbackend needed tweaking. The HVR-2250 is a tuner that has a slow firmware upload, so I will likely need to make mythbackend wait until the tuners are up before starting.
22. Create a new set of rules for udev that produce systemd events for the tuners. Create a new file in /etc/udev/rules.d. I have called mine 99- mythbackend.rules. Put this in it:
# # Create systemd device units for capture devices # SUBSYSTEM=="video4linux", TAG+="systemd" SUBSYSTEM=="dvb", TAG+="systemd" SUBSYSTEM=="firewire", TAG+="systemd"
23. The file should be "chown root:root" and "chmod a=r,u=rw".
24. Create a new directory /etc/systemd/system/mythtv-backend.service.d where you put an override file for systemd to override some of the settings from the package installed file (/lib/systemd/system/mythtv- backend.service) that controls mythbackend startup and shutdown.
25. The new mythtv-backend.service.d directory should be "chown root:root" and "chmod a=rx,u=rwx".
26. Create a new .conf file in the new mythtv-backend.service.d directory. I have called mine mythtv-backend-override.conf. This is what I needed for the HVR-2250 which creates two devices on /dev/dvb0 and dev/dvb1:
[Unit] Wants=dev-dvb-adapter0-frontend0.device After=dev-dvb-adapter0-frontend0.device Wants=dev-dvb-adapter1-frontend0.device After=dev-dvb-adapter1-frontend0.device After=NetworkManager-wait-online.service
The final ‘after’ line tells systemd to wait until NetworkManager has the network fully up and running, instead of just the localhost interface being up. That allows mythbackend to find the external IP address it is configured for, otherwise it will immediately shut down again. It also means that mythbackend will be able to talk to the HDHR tuners, which it does immediately after startup. If it cannot talk to them then, it will mark them as failed and not try to use them after that. The .conf file should be "chown root:root" and "chmod a=r,u=rw".
27. Check if the NetworkManager-wait-online.service is enabled:
systemctl status NetworkManager-wait-online.service
28. Restore your database - example here but substitute your correct directory and filename in this:
sudo stop mythtv-backend /usr/share/mythtv/mythconverg_restore.pl\ --drop_database --create_database\ --directory /var/lib/mythtv/db_backups\ --filename mythconverg-1214-20080626150513.sql.gz sudo start mythtv-backend
29. Check your database consistency:
Use optimize_db.pl. If you cannot find it use:
then run it eg
Then check for orphans with find_orphans.py. If you cannot 'locate' it on your system get it from https://www.mythtv.org/wiki/Find_orphans.py