Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 690120 - media-tv/tvheadend-4.2.8 xmltv.sock and tvheadend.pid are missing when using systemd
Summary: media-tv/tvheadend-4.2.8 xmltv.sock and tvheadend.pid are missing when using ...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: James Le Cuirot
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-18 05:22 UTC by James Chew
Modified: 2021-05-27 17:16 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
systemd service file for tvheadend (tvheadend.service,352 bytes, text/plain)
2019-08-06 06:47 UTC, James Chew
Details

Note You need to log in before you can comment on or make changes to this bug.
Description James Chew 2019-07-18 05:22:09 UTC
I enabled the External: XMLTV EPG Grabber. This should create a socket at /etc/tvheadend/epggrab/xmltv.sock

When using OpenRC, the /etc/tvheadend/epggrab/xmltv.sock is created.

When using systemd, the following issues are encountered:
1. /etc/tvheadend/epggrab/xmltv.sock is NOT created.
2. /run/tvheadend/tvheadend.pid file is NOT created.

Logs as follows:
Jul 18 13:13:31 raptor systemd[1]: Started tvheadend.
Jul 18 13:13:31 raptor tvheadend[22903]: 2019-07-18 13:13:31.669 [   INFO] main: Log started
Jul 18 13:13:31 raptor tvheadend[22903]: 2019-07-18 13:13:31.669 [   INFO] tcp: No systemd socket: creating a new one
Jul 18 13:13:31 raptor tvheadend[22903]: 2019-07-18 13:13:31.669 [   INFO] http: Starting HTTP server 0.0.0.0:9981
Jul 18 13:13:31 raptor tvheadend[22903]: 2019-07-18 13:13:31.669 [   INFO] tcp: No systemd socket: creating a new one
Jul 18 13:13:31 raptor tvheadend[22903]: 2019-07-18 13:13:31.669 [   INFO] htsp: Starting HTSP server 0.0.0.0:9982
Jul 18 13:13:31 raptor tvheadend[22903]: 2019-07-18 13:13:31.676 [   INFO] config: loaded
Jul 18 13:13:31 raptor tvheadend[22903]: 2019-07-18 13:13:31.676 [   INFO] config: scanfile (re)initialization with path <none>
Jul 18 13:13:32 raptor tvheadend[22903]: 2019-07-18 13:13:32.330 [   INFO] scanfile: DVB-S - loaded 1 regions with 113 networks
Jul 18 13:13:32 raptor tvheadend[22903]: 2019-07-18 13:13:32.330 [   INFO] scanfile: DVB-T - loaded 44 regions with 1111 networks
Jul 18 13:13:32 raptor tvheadend[22903]: 2019-07-18 13:13:32.330 [   INFO] scanfile: DVB-C - loaded 17 regions with 58 networks
Jul 18 13:13:32 raptor tvheadend[22903]: 2019-07-18 13:13:32.330 [   INFO] scanfile: ATSC-T - loaded 2 regions with 13 networks
Jul 18 13:13:32 raptor tvheadend[22903]: 2019-07-18 13:13:32.330 [   INFO] scanfile: ATSC-C - loaded 1 regions with 5 networks
Jul 18 13:13:32 raptor tvheadend[22903]: 2019-07-18 13:13:32.330 [   INFO] scanfile: ISDB-T - loaded 2 regions with 1669 networks
Jul 18 13:13:34 raptor tvheadend[22903]: 2019-07-18 13:13:34.405 [   INFO] linuxdvb: adapter added /dev/dvb/adapter3
Jul 18 13:13:34 raptor tvheadend[22903]: 2019-07-18 13:13:34.405 [   INFO] linuxdvb: adapter 3 setting exclusive flag
Jul 18 13:13:36 raptor tvheadend[22903]: 2019-07-18 13:13:36.477 [   INFO] linuxdvb: adapter added /dev/dvb/adapter2
Jul 18 13:13:36 raptor tvheadend[22903]: 2019-07-18 13:13:36.477 [   INFO] linuxdvb: adapter 2 setting exclusive flag
Jul 18 13:13:38 raptor tvheadend[22903]: 2019-07-18 13:13:38.589 [   INFO] linuxdvb: adapter added /dev/dvb/adapter1
Jul 18 13:13:38 raptor tvheadend[22903]: 2019-07-18 13:13:38.589 [   INFO] linuxdvb: adapter 1 setting exclusive flag
Jul 18 13:13:40 raptor tvheadend[22903]: 2019-07-18 13:13:40.725 [   INFO] linuxdvb: adapter added /dev/dvb/adapter0
Jul 18 13:13:40 raptor tvheadend[22903]: 2019-07-18 13:13:40.725 [   INFO] linuxdvb: adapter 0 setting exclusive flag
Jul 18 13:13:40 raptor tvheadend[22903]: 2019-07-18 13:13:40.799 [   INFO] dvr: Creating new configuration ''
Jul 18 13:13:40 raptor tvheadend[22903]: 2019-07-18 13:13:40.799 [   INFO] dvr: Creating new configuration 'sdtv'
Jul 18 13:13:40 raptor tvheadend[22903]: 2019-07-18 13:13:40.800 [   INFO] epggrab: module eit created
Jul 18 13:13:40 raptor tvheadend[22903]: 2019-07-18 13:13:40.800 [   INFO] epggrab: module uk_freesat created
Jul 18 13:13:40 raptor tvheadend[22903]: 2019-07-18 13:13:40.800 [   INFO] epggrab: module uk_freeview created
Jul 18 13:13:40 raptor tvheadend[22903]: 2019-07-18 13:13:40.800 [   INFO] epggrab: module nz_freeview created
Jul 18 13:13:40 raptor tvheadend[22903]: 2019-07-18 13:13:40.800 [   INFO] epggrab: module viasat_baltic created
Jul 18 13:13:40 raptor tvheadend[22903]: 2019-07-18 13:13:40.800 [   INFO] epggrab: module Bulsatcom_39E created
Jul 18 13:13:40 raptor tvheadend[22903]: 2019-07-18 13:13:40.800 [   INFO] epggrab: module psip created
Jul 18 13:13:40 raptor tvheadend[22903]: 2019-07-18 13:13:40.802 [   INFO] epggrab: module opentv-ausat created
Jul 18 13:13:40 raptor tvheadend[22903]: 2019-07-18 13:13:40.802 [   INFO] epggrab: module opentv-skyit created
Jul 18 13:13:40 raptor tvheadend[22903]: 2019-07-18 13:13:40.802 [   INFO] epggrab: module opentv-skynz created
Jul 18 13:13:40 raptor tvheadend[22903]: 2019-07-18 13:13:40.802 [   INFO] epggrab: module opentv-skyuk created
Jul 18 13:13:40 raptor tvheadend[22903]: 2019-07-18 13:13:40.803 [   INFO] epggrab: module pyepg created
Jul 18 13:13:40 raptor tvheadend[22903]: 2019-07-18 13:13:40.803 [   INFO] epggrab: module xmltv created
Jul 18 13:13:40 raptor tvheadend[22903]: 2019-07-18 13:13:40.806 [  ERROR] xmltv: xmltv: failed to bind socket
Jul 18 13:13:40 raptor tvheadend[22903]: 2019-07-18 13:13:40.861 [ NOTICE] START: HTS Tvheadend version 4.2.8 started, running as PID:22903 UID:109 GID:27, CWD:/ CNF:/etc/tvheadend

#  ls -la /run/tvheadend
total 0
drwxr-xr-x  2 tvheadend video  40 Jul 18 13:13 .
drwxr-xr-x 14 root      root  460 Jul 18 13:13 ..
Comment 1 James Chew 2019-07-18 05:36:21 UTC
The /etc/tvheadend/epggrab/xmltv.sock can be created when I start tvheadend from the command line (hence the problem is when it's started as a systemd service):

# /usr/bin/tvheadend -u tvheadend -g video -c /etc/tvheadend
2019-07-18 13:29:40.160 [   INFO] main: Log started
2019-07-18 13:29:40.161 [   INFO] tcp: No systemd socket: creating a new one
2019-07-18 13:29:40.161 [   INFO] http: Starting HTTP server 0.0.0.0:9981
2019-07-18 13:29:40.161 [   INFO] tcp: No systemd socket: creating a new one
2019-07-18 13:29:40.161 [   INFO] htsp: Starting HTSP server 0.0.0.0:9982
2019-07-18 13:29:40.168 [   INFO] config: loaded
2019-07-18 13:29:40.168 [   INFO] config: scanfile (re)initialization with path <none>
2019-07-18 13:29:40.803 [   INFO] scanfile: DVB-S - loaded 1 regions with 113 networks
2019-07-18 13:29:40.803 [   INFO] scanfile: DVB-T - loaded 44 regions with 1111 networks
2019-07-18 13:29:40.803 [   INFO] scanfile: DVB-C - loaded 17 regions with 58 networks
2019-07-18 13:29:40.803 [   INFO] scanfile: ATSC-T - loaded 2 regions with 13 networks
2019-07-18 13:29:40.803 [   INFO] scanfile: ATSC-C - loaded 1 regions with 5 networks
2019-07-18 13:29:40.803 [   INFO] scanfile: ISDB-T - loaded 2 regions with 1669 networks
2019-07-18 13:29:42.761 [   INFO] linuxdvb: adapter added /dev/dvb/adapter3
2019-07-18 13:29:42.761 [   INFO] linuxdvb: adapter 3 setting exclusive flag
2019-07-18 13:29:44.833 [   INFO] linuxdvb: adapter added /dev/dvb/adapter2
2019-07-18 13:29:44.833 [   INFO] linuxdvb: adapter 2 setting exclusive flag
2019-07-18 13:29:47.009 [   INFO] linuxdvb: adapter added /dev/dvb/adapter1
2019-07-18 13:29:47.010 [   INFO] linuxdvb: adapter 1 setting exclusive flag
2019-07-18 13:29:49.187 [   INFO] linuxdvb: adapter added /dev/dvb/adapter0
2019-07-18 13:29:49.187 [   INFO] linuxdvb: adapter 0 setting exclusive flag
2019-07-18 13:29:49.253 [   INFO] dvr: Creating new configuration ''
2019-07-18 13:29:49.253 [   INFO] dvr: Creating new configuration 'sdtv'
2019-07-18 13:29:49.254 [   INFO] epggrab: module eit created
2019-07-18 13:29:49.254 [   INFO] epggrab: module uk_freesat created
2019-07-18 13:29:49.254 [   INFO] epggrab: module uk_freeview created
2019-07-18 13:29:49.254 [   INFO] epggrab: module nz_freeview created
2019-07-18 13:29:49.254 [   INFO] epggrab: module viasat_baltic created
2019-07-18 13:29:49.254 [   INFO] epggrab: module Bulsatcom_39E created
2019-07-18 13:29:49.254 [   INFO] epggrab: module psip created
2019-07-18 13:29:49.256 [   INFO] epggrab: module opentv-ausat created
2019-07-18 13:29:49.256 [   INFO] epggrab: module opentv-skyit created
2019-07-18 13:29:49.257 [   INFO] epggrab: module opentv-skynz created
2019-07-18 13:29:49.257 [   INFO] epggrab: module opentv-skyuk created
2019-07-18 13:29:49.257 [   INFO] epggrab: module pyepg created
2019-07-18 13:29:49.257 [   INFO] epggrab: module xmltv created
2019-07-18 13:29:49.259 [   INFO] xmltv: xmltv: external socket enabled
2019-07-18 13:29:49.311 [   INFO] epgdb: gzip format detected, inflating (ratio 72.3% deflated size 138)
2019-07-18 13:29:49.312 [   INFO] epgdb: parsing 191 bytes
2019-07-18 13:29:49.312 [   INFO] epgdb: loaded v2
2019-07-18 13:29:49.312 [   INFO] epgdb:   config     1
2019-07-18 13:29:49.312 [   INFO] epgdb:   brands     0
2019-07-18 13:29:49.312 [   INFO] epgdb:   seasons    0
2019-07-18 13:29:49.312 [   INFO] epgdb:   episodes   0
2019-07-18 13:29:49.312 [   INFO] epgdb:   broadcasts 0
2019-07-18 13:29:49.312 [ NOTICE] START: HTS Tvheadend version 4.2.8 started, running as PID:23153 UID:109 GID:27, CWD:/lib/systemd/system CNF:/etc/tvheadend

# ls -la /etc/tvheadend/epggrab
total 4
drwx------ 1 tvheadend video   54 Jul 18 13:33 .
drwx------ 1 tvheadend video  226 Jul 18 13:32 ..
-rw------- 1 tvheadend video 2293 Feb  1 14:16 config
drwx------ 1 tvheadend video 7616 Jul 18 13:13 otamux
drwx------ 1 tvheadend video   16 Feb  8 15:17 xmltv
srwxr-xr-x 1 tvheadend video    0 Jul 18 13:29 xmltv.sock
Comment 2 James Le Cuirot gentoo-dev 2019-08-04 11:43:37 UTC
I don't use systemd on Gentoo and I only run tvheadend on one system that isn't capable of running systemd at all. I also don't use XMLTV. I'd therefore be very grateful if you could suggest a fix that works for you.
Comment 3 James Le Cuirot gentoo-dev 2019-08-04 11:45:51 UTC
Actually if I had to guess, it's the RestrictAddressFamilies entry in the unit file. It should include AF_UNIX.
Comment 4 James Chew 2019-08-06 06:47:01 UTC
Created attachment 585844 [details]
systemd service file for tvheadend
Comment 5 James Chew 2019-08-06 06:48:45 UTC
I tried a few options, but only managed to get the xmltv.sock file when I recreated the tvheadend.service file as attached.
Comment 6 James Le Cuirot gentoo-dev 2019-08-10 09:03:57 UTC
That's completely different to what we have now, even right down to the Type. Can you start with what we have and remove the lines one at a time? I would start with RestrictAddressFamilies.
Comment 7 James Chew 2019-08-10 12:56:07 UTC
(In reply to James Le Cuirot from comment #6)
> That's completely different to what we have now, even right down to the
> Type. Can you start with what we have and remove the lines one at a time? I
> would start with RestrictAddressFamilies.

Yes I started with that; deleted all the lines that I felt would have made a difference, specifically:
DevicePolicy=closed
DeviceAllow=char-DVB rw
DeviceAllow=char-drm rw
RestrictAddressFamilies=AF_INET AF_INET6
ProtectSystem=yes
ProtectHome=yes
NoNewPrivileges=yes

And yet, that did not solve the problem. I.e. after starting tvheadend
/etc/tvheadend/epggrab/xmltv.sock is missing
/run/tvheadend/tvheadend.pid file is missing

Thus, I ended up taking the developer's systemd service file, modified from there and it works.