I've done a fresh Arch x86_64 install on my HTPC. I previously had Arch on it, and I'm still running that temporarily until the new install works correctly (I've actually got 3 operating systems on it just to compare - old Arch, fresh Arch install and Slackware 14). Both Slackware and fresh Arch install are being installed at the same time. Both running Xfce, XBMC 11.0, MythTV 0.26.
I decided to start fresh with Arch when I changed entirely to systemd. I installed XBMC fine, but my Hauppauge HVR 2200 tuner is causing all sorts of problems with a fresh Arch install and MythTV 0.26. I followed the same procedure I had previously done with Arch and Slackware, found here. I used the "making it work easily" piece. I currently having it working in Slackware and the old Arch install, but the new install gives a journalctl MythTV message of
DVBChan(1:/dev/dvb/adapter0/frontend0): Failed to open DVB frontend device due to fatal error or too many attempts.
which is really strange, because I can go into mythtv-setup, delete the old tuners and create new ones, and then scan for channels correctly. However, I cannot then go through the frontend and Watch TV. The message reports "All tuners are currently busy". The Information Centre -> System Status -> Tuner Status states "Tuner 1 has an error". Same for Tuners 2,3 and 4.
At this stage if I restart the backend, the Tuner status appears normal, but I still cannot record anything or watch Live TV. Attempting to watch Live TV just shows a very quick black screen with "Please Wait" in the middle, and then returns to the Main Menu. I've checked permissions on the recordings folder, which is in fact the the same for all three OS, just mounted in the correct place. Mythtv user has same uid and gid for all 3 OS.
The second problem is that I have used /usr/share/mythtv/mythconverg_restore.pl to import my database from my old Arch install. All of the listings have appeared in the frontend, but every single one of them reports "Recording Unavailable. The file for this recording can not be found". This is strange because I was able to successfully import the old database into my Slackware MythTV 0.26.
Hoping to resolve TV Tuner issue first, but any input welcomed.
I made an addition to the [Unit] section of /etc/systemd/system/mythbackend.service:
[Unit] Description=MythTV Backend After=network.target mysqld.service Wants=dev-dvb-adapter0-frontend0.device After=dev-dvb-adapter0-frontend0.device Wants=dev-dvb-adapter1-frontend0.device After=dev-dvb-adapter1-frontend0.device Wants=dev-dvb-adapter2-frontend0.device After=dev-dvb-adapter2-frontend0.device
If mythbackend is starting before the adapters finish initializing (particularly when firmware is still loading) then it will think they are unusable. When you run mythtv-setup, mythbackend isn't running and the adapters have long since finished initializing.
Otherwise, you may need to repair the database: mysqlcheck -Ap --auto-repair <mysql password>. Your user must also be part of the proper group to access the /dev/dvb/adapter* devices.
As for the recordings being unavailable, you probably don't have storage groups setup, or access to them. I use SYMLINK udev rules to create persistent devices for the storage partitions. Then fstab rules to mount those to directories configured as storage groups in mythtv-setup, and the permissions on the directories to allow them to be read.
The old storage groups should be configured from your database backup, but you probably don't have them either mounted or readable.
Last edited by fphillips (2013-01-17 21:43:40)
I tried adding the extra lines to /usr/lib/systemd/system/mythbackend.service which was effective in making the backend wait for the tuners, but still no LiveTV or ability to record after rebooting. I do get my two tuners appear in /dev/dvb/adapter0 and /dev/dvb/adapter1, and both my user and mythtv user are members of video group.
Strangely, without those lines added the backend is started by user 'mythtv', even though in /etc/conf.d/mythbackend I have MBE_USER='root'. I have noticed though that the default in /etc/rc.d/mythbackend is to have MBE_USER='mythtv', shouldn't the conf.d file take precedence?
The mysqlcheck command output that everything was OK. I also have the exact same Storage Groups setup as my previous install, and have an fstab entry to mount the recordings disk in the same location for all my installs. They are definitely readable, can play them fine in VLC.
Last edited by farmerdave (2013-01-08 02:15:44)
The files in /etc/conf.d and /etc/rc.d are for sysvinit, and don't apply when using systemd. You configure with /etc/systemd/system/mythbackend.service which overrides the file in /usr/lib/. I would check the mythbackend log in /var/log/mythtv/ to see why its not recording. You can change the loglevel and verbosity in the service file if necessary (see mythbackend --help).
What messages are there in dmesg about firmware?
While trying to change the loglevel I issued the following command (as root)
# systemctl stop mythbackend.service
and then as my user (david, without root priveleges) I issued in one terminal
$ mythbackend --loglevel debug
and in another terminal I issued
I then checked and both mythbackend and mythlogserver are running as 'david'. Unbelievably to me, I was able to find all my old recordings, play them, and also watch LiveTV!
But when the backend is running as 'root' or 'mythtv', I still cannot. I'm completely stumped! Does this mean that during installation I was logged in as 'david' and was meant to be logged in as 'mythtv'?
Last edited by farmerdave (2013-01-09 00:38:02)
Some log files.
Last edited by farmerdave (2013-01-09 07:07:06)
At the end of the mythtv backend log you have a permission error for your LiveTV storage group. You should chown -R user:group /home/david/MythTV/Recordings/LiveTV.
What are the permissions on that directory and what groups does mythtv belong to?
Last edited by fphillips (2013-01-09 20:45:40)
The permissions are as follows:
$ ls -l /home/david/ total 60 drwxr-xr-x 7 david users 4096 Nov 8 21:35 Backups drwxr-xr-x 6 david users 4096 Nov 27 18:27 builds drwxr-xr-x 2 david users 4096 Nov 5 19:09 Desktop drwx------ 2 david users 4096 Dec 27 15:11 Downloads drwxrwxrwx 202 david users 12288 Jan 10 12:16 Movies drwx------ 143 david users 4096 Jan 4 21:18 Music drwxrwxr-x 11 david users 4096 Jan 2 22:08 MythTV drwxr-xr-x 6 david users 4096 Jan 4 12:09 Photos drwxr-xr-x 2 david users 4096 Nov 15 18:12 Public drwxr-xr-x 3 david users 4096 Jan 4 17:20 scripts drwxr-xr-x 33 david users 4096 Jan 10 12:16 TVseries drwxr-xr-x 2 david users 4096 Jan 10 12:16 Videos $ ls -l MythTV/ total 32 drwxrwxr-x 2 david users 4096 Nov 10 15:53 Artwork drwxrwxr-x 2 david users 4096 Jan 10 12:16 Banners drwxrwxr-x 2 david users 4096 Jan 10 12:16 Coverart drwxrwxr-x 2 david users 4096 Jan 10 12:16 DBbackups drwxrwxr-x 2 david users 4096 Jan 10 12:16 Fanart drwxrwxr-x 2 david users 4096 Jan 9 13:33 Playback_Logs drwxrwxr-x 5 david users 58 Dec 23 15:32 Recordings drwxrwxr-x 2 david users 4096 Jan 10 12:16 Screenshots drwxrwxr-x 2 david users 4096 Jan 10 12:16 Trailers $ ls -l MythTV/Recordings/ total 28 drwxrwxrwx 2 david users 36 Jan 10 12:16 LiveTV drwxrwxr-x 2 david users 24576 Jan 10 12:16 mythRecordings
As for groups, users 'mythtv' and 'david' belong to exactly the same groups.
$ cat /etc/group | grep mythtv lp:x:7:daemon,david,mythtv wheel:x:10:root,david,mythtv log:x:19:root,david,mythtv http:x:33:david,mythtv games:x:50:david,mythtv video:x:91:david,xbmc,mythtv audio:x:92:david,xbmc,mythtv optical:x:93:david,xbmc,mythtv storage:x:95:david,xbmc,mythtv power:x:98:david,xbmc,mythtv users:x:100:david,http,mythtv mythtv:x:1001:
That error message has got me stumped, permissions are granted for all users to write in that folder.
Last edited by farmerdave (2013-01-10 06:06:30)
Shouldn't I be able to logout of 'david' Xsession and log into 'mythtv' Xsession? At the moment I cannot, and I get a "failed to issue login command" error. Everything seems to be there though.
$ ls -al /home/mythtv/ total 36 drwxr-xr-x 3 mythtv users 4096 Nov 5 22:13 . drwxr-xr-x 5 root root 4096 Nov 5 22:10 .. -rw------- 1 mythtv users 74 Nov 5 22:13 .bash_history -rw-r--r-- 1 mythtv users 21 Nov 3 12:01 .bash_logout -rw-r--r-- 1 mythtv users 57 Nov 3 12:01 .bash_profile -rw-r--r-- 1 mythtv users 141 Nov 3 12:01 .bashrc drwxr-xr-x 2 mythtv users 4096 Nov 5 22:12 .mythtv -rwxr-xr-x 1 mythtv users 310 Jan 10 12:53 .xinitrc -rw-r--r-- 1 mythtv users 100 Oct 31 10:40 .xsession
$ cat /home/mythtv/.xinitrc #!/bin/sh # # ~/.xinitrc # # Executed by startx (run your window manager from here) if [ -d /etc/X11/xinit/xinitrc.d ]; then for f in /etc/X11/xinit/xinitrc.d/*; do [ -x "$f" ] && . "$f" done unset f fi # exec gnome-session # exec startkde exec startxfce4 # ...or the Window Manager of your choice
Last edited by farmerdave (2013-01-10 02:42:33)
What messages are there in dmesg about firmware?
$ sudo dmesg | grep saa [ 3.586601] saa7164 driver loaded [ 3.587094] CORE saa7164: subsystem: 0070:8940, board: Hauppauge WinTV-HVR2200 [card=9,insmod option] [ 3.587098] saa7164/0: found at 0000:02:00.0, rev: 129, irq: 16, latency: 0, mmio: 0xfd400000 [ 3.723370] saa7164_downloadfirmware() no first image [ 3.723453] saa7164_downloadfirmware() Waiting for firmware upload (NXP7164-2010-03-10.1.fw) [ 3.917738] saa7164_downloadfirmware() firmware read 4019072 bytes. [ 3.917743] saa7164_downloadfirmware() firmware loaded. [ 3.917752] saa7164_downloadfirmware() SecBootLoader.FileSize = 4019072 [ 3.917757] saa7164_downloadfirmware() FirmwareSize = 0x1fd6 [ 3.917761] saa7164_downloadfirmware() BSLSize = 0x0 [ 3.917763] saa7164_downloadfirmware() Reserved = 0x0 [ 3.917764] saa7164_downloadfirmware() Version = 0x1661c00 [ 9.900030] saa7164_downloadimage() Image downloaded, booting... [ 10.003375] saa7164_downloadimage() Image booted successfully. [ 11.890028] saa7164_downloadimage() Image downloaded, booting... [ 13.750046] saa7164_downloadimage() Image booted successfully. [ 13.796995] saa7164: Hauppauge eeprom: model=89619 [ 14.099557] DVB: registering new adapter (saa7164) [ 16.643453] DVB: registering new adapter (saa7164) [ 16.644352] saa7164: registered device video0 [mpeg] [ 16.874992] saa7164: registered device video1 [mpeg] [ 17.085876] saa7164: registered device vbi0 [vbi] [ 17.086004] saa7164: registered device vbi1 [vbi]
Dave, did you figure anything further on this problem?
I have made the following changes, and the system works.
$ cat /usr/lib/systemd/system/mythbackend.service [Unit] Description=MythTV Backend After=network.target mysqld.service Wants=dev-dvb-adapter0-frontend0.device After=dev-dvb-adapter0-frontend0.device Wants=dev-dvb-adapter1-frontend0.device After=dev-dvb-adapter1-frontend0.device [Service] Type=simple Environment=HOME=/var/lib/mythtv User=david ExecStart=/usr/bin/mythbackend --logpath /var/log/mythtv ExecStop=/usr/bin/mythshutdown --setscheduledwakeup #ExecStop=/usr/bin/mythshutdown --shutdown [Install] WantedBy=multi-user.target
Simply by using 'david' as the user and telling Mythbackend to wait for the adapters, I have access to all my old recordings, and can make new recordings fine. If I change the user to 'mythtv' it fails. So I recently updated my system and a mythtv update happened, all I needed to do was correct the file /usr/lib/systemd/system/mythbackend.service and I was running fine again.
Thanks for all your help throughout this, wouldn't have discovered how to get it working without the help.
I'm going to keep tinkering and try to get it working for a dedicated 'mythtv' user too. I think that when I installed MythTV the user was created for me, rather than me doing it. Home directory was created in /var/lib but I also have a /home/mythtv folder. Wondering if this has broken some paths in MythTV?
$ cat /etc/passwd | grep mythtv mythtv:x:1001:1001::/var/lib/mythtv:/bin/bash $ ls -al /home/ | grep mythtv drwxr-xr-x 4 mythtv users 4096 Jan 14 09:09 mythtv $ ls -al /var/lib/ | grep mythtv drwxr-xr-x 4 root root 4096 Jan 15 09:59 mythtv
Also, shouldn't the permissions/ownership on /var/lib/mythtv be different? Because if I change to user 'mythtv' on the command line and change directory to the home directory /var/lib/mythtv I cannot create any new files or folders within it.
Last edited by farmerdave (2013-01-19 05:04:26)
Copy the mythbackend.service and make changes to /etc/systemd/system/mythbackend.service which overrides the file in /usr/lib/. This way upgrades won't overwrite it. You can then restore the stock file in /usr/lib/ and see the config changes you make with systemd-delta.
I can't pinpoint exactly how the mythtv user is failing for you, but start with a chown -R mythtv:users /var/lib/mythtv, or if you prefer /home/mythtv, change it in /etc/passwd and the Environment=HOME line.
Once you have made your changes, do systemctl --system daemon-reload and systemctl restart mythbackend, or just reboot.