TVheadend container - cannot connect no matter what I try

Hello, I’m having issues with this specific container. I am not new to docker, I use all my images from linuxserver, but this one is really problematic. The container itself it seems to be working correctly, just I cannot connect to the interface no matter what I do.

docker exec tvheadend ls -l /dev/dri
total 0
crw-rw---- 1 root videozyzwup3q 226,   0 Jan  3 11:41 card0
crw-rw---- 1 root videozyzwup3q 226, 128 Jan  3 11:41 renderD128

I tried with and without reverse proxy, but I cannot connect to the interface.

This is my part of my docker compose, I also add my plex config which also is on the host network and it works without problems:

version: '3'

services:
  ReverseProxy:
    image: linuxserver/letsencrypt
    restart: unless-stopped
    #logging:
    # driver: "none"
    ports:
      - "4480:80"
      - "4443:443"
    volumes:
      - /sharedfolders/mediatools/letsencrypt:/config
    cap_add:
      - NET_ADMIN      
    networks:
      - media
    container_name: ReverseProxy
    environment:
      - PUID=1001 # get on dockerhost through command "id <user>""
      - PGID=100
      - EMAIL=my@email.net
      - URL=host.net
      - SUBDOMAINS=www,ds,plex,bazarr,nextcloud,tvheadend,heimdall,tautulli,sonarr,radarr,ombi,rutorrent,nzbget,jackett,mariadb
      - TZ=Europe/Bucharest
      - VALIDATION=dns # using dns validation
      - DNSPLUGIN=cloudflare # via dnsimple, note there is additional configuration require separate from this file
      # - STAGING=true # this should be uncommented when testing for initial success, to avoid some rate limiting
    
  plex:
    depends_on:
      - ReverseProxy  
    image: linuxserver/plex
    restart: unless-stopped
    network_mode: host    
    environment:
      - TZ=Europe/Bucharest    
      - PUID=1001
      - PGID=100
      - VERSION=public
    volumes:
      - /sharedfolders/mediatools/plex:/config
      - /sharedfolders/Media/TV:/data/tvshows
      - /sharedfolders/Media/Movies:/data/movies
      - /sharedfolders/Media/Music:/data/music  
      - /sharedfolders/Media/Cartoons:/data/cartoons      
      - /sharedfolders/mediatools/plex/transcode:/transcode
    devices:
      - /dev/dri:/dev/dri
    container_name: plex

  tvheadend:
    depends_on:
      - ReverseProxy 
    image: linuxserver/tvheadend
    restart: unless-stopped
    network_mode: host
    environment:
      - TZ=Europe/Bucharest
      - PUID=1001
      - PGID=100
      #- RUN_OPTS="-f --http_root /tvh"
    volumes:
      - /sharedfolders/mediatools/tvheadend:/config
      - /sharedfolders/Media/RECORDINGS:/recordings
    ports:
      - 9981:9981
      - 9982:9982
    devices:
      - /dev/dri:/dev/dri #optional
      #- /dev/dvb:/dev/dvb #optional
    container_name: tvheadend

networks:
      media:

These are the logs:

All other containers are working as they should. As said, I also tried with the reverse proxy (added the args - RUN_OPTS="–http_root /tv" to specify the alternative http webroot, otherwise I got a 502 bad gateway) this was my conf, but here I got the error with “Welcome to Nginx!” blank page:

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name tvheadend.*;

    include /config/nginx/ssl.conf;

    location /tv {
        include /config/nginx/proxy.conf;
	resolver 127.0.0.11 valid=30s;
        set $upstream_tvheadend tvheadend;
	proxy_pass http://192.168.1.151:9981;
		
	proxy_set_header Host $host;
	proxy_set_header X-Real-IP $remote_addr;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection "upgrade";
    }
}

If I try directly without reverse proxy to connect to hostip(192.168.1.151):9981 it never do anything, and with reverseproxy https://tvheadend.host.net/ it gives the Welcome to nginx blank screen, comparatively plex works - hostip(192.168.1.151):32400 takes me to plex.

I have also opened ports 9981 and 9982 to my router, nothing works.
Any suggestions? Thank you! I googled everything, no solution for me.

=======================

LE: After further investigation, when I change the webroot (per their FAQS: https://github.com/tvheadend/tvheadend/blob/master/docs/markdown/faqs.md#q-access-tvheadend-through-http-proxy) with:

  - RUN_OPTS=--http_root /tv

I have the following logs, keep spawning. What more arguments do I need to ad?

s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-envfile: executing...
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 10-adduser: executing...

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/


Brought to you by linuxserver.io
We gratefully accept donations at:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid:    1001
User gid:    100
-------------------------------------

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 30-config: executing...
Setting permissions
[cont-init.d] 30-config: exited 0.
[cont-init.d] 50-gid-video: executing...
[cont-init.d] 50-gid-video: exited 0.
[cont-init.d] 99-custom-files: executing...
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Usage: /usr/bin/tvheadend [OPTIONS]

Generic options

  -h, --help                  Show this page
  -v, --version               Show version information

Service configuration

  -c, --config                Alternate configuration path
  -B, --nobackup              Don't backup configuration tree at upgrade
  -f, --fork                  Fork and run as daemon
  -u, --user                  Run as user
  -g, --group                 Run as group
  -p, --pid                   Alternate PID path
  -C, --firstrun              If no user account exists then create one with
                              no username and no password. Use with care as
                              it will allow world-wide administrative access
                              to your Tvheadend installation until you create or edit
                              the access control from within the Tvheadend web interface.
  -a, --adapters              Only use specified DVB adapters (comma-separated, -1 = none)
      --satip_bindaddr        Specify bind address for SAT>IP server
      --satip_rtsp            SAT>IP RTSP port number for server
                              (default: -1 = disable, 0 = webconfig, standard port is 554)
      --nosatip               Disable SAT>IP client
      --satip_xml             URL with the SAT>IP server XML location

Server connectivity

  -6, --ipv6                  Listen on IPv6
  -b, --bindaddr              Specify bind address
      --http_port             Specify alternative http port
      --http_root             Specify alternative http webroot
      --htsp_port             Specify alternative htsp port
      --htsp_port2            Specify extra htsp port
      --useragent             Specify User-Agent header for the http client
      --xspf                  Use XSPF playlist instead of M3U

Debug options

  -d, --stderr                Enable debug on stderr
  -n, --nostderr              Disable debug on stderr
  -s, --syslog                Enable debug to syslog
  -S, --nosyslog              Disable syslog (all messages)
  -l, --logfile               Enable debug to file
      --debug                 Enable debug subsystems
      --trace                 Enable trace subsystems
      --subsystems            List subsystems
      --fileline              Add file and line numbers to debug
      --threadid              Add the thread ID to debug
      --libav                 More verbose libav log
      --uidebug               Enable web UI debug (non-minified JS)
  -A, --abort                 Immediately abort
  -D, --dump                  Enable coredumps for daemon
      --noacl                 Disable all access control checks
      --nobat                 Disable DVB bouquets
  -j, --join                  Subscribe to a service permanently

Testing options

      --tsfile_tuners         Number of tsfile tuners
      --tsfile                tsfile input (mux file)
      --tprofile              Gather timing statistics for the code
      --thrdebug              Thread debugging

For more information please visit the Tvheadend website:
https://tvheadend.org
Usage: /usr/bin/tvheadend [OPTIONS]

Generic options

  -h, --help                  Show this page
  -v, --version               Show version information

Service configuration

  -c, --config                Alternate configuration path
  -B, --nobackup              Don't backup configuration tree at upgrade
  -f, --fork                  Fork and run as daemon
  -u, --user                  Run as user
  -g, --group                 Run as group
  -p, --pid                   Alternate PID path
  -C, --firstrun              If no user account exists then create one with
                              no username and no password. Use with care as
                              it will allow world-wide administrative access
                              to your Tvheadend installation until you create or edit
                              the access control from within the Tvheadend web interface.
  -a, --adapters              Only use specified DVB adapters (comma-separated, -1 = none)
      --satip_bindaddr        Specify bind address for SAT>IP server
      --satip_rtsp            SAT>IP RTSP port number for server
                              (default: -1 = disable, 0 = webconfig, standard port is 554)
      --nosatip               Disable SAT>IP client
      --satip_xml             URL with the SAT>IP server XML location

Server connectivity

  -6, --ipv6                  Listen on IPv6
  -b, --bindaddr              Specify bind address
      --http_port             Specify alternative http port
      --http_root             Specify alternative http webroot
      --htsp_port             Specify alternative htsp port
      --htsp_port2            Specify extra htsp port
      --useragent             Specify User-Agent header for the http client
      --xspf                  Use XSPF playlist instead of M3U

Debug options

  -d, --stderr                Enable debug on stderr
  -n, --nostderr              Disable debug on stderr
  -s, --syslog                Enable debug to syslog
  -S, --nosyslog              Disable syslog (all messages)
  -l, --logfile               Enable debug to file
      --debug                 Enable debug subsystems
      --trace                 Enable trace subsystems
      --subsystems            List subsystems
      --fileline              Add file and line numbers to debug
      --threadid              Add the thread ID to debug
      --libav                 More verbose libav log
      --uidebug               Enable web UI debug (non-minified JS)
  -A, --abort                 Immediately abort
  -D, --dump                  Enable coredumps for daemon
      --noacl                 Disable all access control checks
      --nobat                 Disable DVB bouquets
  -j, --join                  Subscribe to a service permanently

Testing options

      --tsfile_tuners         Number of tsfile tuners
      --tsfile                tsfile input (mux file)
      --tprofile              Gather timing statistics for the code
      --thrdebug              Thread debugging

For more information please visit the Tvheadend website:
https://tvheadend.org
Usage: /usr/bin/tvheadend [OPTIONS]

Generic options

  -h, --help                  Show this page
  -v, --version               Show version information

Service configuration

  -c, --config                Alternate configuration path
  -B, --nobackup              Don't backup configuration tree at upgrade
  -f, --fork                  Fork and run as daemon
  -u, --user                  Run as user
  -g, --group                 Run as group
  -p, --pid                   Alternate PID path
  -C, --firstrun              If no user account exists then create one with
                              no username and no password. Use with care as
                              it will allow world-wide administrative access
                              to your Tvheadend installation until you create or edit
                              the access control from within the Tvheadend web interface.
  -a, --adapters              Only use specified DVB adapters (comma-separated, -1 = none)
      --satip_bindaddr        Specify bind address for SAT>IP server
      --satip_rtsp            SAT>IP RTSP port number for server
                              (default: -1 = disable, 0 = webconfig, standard port is 554)
      --nosatip               Disable SAT>IP client
      --satip_xml             URL with the SAT>IP server XML location

Server connectivity

  -6, --ipv6                  Listen on IPv6
  -b, --bindaddr              Specify bind address
      --http_port             Specify alternative http port
      --http_root             Specify alternative http webroot
      --htsp_port             Specify alternative htsp port
      --htsp_port2            Specify extra htsp port
      --useragent             Specify User-Agent header for the http client
      --xspf                  Use XSPF playlist instead of M3U

Try using bridge network instead of host to see if you can connect.
First try to get tvheadend running by itself, then try to reverse proxy it.

Did you quote around --http_root /tv ?
I see you have added an -f to the RUN_OPTS variable. Please don’t do stuff like that. It breaks the container. Remember that you have to recreate the container after making a change in the compose file. A restart is not enough.

1 Like

Thanks for the reply.
I followed your suggestion and used bridge and I can connect to the interface.
As soon as I change it to host, same error.

I checked the error log from letsencrypt this is what it outputs:

 2020/01/06 16:11:35 [error] 386#386: *6 open() "/var/lib/nginx/html/favicon.ico" failed (2: No such file or directory), client: 192.168.1.1, server: tvheadend.*, request: "GET /favicon.ico HTTP/2.0", host: "tvheadend.mydomain.net"
 2020/01/06 16:11:36 [error] 386#386: *11 open() "/var/lib/nginx/html/favicon.ico" failed (2: No such file or directory), client: 192.168.1.1, server: tvheadend.*, request: "GET /favicon.ico HTTP/2.0", host: "tvheadend.mydomain.net"
 2020/01/06 16:12:57 [error] 386#386: *5 open() "/var/lib/nginx/html/favicon.ico" failed (2: No such file or directory), client: 192.168.1.1, server: tvheadend.*, request: "GET /favicon.ico HTTP/2.0", host: "tvheadend.mydomain.net"

When I go to myip:9981 - this page cannot be displayed

And when I try to go to https://tvheadend.mydomain.net

I will give up :slight_smile:

Then there is probably a port that is already used by something else or some firewall blocking it.

I’m afraid I can’t help with the reverse proxy as I haven’t tried that.

1 Like

I feel so stupid now… I completely forgot about my openmediavault IPTABLES firewall… Thanks for pointing that out.
I opened ports and now it’s working with network: host.

I need to figure out the reverse proxy, but that shouldn’t be a problem now.
LE: solved the reverse proxy as well.
Thank you kind sir!