Need to change user of TVHeadend service on each update of tvheadend
Added by Patrick Swayze over 10 years ago
Hello
OpenSUSE 13.1 x64 + tvheadend 3.4-1.21
User logged: htpc
Each time my system update TVheadend, I need to change my service user id to recover my TVH configuration. That's to say: I was losing my TVHeadend config each time I restarted my HTPC. I discovered (thanks to Belgarath Archilinux user member) that making a trick, this was solved (https://bbs.archlinux.org/viewtopic.php?pid=1363907#p1363907). So I need to make a
sudo nano /usr/lib/systemd/system/tvheadend.service
and change in line
ExecStart=/usr/bin/tvheadend -f -p /run/tvheadend.pid -C -u hts -g video
the user "hts" to my user "htpc". Then, I do a stop/start (cause "systemctl restart tvheadend.service" doesn't nothing) as:
systemctl stop tvheadend.service
systemctl start tvheadend.service
and my TVH config is back again. This process, is needed each time TVH is updated.
Is there any way to avoid this trick? What am I doing wrong?
Thank you
Replies (3)
RE: Need to change user of TVHeadend service on each update of tvheadend - Added by Prof Yaffle over 10 years ago
tvheadend expects to run under user hts by default.I don't know how Arch installs/updates, but it's probably as simple as that: the default config will always revert you back to user hts. It seems that you've installed under user htpc for whatever reason.
Two immediate choices that I see:
1. Live with it. Every time you update, go and edit this file. You could probably write a quick script using sed that simply finds "-u hts" and replaces it with "-u htpc" if you wanted it to be really easy, although editing one file is no big deal.
2. Go with the flow and configure as the package intends. Dump the htpc config and set a new one up under hts - you might even be able to move it over if you study the file ownership of your current config.
RE: Need to change user of TVHeadend service on each update of tvheadend - Added by Patrick Swayze over 10 years ago
Hi
I installed TVHeadend under usual user. In my case, is "htpc". As any other service, as SpiderOAK, Teamviewer or VirtualBox, as examples. All of them save his configuration under my current user, not a new one called "Dropbox" or "Teamviewer", etc. I don't know the reason why TVH daemon is started for "hts" user, and not for actual user like the other I mentioned. And as you can see, is not only with Arch Linux. Is with OpenSUSE in my case too. I configure via web interface TVH from other PC,but I think that's not related anyway with the problem.
Your first proposal was my first thought, before posting here looking for a "easy" solution for others users, but I think that's not the best way for newbies (I would like to make them migrate to Linux the easy way).
Maybe the second suggestion is easier, despite not fix the problem for others from the beginning (in the installation). I was thinking in some change in code to avoid this problem for potential users.
Thank you
RE: Need to change user of TVHeadend service on each update of tvheadend - Added by Prof Yaffle over 10 years ago
I don't know the history - it may be that hts was chosen because tvheadend was part of a bigger package (with Showtime); it may be that it was a way of controlling access to the tuners via the video group, something like that.