Two tvheadend process
Added by Manuel J. Garcia Egido over 1 year ago
Hi boys.
A short time ago I reinstalled Tvheadend, I had several problems doing it and I reinstalled several times. Everything seemed to work fine, finally, but I noticed that there were 2 tvheadend processes running, one owned by root and one owned by hts. In that state, when I entered tvheadend through the browser, I did so as root. I got it by killing one of the processes, entering the one that was active and each of them had a different configuration.
I don't think this is a normal situation and I'm trying to get it to just start as hts. Desperate, I have uninstalled Tvhedend from both apt-get and dpkg, I thought I had 2 installations of Tvheadend. Now both apt-get and dpkg report that Tvheadend is uninstalled, but it keeps starting a root-owned tvheadend process that I can't access via the web, it doesn't even give me the chance to authenticate. I understand that if I reinstall, this root process will still start and I will still have 2 processes running.
Does anyone have any idea what I can do?
Replies (31)
RE: Two tvheadend process - Added by saen acro over 1 year ago
Clean-up ;)
Maby two services running.
RE: Two tvheadend process - Added by Manuel J. Garcia Egido over 1 year ago
Hi Saen
I have a .hts folder in my user folder, several folders and files for a patched TVH installation in /var/tmp, backups of configuration in personal folders. I understand that none of this causes TVH to start with root. There is no startup script in init.d, there is a systemd service that tells TVH to run as hts and that is disabled now. The binary is still in /usr/bin. But I would like to know where I can find the instruction that tells root to start TVH.
RE: Two tvheadend process - Added by Manuel J. Garcia Egido over 1 year ago
Thank you Saen.
The result is:
emejota 5879 0.0 0.0 11660 656 pts/0 S+ 20:26 0:00 grep --color=auto tvheadend
No tvheadend process is running now. This happened after deleting a /root/.hts folder that my browser wasn't showing. Now I'm going to reinstall and see what happens.
RE: Two tvheadend process - Added by Manuel J. Garcia Egido over 1 year ago
Everything seemed fine after installing TVH : a single process owned by hts. But on reboot the process owned by root was added again. I can't figure out why this process starts. At the moment I have created a systemd that kills it and leaves only the hts one. Everything seems to be going well, although I know it's not an elegant solution.
RE: Two tvheadend process - Added by Jonas Lang over 1 year ago
Do you have more than one PPA present in your sources list. What Linux version are you using.
RE: Two tvheadend process - Added by Manuel J. Garcia Egido over 1 year ago
Thank you for your interest Jonas.
Yes, I have several repositories in my sources list, but they are all disabled.
My system is Ubuntu/Lubuntu 20.04. The version I have installed is HTS Tvheadend 4.3-2096~g02987438d-dirty which I compiled, patched and installed via dpkg. Before, as I have explained, I uninstalled what was installed both by apt-get and by dpkg.
As I also said, once they were uninstalled I deleted a .hts folder from /root, which I couldn't see in explorer, but it kept starting the process.
Now, if I delete it, when I start the computer it is recreated. I know this because the command sudo ls -l /proc/proc_pid/cwd/.hts/tvheadend/ shows me the configuration files used that are from the date and time of the reboot.
RE: Two tvheadend process - Added by Kevin Maguire over 1 year ago
What linux OS do you have?
what is output of:
pidof tvheadend pstree -halp systemctl list-units --type=service | grep tvheadend
If the "pidof tvheadend" command returns a number, say X, then also output of
lsof -p X
and output of this please (install lsof if need be)
# lsof /dev/dvb/*/* 2> /dev/null COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME tvheadend 5703 hts 25u CHR 212,0 0t0 447 /dev/dvb/adapter0/frontend0 tvheadend 5703 hts 49r CHR 212,2 0t0 449 /dev/dvb/adapter0/dvr0 tvheadend 5703 hts 51u CHR 212,1 0t0 448 /dev/dvb/adapter0/demux0 tvheadend 5703 hts 52u CHR 212,1 0t0 448 /dev/dvb/adapter0/demux0 tvheadend 5703 hts 53u CHR 212,1 0t0 448 /dev/dvb/adapter0/demux0 tvheadend 5703 hts 54u CHR 212,1 0t0 448 /dev/dvb/adapter0/demux0 tvheadend 5703 hts 55u CHR 212,1 0t0 448 /dev/dvb/adapter0/demux0
RE: Two tvheadend process - Added by Jonas Lang over 1 year ago
What method did you use to build/compile TVH. Did you use an autobuild script. I assume you used the purge command as well as the remove command when uninstalling TVH.
RE: Two tvheadend process - Added by Manuel J. Garcia Egido over 1 year ago
OK friends! I think I need to explain more.
The problem arose when trying to install an IPTV list using scripts. I think none of the scripts was installing a TVH backup for Enigma2 and I made the mistake of running it. TVH went off and could not access. From there my odyssey began. I then noticed that 2 processes were running, one owned by root and one owned by hts. Before I had installed using dpkg according to the steps that I will say next. In Synaptic it also appeared as installed, so I thought I could have two installations. I uninstalled using the apt-get and dpkg instructions and the root tvheadend process kept starting even though I couldn't access it via web. Until I deleted the .hts folder from root and it didn't show up again.
I installed TVH with dpkg following these instructions from the Linixsat forum:
On Debian 11.5 / Ubuntu 20.04.5 you should be able to compile TVH and build a *.deb package by following below exemplary steps.
Of course, libdvbcsa should be patched already and libdvbcsa-dev shall be uninstalled.
If not already uninstalled, do it at first:
Code
1.sudo apt-get purge libdvbcsa-dev -y
2.sudo apt autoremove -y
Next, git clone TVH, patch and compile:
Code
1.mkdir /var/tmp/tvheadend
2.git clone https://github.com/tvheadend/tvheadend.git /var/tmp/tvheadend
3.cd /var/tmp/tvheadend
4.git config apply.whitespace nowarn
5.git apply /var/tmp/patches/tvheadend/tvheadend43.patch
6../configure --disable-ffmpeg_static --disable-libfdkaac_static --disable-libtheora_static --disable-libopus_static --disable-libvorbis_static --disable-libvpx_static --disable-libx264_static --disable-libx265_static --disable-libfdkaac --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --disable-avahi --disable-dbus_1 --disable-bintray_cache --disable-execinfo --disable-hdhomerun_static --disable-hdhomerun_client --enable-libav --enable-pngquant --enable-trace --enable-vaapi --infodir=/usr/share/info --localstatedir=/var --mandir=/usr/share/man --prefix=/usr --cc=cc --arch=x86_x64 --platform=linux --python=python3 --sysconfdir=/config
7.make -j$(nproc)
then, if successful, try if compiled TVH binary runs with
Code
./build.linux/tvheadend --noacl
next, if TVH runs and can be accessed via its web UI, build the package by manipulating the related autobuild.sh script like this:
Code
1.cd /var/tmp/tvheadend/Autobuild
2.nano debian.sh
3.add argument '-d' to dpkg-buildpackage to remove libdvbcsa-dev dependancy: dpkg-buildpackage -d -b -us -uc
4.save debian.sh
5.AUTOBUILD_CONFIGURE_EXTRA="--disable-ffmpeg_static --disable-libfdkaac_static --disable-libtheora_static --disable-libopus_static --disable-libvorbis_static --disable-libvpx_static --disable-libx264_static --disable-libx265_static --disable-libfdkaac --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --disable-avahi --disable-dbus_1 --disable-bintray_cache --disable-execinfo --disable-hdhomerun_static --disable-hdhomerun_client --enable-libav --enable-pngquant --enable-trace --enable-vaapi --infodir=/usr/share/info --localstatedir=/var --mandir=/usr/share/man --prefix=/usr --cc=cc --arch=x86_x64 --platform=linux --python=python3 --sysconfdir=/config" ./Autobuild.sh -j$(nproc)
finally, install built TVH package. For example:
Code
1.cd /var/tmp
2.dpkg -i tvheadend_4.3-2038~g5f9404117-dirty_amd64.deb
that's it! Good luck :smiling face with sunglasses:
Kevin:
I can put those outputs. I have now created a systemd service to kill the root process on startup and all is well, so that process is not running. I can disable the service and when both processes are running I will enter those commands.
RE: Two tvheadend process - Added by Jonas Lang over 1 year ago
It might have been easier to have your last post as your first post. It certainly would have made a bit more sense to see where you were coming from originally. Adios.
RE: Two tvheadend process - Added by Kevin Maguire over 1 year ago
OK, read and I think I understood.
You have a tvheadend process starting somehow, but you don't know how/where, but you've added a systemd service to kill it before starting another one.
Elegant ;-)
You can also make sure you have locate installed, run updated, and then
locate -e -r 'tvheadend$'
My output (Debian on Raspberry Pi) is
/etc/default/tvheadend /etc/init.d/tvheadend /etc/rc0.d/K01tvheadend /etc/rc1.d/K01tvheadend /etc/rc2.d/K01tvheadend /etc/rc3.d/K01tvheadend /etc/rc4.d/K01tvheadend /etc/rc5.d/K01tvheadend /etc/rc6.d/K01tvheadend /home/hts/.hts/tvheadend /usr/bin/tvheadend /usr/share/doc/tvheadend /usr/share/tvheadend
You might have a stray file somewhere.
Also
find /etc -type f -exec grep -l tvheadend {} \;
I get
/etc/init.d/tvheadend /etc/default/tvheadend /etc/init/tvheadend.conf
RE: Two tvheadend process - Added by Jonas Lang over 1 year ago
Manuel J. Garcia Egido wrote:
What is the problem?
Not a problem but why not include all that detail in your first post. Users here will have no idea here what level of expertise you possess unless you tell them from the start.
You appear to be in capable hands now.
RE: Two tvheadend process - Added by Kevin Maguire over 1 year ago
Manuel: I think it's fair to say "A short time ago I reinstalled Tvheadend" was a little short on detail, misleading even, given what you later wrote.
In case it's not obvious, having same package simultaneously "installed" both via apt/Synaptic and dpkg -i package.deb is likely to lead to issues/confusion.
As you've found a workaround, that might suffice for you. If not, and you want solve the mystery, try what I suggested when time allows.
RE: Two tvheadend process - Added by Manuel J. Garcia Egido over 1 year ago
Kevin: I assure you I didn't mean to be misleading, I don't think I have anything to hide, or maybe I do, that depends on the recipient. I simply raised a technical problem and I understand that I could have given more details, although I don't know if, objectively, they would be relevant to the specific problem that I have raised.
I don't quite understand what it is in my long explanation that has bothered Jonas and that seems to have opened Pandora's box and caused your discomfort.
As I don't want to be annoying, it seems that the best thing is to put the end of this thread here.
I appreciate your advice and your kindness. I have executed the commands that you have told me and I do not see anything abnormal.
Greetings.
RE: Two tvheadend process - Added by Jonas Lang over 1 year ago
Did you not think that the omission of the fact that somehow you tried restoring a backup from an Enigma 2 tuner, I gather, to some other hardware which you still haven’t identified containing Ubuntu 20.04 all from instructions you garnered from the Linux Sat forum which you didn’t reference was not relevant. Honestly we are not mind readers here.
RE: Two tvheadend process - Added by Kevin Maguire over 1 year ago
Fair enough.
Be re-assured that I was at no point discomforted nor annoyed. See my own recent question/thread, not without some misunderstandings and some back and forth. It is not untypical in forums.
Good luck.
RE: Two tvheadend process - Added by Manuel J. Garcia Egido over 1 year ago
Certainly Kevin, communication via a forum is not ideal and often leads to misunderstandings. It is very possible that I have provided insufficient information, but it was not with any hidden intent or misleading intentions and was due to clumsiness, which seems to be the reason for Jonas's anger.
With the sole intention of clarifying the situation, that is, out of pure literary interest and surely without interest for the forum, I will describe the complete process of what happened, although I clarify from now on that not even I remember all the moments well.
The first time I installed TVH was several years ago, the last time, before everything related here, maybe 1 year ago, maybe more. I seem to remember that it was an apt-get installation. About 3 months ago I did the installation of Linuxsat that I showed before. I thought, here I begin to recognize my level of ignorance, that with this I would patch the installed TVH; but it turned out in the end that I did a fresh installation with dpkg, or so I think. Probably, I think now, from that moment the two TVH processes already began to run, although since everything worked fine, I was not aware of it.
A month ago, someone from forum A posted a script for Enigma2 from a user from forum B whose purpose was to add an IPTV list to TVH. This script in turn generated several scripts, including one that restored a TVH backup of forum user B. I couldn't run the base script, it gave me an error, but someone from forum A passed me the generated scripts. I unknowingly ran these scripts and TVH broke. Maybe it broke because of the 2 TVH processes that were running, which I wasn't aware of yet, or maybe it was for another reason, since here I started a process of uninstalling and reinstalling TVH repeatedly which could also be the origin of this duality of processes. Finally got everything working again, both the DVB-S TV and the IPTV list.
For some reason that I don't remember now, at some point I finally discovered that there were 2 TVH processes running and since it didn't seem normal to me I started to investigate the matter with the result that TVH broke again. That's when I found out that I probably had 2 TVHs installed and since I couldn't fix it this time I decided to uninstall everything, clean and reinstall. I uninstalled with apt-get remove --purge and with dpkg -r and finally both reported that TVH was not installed. However, every time I started the computer, the root-owned process tvheadend continued to start.
As I have already mentioned here, after deleting a supposed .hts folder in /root, the process disappeared and no longer started when the computer started, so I thought it was time to reinstall TVH, again following the instructions from Linuxsat, that is, using dpkg.
After the installation, and before restarting, everything was fine: a single process running owned by hts, I was able to enter TVH, I created the users and some basic configurations, but after restarting the computer, the 2 processes reappeared.
That's when I decided to ask on this forum. Since I wanted to find out where the instance that started the root process to remove it was, not why it was there, it seemed to me that instead of this long story, I could start by reporting from the time of last installation. My level of ignorance, which I hope I have revealed in this text to the satisfaction of Jonas, does not prevent me from understanding that, for the purposes of a diagnosis, the history is very helpful and that is why I provided it when requested, but also It leads me to think that this information is not essential to discover the instance that starts TVh as root.
In the end, that's all there is.
RE: Two tvheadend process - Added by Kevin Maguire over 1 year ago
"but also It leads me to think that this information is not essential to discover the instance that starts TVh as root"
This is hard enough even with the extra info. The extra info doesn't mean the problem is solved, but it sets a much clearer context and, as Jonas explained, allowed others to have a certain window into your level of expertise, which also helps.
In hindsight, and I realize not possible to know everything in advance, would likely have been better to try to "cleanse" your broken system of tvheadned after uninstalling the tvheadend packages with apt / dpkg. Using the variants on find / locate / lsof commands I mentioned.
"I uninstalled with apt-get remove --purge and with dpkg -r and finally both reported that TVH was not installed"
Yes, but the tools not knowing about it, and that its not still partially "present" somewhere, are very different things, as you discovered.
To be very clear, there was a tvheadend binary somewhere on your system when you thought there was none, and it was being started somehow via a mechanism you didn't understand.
Don't take any of that as criticism, it's just lessons learned.
RE: Two tvheadend process - Added by Manuel J. Garcia Egido over 1 year ago
"there was a tvheadend binary somewhere on your system when you thought there was none, and it was being started somehow via a mechanism you didn't understand".
Yes. I knew that, the binary was still in /usr/bin, but I didn't care, even if I deleted it, if the instance was still where it was, when the binary was back in place it would start the unwanted process again.
I am aware of my level of ignorance. When I go to sites like this, I do it to learn. I don't take corrections as criticism but as lessons.
RE: Two tvheadend process - Added by Jonas Lang over 1 year ago
You still haven’t confirmed what hardware your Ubuntu OS is installed on.
What amazes me is you dumped a load of scripts on to your system not knowing what they were really doing to it. Do you know how invasive a rogue script can be when run as root or run at all on your system. They do say knowledge in the wrong hands can be dangerous. Clearly this case proves it.
My original point which I’ve already made is provide as much information as possible to enable other users to help you troubleshoot your problem instead of going around in circles .That clearly didn’t happen in your case till well along into the discussion.
If you are indeed trying to get this to work on and Enigma 2 tuner which is still to be confirmed and I knew this from the start I certainly wouldn’t have responded in the first instance. If not and you do identify the hardware you are trying to install it on my first suggestion would be to do a fresh install of that hardware OS so as to clear any artefacts left behind after you dumped those scripts onto it. After that either install TVH by the traditional methods of either adding a PPA or do a self build. Plenty of instructions for those methods here and can be found with a simple search.
RE: Two tvheadend process - Added by Manuel J. Garcia Egido over 1 year ago
Jonas.
I don't have an Enigma2 tuner. My hardware is an old HP pc with Ubuntu + Digibit Twin sat>ip tuner + Kodi + Tvhedend + Oscam.
RE: Two tvheadend process - Added by Jonas Lang over 1 year ago
Well that’s made things a little clearer. I happen to run a similar setup with a Digibit Twiin.
My advice still stands. Do a fresh install of Ubuntu on your HP PC. This will ensure you have completely erased any trace of those Enigma 2 scripts that seemed to hose your PC.
From there you have a choice of adding a PPA like the one from Michael Marley https://launchpad.net/~mamarley/+archive/ubuntu/tvheadend-git
It will then be a simple case of sudo apt update and sudo apt install tvheadend
From there you access the Web UI in a browser and the TVH Wizard will launch and guide you through the process. So simple. Ensure your DIGIBIT Twin is powered up and on the same LAN so TVH will automatically discover it.
You can of course build/compile TVH for Ubuntu from these simple copy/paste commands I put together a while back if you follow them carefully
https://tvheadend.org/boards/4/topics/47932
Can you now see how easy it is to suggest a solution to your problem once you provide your full setup.
RE: Two tvheadend process - Added by Manuel J. Garcia Egido over 1 year ago
Man... Without intending to offend, the solution of reformatting the PC and installing everything again is not what one looks for when entering a forum of this type to ask for help.
Although I have already recognized that my knowledge is limited, I have also said that I have been using this system for several years to see fv, 8 or 10, in which I have installed TVH several times, both from the PPA that it suggests and from others and by various methods . Also enough to know which forums I should trust and which ones not to install anything. Still, I'm not going to be offended because he considered me an absolute novice; We already know that in a forum it is difficult to know who you are talking to.
Greetings.