Problems autostarting tvheadend
Added by Anonymous over 10 years ago
Hey,
i have a problem using tvheadend. I installed raspbmc on my pi and wanted also to install a tvheadend server. If i start it using the command "tvheadend -C" via ssh it works fine and i can access the web interface a configure all setting and watch TV, but if i want to start it with "tvheadend -f" as Daemon it says that i need superuser permissions but if i start it with "sudo tvheadend -f" he requires a username an password for accessing the web interface and to stream. If I type in the username and password I added through the webinterface it still doesn't work. Also i'm not able to make tvheadend autostart.
Somebody can help me please?
Replies (5)
RE: Problems autostarting tvheadend - Added by Prof Yaffle over 10 years ago
How did you install it? All of this should be automatic if you added the .deb or installed from PPA.
Try sudo dpkg-reconfigure to reconfigure the package, assuming that's how you installed it. If it isn't, uninstall it and do it that way anyway :-)
Otherwise, su to hts or root and look at the accesscontrol rules and the superuser file in the ~/.hts/tvheadend configuration directory. They're well-documented in other posts on this forum... between them, you should see what user/password combination you should be using.
RE: Problems autostarting tvheadend - Added by Anonymous over 10 years ago
I installed it from the git source. In my home directory is a directory called ~/.hts/tvheadend/accesscontrol. There are three files inside that are called 1 , 2 and 3 but if I use those usernames it still doesn't work. Or in witch directory I have to look?
RE: Problems autostarting tvheadend - Added by Prof Yaffle over 10 years ago
That's why, then - if you did a make && make install you'll only get the base config files, but you'll miss the package configuration step that would have asked you for the superuser details.
I would recommend uninstalling and building a package, and then installing that with dpkg -i - it's much safer (trust me, I've been there).
If you want to hack it manually...
What you have is the config that's been created when you run tvheadend with -C - in effect, you're running it as yourself but without access control, hence the config is in your home directory.
If you run it as a daemon, you need to specify the user (-u hts) and group (-g video) under which the forked (-f) process should run. The config files will then be under that user... you may have created them under /home/root or similar if you've just used -f, or it may have defaulted to hts, I don't know without testing.
The accesscontrol rules apply to the web interface. You should be able to see each rule defines a different user and different permissions.
You should also have a file - superuser - in the /home/USER/.hts/tvheadend directory (USER is whichever user you're running it as) that defines the master user.
{
"username": "USERNAME,
"password": "PASSWORD"
}
RE: Problems autostarting tvheadend - Added by Anonymous over 10 years ago
Thank you a lot. When i start it as a Daemon with the -u and -g arguments it wirks fine now. I also created the superuser file. So I can run it as a Daemon now if i give these arguments. Now i want it to autostart. My /etc/init/tvheadend.conf file is:
- TVHeadend server
description "tvh"
author "none"
start on (started xbmc and enable-tvheadend)
stop on (disable-tvheadend or runlevel [!2345])
respawn
pre-start script
test -x /usr/bin/tvheadend || { stop; logger -t tvheadend "cannot execute /usr/bin/tvheadend, exiting" ; exit 1; }
modprobe dvb_hdhomerun
sleep 5
sudo userhdhomerun -f
sleep 5
end script
exec su - pi -c "/usr/bin/tvheadend -C -d"
But it doesn't work like this. DO you have an idea?
RE: Problems autostarting tvheadend - Added by Prof Yaffle over 10 years ago
I don't know raspbmc, I'm afraid. On 'buntu, the installation creates an upstart job that controls everything in init.d.
Guessing now, but looking at that script:
1. "start on (started xbmc and enable-tvheadend)" - where are these conditions defined, do you know?
2. The "exec su - pi -c...." line - does that do what you want it to? That would appear to su to user pi and run tvheadend with the -C option again, not what we looked at above.
I found this link, which may help: http://forum.stmlabs.com/showthread.php?tid=5634. However, I think you may need to dig back into raspbmc ... there's some suggestion that there's a default tvheadend.conf file you could have used, maybe created as part of a default option to enable tvheadend somewhere in the OS?
I'll need to defer to someone who knows raspbmc otherwise, I'm afraid.