Tvheadend HTSP Client Access Denied, a fix?

Hi guys, I’ve been eagerly waiting for the latest CoreELEC 8.95.1, hoping that it would fix issues I’ve been having with Tvheadend not working since about release 8.90.3. I think I might have a fix, or at least a workaround.

First I’ll give you a heads up on my setup. I’m currently using a K-III Pro, and I loaded 8.95.1 onto an SD card. After booting up CoreELEC, I installed from the CoreELEC add-ons repository the Tvheadend service and client add-ons.

I would immediately get the Access Denied messages. After 3 nights of hacking I have finally stumbled across the reason for the Access Denied messages and Tvheadend now works like an out of the box product.

Now to get to the point, when setting up CoreELEC I chose to give it a static IP address of 192.108.1.7
I found that whilst configuring the Tvheadend HTSP Client, if I set the Tvheadend hostname or IP address, to 192.108.1.7 then Tvheadend would spring to life, and I’d be watching TV. On the other hand if I set this IP address to the default 127.0.0.1 it would instantly stop working. I tried this multiple times.

I’m basically raising this posting in case it may help others who might have the same problem. Just bare in mind that this fix is effective in my network environment, and there is no guarantee that it will work for you. I don’t claim to fully understand why or how it works.

I give my devices a static ip. I then install the tvh server (backend)

then I configure the client with the server ip address with a user name & password.

didn’t occur to me to use the default ip of 127 etc

Yeh, I do the same thing now as well. It just so happens that the K-III Pro has the DVB-T tuners in the same box. I think the default IP is supposed to save you some effort. I haven’t tested it but it probably works as it should if I use it with DHCP :slight_smile:

you might be right about dchp, but dhcp is no good for your library if it changes

true, I was always giving the box a static IP address, from way back starting with xbmc on the xbox. But in those days I didn’t have Tvheadend.

I’m thinking that leaving the client with the 127 loopback or local address should work in my case?

But maybe I’m wrong? :frowning:

BTW, CoreELEC is a fantastic piece of software for my S912 device. If I had more hours in the day, I’d be playing with the source code. I’m eagerly waiting for developments with firmware for the hardware codec.

1 Like

Did you configure a TVH user, who is allowed to connect from 127.0.0.1?

But most confusing is your local network subnet.
192.108.0.0/16 is not a private network and therefore routable across the internet.
Most probably addresses from this network are already used for some public hosts.
You should really consider to re-IP your whole network, because sooner or later this setup will cause problems.

The networks, you could use are the following ones:
10.0.0.0/8
172.16.0.0/12
192.168.0.0/16

Actually, I’m using 192.168.0.0/24. The IP address of the TVH server is the same as the CoreELEC box as it’s all in the same box for the K-III Pro. I just thought it might be a good idea to change the network I was quoting for privacy in this thread. A silly idea now that I think about it.

The 127.0.0.1 is the default address that the TVH client is given when I installed the TVH client add-on. I thought that it was OK to leave it, as it was all in the same box.

Okay, then your network setup should be correct.
There is no need to anonymize it in posts, because the majority of all users are using the same subnet. :wink:

yeh I agree. I’m not an expert in networking, but I think the real problem here is that the default 127.0.0.1 that the TVH client was given, did not work as it should. I was only able to get TVH working once I gave it the static IP address of the TVH server (which happens to be in the same box).

I wonder if I possibly should be raising a bug report here? I’m happy to raise one if it helps? The symptoms are easy to reproduce. If I’m correct then anybody with a K-III Pro should be able to easily reproduce it? In hindsight, I probably should have known better?

have you tried ‘localhost’ in place of the ‘127.0.0.1’?
I wonder if that too is affected?

good question. I just tried localhost, and same problem. No TV and I get the Access Denied message.

1 Like

So if you select a static IP on the box, you need to specify that IP in the settings.

But if you set the static IP on the router and use DHCP to get that IP on the box, then localhost/127. … will work ok.

Does that cover what you have found?

IMO, it is preferable to set the static IPs on the router.

I didn’t actually test the second scenario. I usually only use DHCP for mobile phones etc.

For most of my other devices I like to use static IP addresses. I’ve got two K-III Pro boxes each with it’s own static IP address. The only way I can connect the TVH HTSP Client to it’s respective server, is by telling it the static IP address of the box (and hence the address of that TVH Server). I could probably cross over the client and server combination if I wanted to. If I leave the default setting on the TVH client, i.e. 127.0.0.1 then I have no connection and I can’t watch TV.

It did this when only one box was powered up and configured, and it does exactly the same thing when both boxes are powered up and configured.

I think a skilled network guy could probably steer me in the right direction. To be honest with you, I’m just happy that both boxes now work. I’ve been struggling with them for a couple of months now. I’m sure that some others will fall into the same traps that I’ve fallen into, so I’m hoping that this thread may be useful.

actually, I just re-read your question. I believe in the second scenario you describe the case where the static IP addresses are handed out to certain devices based on MAC address.

I think that in my case I have simply configured certain addresses that are programmed into certain devices and the router will hand out dynamic addresses (within a range) to other devices which are enabled for DHCP.

I would tell you exactly how the router is configured, but my crummy ADSL connection died today after some rain overnight. I don’t even have a phone line at the moment.

You have raised some interesting doubt in my mind. It’s possible that my network arrangement needs to be thought out more carefully, and is contributing to the problem. I do recall setting things up in the way you describe a couple of years ago, but it didn’t seem to be reliable so I moved away from it. I may try that arrangement again once my network is back to normal. It does sound like a better way to set it up.

ok, I had to check the second scenario you described above. I got Into the router and reserved IP address 192.168.0.8 for the MAC address of one of my K-III Pro boxes. I then got into that K-III Pro box, and reset the IP Address Method to DHCP. I rebooted the K-III Pro box for good luck and checked that the IP address of the box was 192.168.0.8. I then got into Connection settings for the TVH HTSP Client and tried, (1) 192.168.0.8, (2) 127.0.0.1 and (3) localhost.

case (1) worked as expected and I could watch TV. however for cases (2) and (3), the client could not find the server and no TV, Access denied. So I can say with some relief, that the second scenario does not work in my network, although I like the idea of prearranging static addresses in the router (all in one place).

My problems in the past with doing this may have stemmed from myself setting up the same static address both in the router, and also in the device whose address I was making static. I didn’t know that I could use DHCP to allocate reserved static addresses, whilst leaving each device with default DHCP settings.

Most routers are set to issue addresses within a range … say 10 to 100 which is user configurable … and it would be preferable to set the static ones outside that range, or so I read, but never had to do that myself.
I guess it might be router function dependent.

yeh, I thought I’d better double check my router settings. I had the DHCP IP Address Range set to 2 to 254. It doesn’t seem to care that I have a bunch of devices with static IP addresses between 2 and 12 set up in each device.

just as an experiment, I decided to continue with where I had left off last night. The K-III Pro box is currently set up with DHCP, and the router has an association set up between the K-III Pro box’s MAC address and 192.168.0.8

I then changed the DHCP IP Address Range set up in the router to 10 to 254. I rebooted the router and the K-III Pro box and repeated the tests from last night, (1) 192.168.0.8, (2) 127.0.0.1 and (3) localhost.

There was no change. 127.0.0.1 and localhost does not work. I would suggest that it is broken (or perhaps never worked). The client could not find the server, even though they are both in the same box.

I think if we could move on with this theme, are there any other people out there using CoreELEC 8.95.1 on a K-III Pro box, who could confirm these results?

Did you check the user permissions in the TVH server like I asked earlier?
If you want to connect to 127.0.0.1 from the same box, the connection is also established from 127.0.0.1.
Therefore you need a TVH user, who is allowed to connect either from 127.0.0.1/32 or from 0.0.0.0/0:

This user also needs to be configured in the TVH addon, of course.

1 Like

let me have a closer look. I’ve never tampered with Allowed networks via the web interface. thanks for the picture :slight_smile: