Project

General

Profile

Tvheadend working on Windows 10

Added by Antti Lehtinen over 3 years ago

Currently succesfully scanning services of a DVB-C network with hdhomerun network tuner:

Windows 10 Insider build 14316
Linux on windows subsystem installed
Bash/Ubuntu on Windows
Tvheadend trusty unstable

Will not expect it to work with USB/PCI tuners as there is no access to hardware.


Replies (11)

RE: Tvheadend working on Windows 10 - Added by Vincent Rouleau over 3 years ago

I also made it work using both ATSC and IPTV hdhomerun extend, but the tvheadend process uses %100 of 1 CPU:

PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
807 hts 0 42+ 0 0 0 S 83.9 0.0 29:06.11 tvheadend
1 root 20 0 0 0 0 S 0.0 0.0 0:00.04 init
2 vincent 20 0 0 0 0 S 0.0 0.0 0:04.38 bash
746 root 20 0 0 0 0 S 0.0 0.0 0:00.07 sudo
747 root 20 0 0 0 0 S 0.0 0.0 0:00.06 su
748 hts 20 0 0 0 0 S 0.0 0.0 0:01.84 bash
860 vincent 20 0 0 0 0 S 0.0 0.0 0:00.07 bash
863 vincent 20 0 0 0 0 R 0.0 0.0 0:01.27 top

RE: Tvheadend working on Windows 10 - Added by Antti Lehtinen about 3 years ago

Things seem to be developing.

With the latest insider preview (fast ring) and the latest tvheadend it is not using the CPU when idle anymore. My guess is that the kernel translation layer is getting constantly improved (although MS doesn't list it as improvements in the build documentation).

It is also responding to different KILL signals more in line with real linux.

Naturally tvheadend cannot be run as daemon on W10 linux subsystem, as any such mechanism is currently not implemented in W10 (yes, there of course can be workarounds).

BR,
Andy777

RE: Tvheadend working on Windows 10 - Added by Martin D over 1 year ago

I set this up as a proof of concept and it seems to work - just waiting for my HDHomeRun to arrive.
This starts automatically on Windows boot, but is not resilient.
This won't work with USB tuners unless you can get some kind of USB/IP solution working.

For anyone who wants to try this out here are the steps:
1) Install Windows subsystem for Linux (Ubuntu)
2) open the console and do this:
#get rid of sudo password prompt:
sudo sed -i "s/%sudo.*/%sudo ALL=(ALL:ALL) NOPASSWD:ALL/g" /etc/sudoers
###install tvheadend
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61
echo "deb https://dl.bintray.com/tvheadend/deb xenial stable-4.2" | sudo tee /etc/apt/sources.list.d/tvheadend.list
sudo apt-get update
sudo apt-get install tvheadend
###edit crontab
sudo apt-get upgrade
sudo crontab -e
(Select nano)
(paste this in there:)
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@reboot . $HOME/.profile; service tvheadend start
(ctrl-x, save, exit)
###find IP address
###this is just the IP of the host, so
ip a (in linux)
ipconfig /all (windows)
3) open windows firewall for incoming TCP ports 9981, 9982
4) browse to TVH IP from LAN on x.x.x.x:9981 to configure
5) Create a batch file in windows with the following contents:
C:\Windows\System32\bash.exe -c 'while [ true ]; do sudo /usr/sbin/cron -f; done'
6) right click, create shortcut
7) move the shortcut to the startup folder (right click start button, run this to open the folder: "shell:common startup")

That's it. Works for me. It leaves an annoying command prompt window open but I suppose there could be alternative options such as setting it up as a service, using VB scripts, scheduled tasks, health check TVH and restart if necessary etc.

RE: Tvheadend working on Windows 10 - Added by saen acro over 1 year ago

Is it possible to build package manual?

RE: Tvheadend working on Windows 10 - Added by Martin D over 1 year ago

Please could you elaborate...

RE: Tvheadend working on Windows 10 - Added by To Fi about 1 year ago

This worked great for me.
Three additions:

1. i had to reinstall windows in order to get the linux subsystem to work properly. On my old install, there were some errors while creating the linux user and nothing really worked.

2. there was some problem with gpg and adding the key for the tvheadend repo. The command

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61

ended with:

gpg: keyserver receive failed: No dirmngr

So i had to use another way to install this key [source: https://github.com/Microsoft/WSL/issues/3286 ]

curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x379CE192D401AB61" | sudo apt-key add

Then the install went through very smoothly.

3. For some reason my sat>ip-server could not be discovered by the new tvheadend install. To solve this i had to add in /etc/default/tvheadend

TVH_ARGS=" --satip_xml http://192.168.0.46/rootDescr"

RE: Tvheadend working on Windows 10 - Added by ace golfer 2 months ago

I have HDHomeRun extend tuner. Seems there are 3 routes to run TVH on Win 10

1. Windows Subsystem Linux (this thread)
2. VM
3. Docker

What are the pros and cons of each?

RE: Tvheadend working on Windows 10 - Added by saen acro 2 months ago

ace golfer wrote:

I have HDHomeRun extend tuner. Seems there are 3 routes to run TVH on Win 10

1. Windows Subsystem Linux (this thread)
2. VM
3. Docker

What are the pros and cons of each?

1 and 3 are not automated aka need manual starting of service docker worst.
2. is full functional OS all as on physical PC, can be attached usb tuners.

RE: Tvheadend working on Windows 10 - Added by ace golfer 2 months ago

saen acro wrote:

1 and 3 are not automated aka need manual starting of service docker worst.
2. is full functional OS all as on physical PC, can be attached usb tuners.

Won't this part of instruction automate start process?

5) Create a batch file in windows with the following contents:
C:\Windows\System32\bash.exe -c 'while [ true ]; do sudo /usr/sbin/cron -f; done'
6) right click, create shortcut
7) move the shortcut to the startup folder (right click start button, run this to open the folder: "shell:common startup")>

RE: Tvheadend working on Windows 10 - Added by saen acro 2 months ago

ace golfer wrote:

saen acro wrote:

1 and 3 are not automated aka need manual starting of service docker worst.
2. is full functional OS all as on physical PC, can be attached usb tuners.

Won't this part of instruction automate start process?

5) Create a batch file in windows with the following contents:
C:\Windows\System32\bash.exe -c 'while [ true ]; do sudo /usr/sbin/cron -f; done'
6) right click, create shortcut
7) move the shortcut to the startup folder (right click start button, run this to open the folder: "shell:common startup")>

its interesting will it work without dependencies
I'm using Ubuntu from appstore but also missing some important elements.

RE: Tvheadend working on Windows 10 - Added by ace golfer about 2 months ago

saen acro wrote:

ace golfer wrote:

saen acro wrote:

1 and 3 are not automated aka need manual starting of service docker worst.
2. is full functional OS all as on physical PC, can be attached usb tuners.

Won't this part of instruction automate start process?

5) Create a batch file in windows with the following contents:
C:\Windows\System32\bash.exe -c 'while [ true ]; do sudo /usr/sbin/cron -f; done'
6) right click, create shortcut
7) move the shortcut to the startup folder (right click start button, run this to open the folder: "shell:common startup")>

its interesting will it work without dependencies
I'm using Ubuntu from appstore but also missing some important elements.

You are right. The instruction above didnt' work. I found a workaround. It works. Starting Linux background services on Windows startup https://dev.to/ironfroggy/wsl-tips-starting-linux-background-services-on-windows-login-3o98

    (1-11/11)