QNAP QPKG for DVR Record Engine

Downloads & Instructions
Post Reply
jim_a
Posts: 124
Joined: Fri Jul 10, 2009 11:36 am

Re: QNAP QPKG for DVR Record Engine

Post by jim_a » Wed Dec 26, 2018 11:52 am

I am not sure what you want me to try.
I know enough about the CLI to be dangerous.

Code: Select all

[/share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR] # ls -l
-rw-rw-r--    1 admin    administ       101 Dec 24 09:42 HDHomeRunDVR.conf
-rwxr-xr-x    1 admin    administ      1589 Aug  3 19:04 HDHomeRunDVR.sh*
-rwxr-xr-x    1 admin    administ      2543 Aug  3 19:04 diagnostics.sh*
-rwxr-xr-x    1 admin    administ   1527038 Aug 17 16:32 hdhomerun_record_linux*
-rwxr-xr-x    1 admin    administ      8916 Feb  5  2018 hdhr_wrapper_arm*
-rwxr-xr-x    1 admin    administ     10432 Feb  5  2018 hdhr_wrapper_x86_64*
drwxr-xr-x    7 httpdusr administ      4096 Dec 24 09:14 ui/
[/share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR] # ./hdhr_wrapper_arm
-sh: ./hdhr_wrapper_arm: No such file or directory
[/share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR] #
When my script starts the record engine it starts but is running as admin.

I am surprised that no one else has tried to start the engine automatically.

demonrik
Posts: 1104
Joined: Mon May 04, 2015 10:03 am
Device ID: 10736454, 1073A35A, 1075C377

Re: QNAP QPKG for DVR Record Engine

Post by demonrik » Wed Dec 26, 2018 2:58 pm

jim_a wrote:
Wed Dec 26, 2018 11:52 am
I am not sure what you want me to try.
I know enough about the CLI to be dangerous.

Code: Select all

[/share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR] # ls -l
-rw-rw-r--    1 admin    administ       101 Dec 24 09:42 HDHomeRunDVR.conf
-rwxr-xr-x    1 admin    administ      1589 Aug  3 19:04 HDHomeRunDVR.sh*
-rwxr-xr-x    1 admin    administ      2543 Aug  3 19:04 diagnostics.sh*
-rwxr-xr-x    1 admin    administ   1527038 Aug 17 16:32 hdhomerun_record_linux*
-rwxr-xr-x    1 admin    administ      8916 Feb  5  2018 hdhr_wrapper_arm*
-rwxr-xr-x    1 admin    administ     10432 Feb  5  2018 hdhr_wrapper_x86_64*
drwxr-xr-x    7 httpdusr administ      4096 Dec 24 09:14 ui/
[/share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR] # ./hdhr_wrapper_arm
-sh: ./hdhr_wrapper_arm: No such file or directory
[/share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR] #
When my script starts the record engine it starts but is running as admin.

I am surprised that no one else has tried to start the engine automatically.
most do..
am guessing more folks using on x86 than arm based NAS
and being able to start via UI anyway means folks forget to report it.

If you could also try downloading the wrapper directly to some other folder and execute

Code: Select all

wget http://www.irish-networx.com/hdhr_wrapper/hdhr_wrapper_arm
chmod a+x hdhr_wrapper_arm
./hdhr_wrapper_arm
Have checked my build here and the wrappers are executing on my QNAP (x86) and Synology (arm)
so not sure why the arm binary isn't working for you guys :(

jim_a
Posts: 124
Joined: Fri Jul 10, 2009 11:36 am

Re: QNAP QPKG for DVR Record Engine

Post by jim_a » Wed Dec 26, 2018 3:23 pm

Code: Select all

[/tmp] # wget http://www.irish-networx.com/hdhr_wrapper/hdhr_wrapper_arm
--2018-12-26 17:19:33--  http://www.irish-networx.com/hdhr_wrapper/hdhr_wrapper_arm
Resolving www.irish-networx.com... 199.119.203.91
Connecting to www.irish-networx.com|199.119.203.91|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8916 (8.7K) [text/plain]
Saving to: ‘hdhr_wrapper_arm’

hdhr_wrapper_arm    100%[=====================>]   8.71K  --.-KB/s   in 0s

2018-12-26 17:19:33 (36.3 MB/s) - ‘hdhr_wrapper_arm’ saved [8916/8916]

[/tmp] # chmod a+x hdhr_wrapper_arm
[/tmp] # ls -l ./hdhr_wrapper_arm
-rwxr-xr-x    1 admin    administ      8916 Feb  5  2018 ./hdhr_wrapper_arm*
[/tmp] # ./hdhr_wrapper_arm
-sh: ./hdhr_wrapper_arm: No such file or directory
[/tmp] #

signcarver
Expert
Posts: 8139
Joined: Wed Jan 24, 2007 1:04 am
Device ID: 131B34B7 13231F92 1070A18E 1073ED6F

Re: QNAP QPKG for DVR Record Engine

Post by signcarver » Wed Dec 26, 2018 3:41 pm

don't have a qnap here and generally don't use arm based linux (where I actually do things in linux, not when something like a nas comes with it) but can you report the results of

Code: Select all

file hdhr_wrapper_arm
ldd hdhr_wrapper_arm
as it may point to where the error is (the program itself seems to run for me on any arm device that I can connect to from here). I have heard of times that an expected shared library wasn't there that produced such error (though most would expect another). It is probably more common to see such on x64 when 32 bit libraries aren't included.

Also I seem to remember once a person report that anything in /share was not executable on their NAS but I haven't been able to find it.

jim_a
Posts: 124
Joined: Fri Jul 10, 2009 11:36 am

Re: QNAP QPKG for DVR Record Engine

Post by jim_a » Wed Dec 26, 2018 4:35 pm

File isn’t installed on my TS-231

admin@192.168.1.247's password:
[~] # cd /tmp

Code: Select all

[/tmp] # file hdhr_wrapper_arm
-sh: file: command not found
[/tmp] # ldd hdhr_wrapper_arm
/sbin/ldd: eval: line 1: ./hdhr_wrapper_arm: not found
[/tmp] # cd /share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR

Code: Select all

[/share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR] # ls
HDHomeRunDVR.conf       hdhomerun_record_linux* ui/
HDHomeRunDVR.sh*        hdhr_wrapper_arm*
diagnostics.sh*         hdhr_wrapper_x86_64*

Code: Select all

[/share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR] # file hdhr_wrapper_arm
-sh: file: command not found
[/share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR] # ldd hdhr_wrapper_arm
/sbin/ldd: eval: line 1: ./hdhr_wrapper_arm: not found
[/share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR] # ls -l
-rw-rw-r--    1 admin    administ       101 Dec 24 09:42 HDHomeRunDVR.conf
-rwxr-xr-x    1 admin    administ      1589 Aug  3 19:04 HDHomeRunDVR.sh*
-rwxr-xr-x    1 admin    administ      2543 Aug  3 19:04 diagnostics.sh*
-rwxr-xr-x    1 admin    administ   1527038 Aug 17 16:32 hdhomerun_record_linux*
-rwxr-xr-x    1 admin    administ      8916 Feb  5  2018 hdhr_wrapper_arm*
-rwxr-xr-x    1 admin    administ     10432 Feb  5  2018 hdhr_wrapper_x86_64*
drwxr-xr-x    7 httpdusr administ      4096 Dec 24 09:14 ui/
[/share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR] #

demonrik
Posts: 1104
Joined: Mon May 04, 2015 10:03 am
Device ID: 10736454, 1073A35A, 1075C377

Re: QNAP QPKG for DVR Record Engine

Post by demonrik » Wed Dec 26, 2018 4:56 pm

very odd..

the wrappers are static binaries with no dynamic linking..
So ldd should error - but not in the way shown.

my guess here is that something has changed wrt ABI for the binary.
But what is the troubling part.

@darqnova - which model NAS are you running?
I notice that the TS-231 uses a freescale ARM v7 core, while the toolchain provided by QNAP is for Marvel.
It shouldn't matter - but maybe something is up.

jim_a
Posts: 124
Joined: Fri Jul 10, 2009 11:36 am

Re: QNAP QPKG for DVR Record Engine

Post by jim_a » Wed Dec 26, 2018 5:18 pm

Remember that everything works through the GUI on my TS-231.

I have a TS-251 (x86) that I could setup. However, other than the auto start the TS-231 is working for me.

demonrik
Posts: 1104
Joined: Mon May 04, 2015 10:03 am
Device ID: 10736454, 1073A35A, 1075C377

Re: QNAP QPKG for DVR Record Engine

Post by demonrik » Wed Dec 26, 2018 7:20 pm

jim_a wrote:
Wed Dec 26, 2018 5:18 pm
Remember that everything works through the GUI on my TS-231.

I have a TS-251 (x86) that I could setup. However, other than the auto start the TS-231 is working for me.
its the autostart/system start that uses the wrapper.
The GUI doesn't need it

You can remove the wrapper from the HDHomeRunDVR.sh script
This will allow autostart - but you won't be able to us the GUI to start/stop, and permissions will need to be fixed when we get the wrapper working.
Find the following in the script

Code: Select all

if [[ $EUID -ne 0 ]]; then
			$QPKG_ROOT/$HDHOMERUN_BIN start --conf $QPKG_ROOT/$HDHOMERUN_CONF
		else
			if [[ "$ARCH" =~ "arm"* ]]; then
			        echo "Determined Platform is ARM from $ARCH"
				$QPKG_ROOT/$HDHOMERUN_WRAP_ARM -u $HDHOMERUN_USER -b $QPKG_ROOT/$HDHOMERUN_BIN -- start --conf $QPKG_ROOT/$HDHOMERUN_CONF
			elif [[ "$ARCH" =~ "x86_64"* ]]; then
                                echo "Determined Platform is x86_64 from $ARCH"
				$QPKG_ROOT/$HDHOMERUN_WRAP_X86_64 -u $HDHOMERUN_USER -b $QPKG_ROOT/$HDHOMERUN_BIN -- start --conf $QPKG_ROOT/$HDHOMERUN_CONF
                        else
				echo "Unable to determine the platform - will default to no wrapper"
				$QPKG_ROOT/$HDHOMERUN_BIN start --conf $QPKG_ROOT/$HDHOMERUN_CONF
			fi
		fi
		
best is to comment out all but line 22, i.e.

Code: Select all

#if [[ $EUID -ne 0 ]]; then
			$QPKG_ROOT/$HDHOMERUN_BIN start --conf $QPKG_ROOT/$HDHOMERUN_CONF
#		else
#			if [[ "$ARCH" =~ "arm"* ]]; then
#			        echo "Determined Platform is ARM from $ARCH"
#				$QPKG_ROOT/$HDHOMERUN_WRAP_ARM -u $HDHOMERUN_USER -b $QPKG_ROOT/$HDHOMERUN_BIN -- start --conf $QPKG_ROOT/$HDHOMERUN_CONF
#			elif [[ "$ARCH" =~ "x86_64"* ]]; then
#                               echo "Determined Platform is x86_64 from $ARCH"
#				$QPKG_ROOT/$HDHOMERUN_WRAP_X86_64 -u $HDHOMERUN_USER -b $QPKG_ROOT/$HDHOMERUN_BIN -- start --conf $QPKG_ROOT/$HDHOMERUN_CONF
 #                       else
#				echo "Unable to determine the platform - will default to no wrapper"
#				$QPKG_ROOT/$HDHOMERUN_BIN start --conf $QPKG_ROOT/$HDHOMERUN_CONF
#			fi
#		fi
		

jim_a
Posts: 124
Joined: Fri Jul 10, 2009 11:36 am

Re: QNAP QPKG for DVR Record Engine

Post by jim_a » Wed Dec 26, 2018 8:06 pm

Actually, if you look at the script that I posted it directly calls hdhomerun_record_linux start without
the configuration file and not HDHomeRunDVR.sh (my mistake). :oops: I guess that explains why I couldn’t
view live TV on the shield.

I can live without auto start for awhile.

FYI: In my script the commands involving “mlog” are checking if/when my script ran and are not required.

demonrik
Posts: 1104
Joined: Mon May 04, 2015 10:03 am
Device ID: 10736454, 1073A35A, 1075C377

Re: QNAP QPKG for DVR Record Engine

Post by demonrik » Sat Dec 29, 2018 4:52 pm

I think I have the issue with the arm binary for qnap worked out.

For those with arm based qnaps..
Can someone please try executing an experimental compiled wrapper?

You can get the binary with

Code: Select all

wget www.irish-networx.com/hdhr_wrapper/hdhr_wrapper_exp 
you should see

Code: Select all

+===========================================================+
| Simple wrapper for HDHomeRun DVR Record Engine  v0.1      |
| changes effective user to same user as web engine for the |
| web UI to have sufficient privileges to stop/start the    |
| DVR engine backend without                                |
| Must be run as admin/root user                            |
| This script will not elevate privleges.                   |
+===========================================================+
+===========================================================+
|                                                           |
| hdhr_wrapper -u <username> -b <binary to execute>         |
|                                                           |
+===========================================================+
Please advise yay or nay so I can do a package rebuild or not.

jim_a
Posts: 124
Joined: Fri Jul 10, 2009 11:36 am

Re: QNAP QPKG for DVR Record Engine

Post by jim_a » Sun Dec 30, 2018 6:17 am

I got the expected results.

[/tmp] # wget www.irish-networx.com/hdhr_wrapper/hdhr_wrapper_exp
--2018-12-30 08:07:52-- http://www.irish-networx.com/hdhr_wrapp ... rapper_exp
Resolving www.irish-networx.com... 199.119.203.91
Connecting to www.irish-networx.com|199.119.203.91|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9736 (9.5K) [text/plain]
Saving to: ‘hdhr_wrapper_exp’

hdhr_wrapper_exp 100%[=====================>] 9.51K --.-KB/s in 0s

2018-12-30 08:07:52 (31.6 MB/s) - ‘hdhr_wrapper_exp’ saved [9736/9736]

Code: Select all

[/tmp] # ./hdhr_wrapper_exp
-sh: ./hdhr_wrapper_exp: Permission denied
[/tmp] # ls -l hdhr_wrapper_exp
-rw-r--r--    1 admin    administ      9736 Dec 29 18:46 hdhr_wrapper_exp
[/tmp] # chmod +x hdhr_wrapper_exp
[/tmp] # ls -l hdhr_wrapper_exp
-rwxr-xr-x    1 admin    administ      9736 Dec 29 18:46 hdhr_wrapper_exp*
[/tmp] # ./hdhr_wrapper_exp
+===========================================================+
| Simple wrapper for HDHomeRun DVR Record Engine  v0.1      |
| changes effective user to same user as web engine for the |
| web UI to have sufficient privileges to stop/start the    |
| DVR engine backend without                                |
| Must be run as admin/root user                            |
| This script will not elevate privleges.                   |
+===========================================================+
+===========================================================+
|                                                           |
| hdhr_wrapper -u <username> -b <binary to execute>         |
|                                                           |
+===========================================================+
[/tmp] #

demonrik
Posts: 1104
Joined: Mon May 04, 2015 10:03 am
Device ID: 10736454, 1073A35A, 1075C377

Re: QNAP QPKG for DVR Record Engine

Post by demonrik » Sun Dec 30, 2018 8:30 am

jim_a wrote:
Sun Dec 30, 2018 6:17 am
I got the expected results.

[/tmp] # wget www.irish-networx.com/hdhr_wrapper/hdhr_wrapper_exp
--2018-12-30 08:07:52-- http://www.irish-networx.com/hdhr_wrapp ... rapper_exp
Resolving www.irish-networx.com... 199.119.203.91
Connecting to www.irish-networx.com|199.119.203.91|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9736 (9.5K) [text/plain]
Saving to: ‘hdhr_wrapper_exp’

hdhr_wrapper_exp 100%[=====================>] 9.51K --.-KB/s in 0s

2018-12-30 08:07:52 (31.6 MB/s) - ‘hdhr_wrapper_exp’ saved [9736/9736]

Code: Select all

[/tmp] # ./hdhr_wrapper_exp
-sh: ./hdhr_wrapper_exp: Permission denied
[/tmp] # ls -l hdhr_wrapper_exp
-rw-r--r--    1 admin    administ      9736 Dec 29 18:46 hdhr_wrapper_exp
[/tmp] # chmod +x hdhr_wrapper_exp
[/tmp] # ls -l hdhr_wrapper_exp
-rwxr-xr-x    1 admin    administ      9736 Dec 29 18:46 hdhr_wrapper_exp*
[/tmp] # ./hdhr_wrapper_exp
+===========================================================+
| Simple wrapper for HDHomeRun DVR Record Engine  v0.1      |
| changes effective user to same user as web engine for the |
| web UI to have sufficient privileges to stop/start the    |
| DVR engine backend without                                |
| Must be run as admin/root user                            |
| This script will not elevate privleges.                   |
+===========================================================+
+===========================================================+
|                                                           |
| hdhr_wrapper -u <username> -b <binary to execute>         |
|                                                           |
+===========================================================+
[/tmp] #
cool
turned out I was building the arm binary wrong for qnap.
Now resolved
So will create new qpkg later today, then update build Makefiles, etc.

demonrik
Posts: 1104
Joined: Mon May 04, 2015 10:03 am
Device ID: 10736454, 1073A35A, 1075C377

Re: QNAP QPKG for DVR Record Engine

Post by demonrik » Sun Dec 30, 2018 11:59 am

NEW PACKAGE AVAILABLE
- fixed dvrui_hdhrjson to not initialize var with concatenation for larger compatability
- fixed armv7 wrapper build (Many thanks to @jim_a and @darqnova for spotting this one and being patient - autostart should now work)

new QPKG HDHomeRunDVR_0.9.35.qpkg available in the usual locations Google Drive, DropBox, OneDrive

Code is available on github
https://github.com/Silicondust/dvr_install

Known Issues
- diagnostics.sh not updated for new api url

jim_a
Posts: 124
Joined: Fri Jul 10, 2009 11:36 am

Re: QNAP QPKG for DVR Record Engine

Post by jim_a » Sun Dec 30, 2018 5:41 pm

I installed the new version.
Auto start working based on one reboot test. :)
Thanks.

unit1402
Posts: 1
Joined: Fri Jan 04, 2019 9:42 am

Re: QNAP QPKG for DVR Record Engine

Post by unit1402 » Fri Jan 04, 2019 10:00 am

I am experiencing the same issues on a qnap TS-231P with the dual core arm. Firmware ver 4.3.6.0805 I installed the latest qpkg 0.9.35, I can see the web interface, I can open the app on my phone and it recognizes that there is a DVR package associated to my tuner. I can schedule shows and such, but as soon as I hit record, or a timer goes off to record, the record engine crashes.

./diagnostics output

[/share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR] # ./diagnostics.sh
QPKG installed to - /share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR
QPKG Version Installed - 0.9.35
Checking /share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR exists - TRUE
Checking /share/Web exists - TRUE
/share/Web points to /share/CACHEDEV1_DATA/Web and EXISTS
Checking the UI link exists in Web Share - True
/share/Web/HDHomeRunDVR points to /share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR/ui and EXISTS
HDHomeRunDVR/style set 755
CSS file exists and is set as 644
Checking UI Vars file exists - TRUE
====== CONTENTS =======
<?php
final class DVRUI_Vars
{
const DVRUI_version ="0.9.35";
const DVRUI_name ="QNAP HDHomeRun DVR Manager";
const DVRUI_author ="Rik Dunphy";
const DVRUI_email ="d3monrik@gmail.com";
const DVRUI_git ="https://github.com/Silicondust/dvr_install";
const DVR_pkgPath ="/share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR";
const DVR_bin ="hdhomerun_record_linux";
const DVR_sh ="HDHomeRunDVR.sh";
const DVR_config ="HDHomeRunDVR.conf";
const DVRUI_apiurl ="http://api.hdhomerun.com/";
const DVRUI_TZ ='';
}
?>
====== CONTENTS =======
Checking record engine configfile exists TRUE
====== CONTENTS =======
RecordPath=/share/Multimedia/HDHomeRunDVR
Port=59090
StorageID=217e7220-c8ea-9b46-4b6f-0a85cf99ecc8
====== CONTENTS =======
Checking /share/Multimedia/HDHomeRunDVR exists TRUE

=====================================================



Looks like on the fist attempt at recording it can create the folder path and creates the file to write to, but after that nothing. If I try to restart the record engine from the web interface it won't stay running, the status bar at the bottom says it is running but after a few seconds it changes to not running and the log file never updates.

[/share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR] # cd /share/Multimedia/HDHomeRunDVR/
[/share/Multimedia/HDHomeRunDVR] # ll
drwxrwxrwx 4 httpdusr administ 160 Jan 4 10:47 ./
drwxr-xr-x 3 admin administ 60 Jan 2 12:43 ../
-rwxrwxrwx 1 httpdusr administ 12.0k Jan 2 17:59 20190102.log*
-rwxrwxrwx 1 httpdusr administ 12.0k Jan 4 10:47 20190104.log*
drwxrwxrwx 2 httpdusr administ 40 Jan 4 10:31 Live TV/
drwxrwxrwx 2 httpdusr administ 60 Jan 4 10:31 NUMB3RS/
-rw------- 1 httpdusr administ 0 Jan 4 10:47 core
-rw-rw-r-- 1 httpdusr administ 0 Jan 4 10:47 fault.log

[/share/Multimedia/HDHomeRunDVR] # cd NUMB3RS/
[/share/Multimedia/HDHomeRunDVR/NUMB3RS] # ll
drwxrwxrwx 2 httpdusr administ 60 Jan 4 10:31 ./
drwxrwxrwx 4 httpdusr administ 160 Jan 4 10:47 ../
-rw-rw-r-- 1 httpdusr administ 16.0M Jan 4 10:32 NUMB3RS S04E15 20080425 [20190104-1600].mpg
[/share/Multimedia/HDHomeRunDVR/NUMB3RS] #

restarting the HDHomeRunDVR service thru the QNAP admin / apps interface doesn't seem to resolve anything.

I have to reboot the qnap to get it to start running again and then the cycle repeats. (uninstalling the qpkg and reinstalling also just repeats the cycle)
-- correction :: on the reboot. the /share/Multimedia/HDHomeRunDVR folder gets deleted after a reboot. I manually recreate the folder path (chmod 777) . restart the record engine thru the web interface, then the cycle repeats.

Post Reply