Synology SPK for DVR Record Engine

Downloads & Instructions
Post Reply
demonrik
Posts: 1068
Joined: Mon May 04, 2015 10:03 am
Device ID: 10736454, 1073A35A, 1075C377

Re: Synology SPK for DVR Record Engine

Post by demonrik » Mon Feb 05, 2018 3:03 pm

NEW PACKAGE AVAILABLE
- update to the 20171221 engine (wasn't required since we always spec the conf file) 20171221
- added wrapper binary to change user (source code is part of the project)
- Controls to start/stop/restart the engine from the UI now work for arm and x86_64 NAS.
- fixed a few small things
- tweaked the overall source code structure to share more between NAS packages.

new SPK HDHomeRunDVR-0.4-20171221.spk available in the usual locations Google Drive, DropBox, OneDrive

Warning: the wrapper (source code is on github) provided has been compiled both for ARM and x86_64. The script should detect the architecture of your NAS and call the appropriate wrapper. I unfortunately do not have an X86 based Synology to test on - just a bunch of PCs, etc. to try the portable binary. Please let me know if you have issues. In some cases, if the platform is not detected the wrapper is not used and the UI controls will not work. Also please let me know which Synology NAS this happens for

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

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

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

Re: Synology SPK for DVR Record Engine

Post by demonrik » Mon Feb 05, 2018 5:04 pm

NEW PACKAGE AVAILABLE 0.4.1
- Fixed permissions bug on the style folder
- Fixed missing hooks to start properly

new SPK HDHomeRunDVR-0.4.1-20171221.spk available in the usual locations Google Drive, DropBox, OneDrive

Warning: the wrapper (source code is on github) provided has been compiled both for ARM and x86_64. The script should detect the architecture of your NAS and call the appropriate wrapper. I unfortunately do not have an X86 based Synology to test on - just a bunch of PCs, etc. to try the portable binary. Please let me know if you have issues. In some cases, if the platform is not detected the wrapper is not used and the UI controls will not work. Also please let me know which Synology NAS this happens for

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

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

TBlankenheim
Posts: 67
Joined: Wed May 27, 2015 9:15 am

Re: Synology SPK for DVR Record Engine

Post by TBlankenheim » Mon Feb 05, 2018 11:18 pm

I installed version 0.4.1-20171221 on my DS918+ and the RECORD engine does not seem to be functioning properly.

The DVR Manager indicates HDHomeRun RECORD running. The 'Recordings' tab does not indicate the presence of any recordings (there are several present). When I run the Windows 10 HDHomeRun client, I get a DVR Failure error message. Also, no entries are made to the log file. If I delete the log files before starting the RECORD engine, no new log file is being created.

When I look at the processes running on the DS918+, I can see hdhomerun_record_x64.

Version 0.3-20171118 works as expected with the exception of the DVR Manager not showing any log files. Not sure if this is a known problem or a configuration error on my part.

Any thoughts or suggestions? More than happy to collect any additional information you may require.

Thanks!

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

Re: Synology SPK for DVR Record Engine

Post by demonrik » Tue Feb 06, 2018 7:43 am

TBlankenheim wrote:
Mon Feb 05, 2018 11:18 pm
I installed version 0.4.1-20171221 on my DS918+ and the RECORD engine does not seem to be functioning properly.

The DVR Manager indicates HDHomeRun RECORD running. The 'Recordings' tab does not indicate the presence of any recordings (there are several present). When I run the Windows 10 HDHomeRun client, I get a DVR Failure error message. Also, no entries are made to the log file. If I delete the log files before starting the RECORD engine, no new log file is being created.

When I look at the processes running on the DS918+, I can see hdhomerun_record_x64.

Version 0.3-20171118 works as expected with the exception of the DVR Manager not showing any log files. Not sure if this is a known problem or a configuration error on my part.

Any thoughts or suggestions? More than happy to collect any additional information you may require.

Thanks!
No entries to the log file indicates a permissions issue.
Make sure your recordpath location is accessible by the http user.

The fact that 0.4.1 is having issues that 0.3 doesn't really does imply a permissions problem. For 0.4.1 the startup script attempts to run the record engine as the http user.. where as 0.3 runs it as root.

So short summary - check the permissions :)

jasonic8
Posts: 121
Joined: Wed Jul 01, 2015 3:03 am
Location: Somerset, UK

Re: Synology SPK for DVR Record Engine

Post by jasonic8 » Tue Feb 06, 2018 10:28 am

What http user? What's the name of the account that needs permissions? Is this something we can do through the DSM or do we need to SSH in and grant permissions to some system level user that we can't see like root?

UPDATE: Can be done in DSM - FileStation -> HDHomeRun folder permissions. Click create and select "http" and then add read and write permissions.
Last edited by jasonic8 on Tue Feb 06, 2018 10:32 am, edited 1 time in total.

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

Re: Synology SPK for DVR Record Engine

Post by demonrik » Tue Feb 06, 2018 10:31 am

jasonic8 wrote:
Tue Feb 06, 2018 10:28 am
What http user? What's the name of the account that needs permissions? Is this something we can do through the DSM or do we need to SSH in and grant permissions to some system level user that we can't see like root?
you will need to ssh.
This should only be a problem if you are migrating (or have migrated in previous versions) from the SD installer.

Once you ssh to the box.
simply run the following

Code: Select all

# sudo chown -R http:http <recordpath>

jasonic8
Posts: 121
Joined: Wed Jul 01, 2015 3:03 am
Location: Somerset, UK

Re: Synology SPK for DVR Record Engine

Post by jasonic8 » Tue Feb 06, 2018 10:33 am

Thanks - I edited the post as you must have been answering - turns out you can do it in DSM.

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

Re: Synology SPK for DVR Record Engine

Post by demonrik » Tue Feb 06, 2018 10:34 am

jasonic8 wrote:
Tue Feb 06, 2018 10:33 am
Thanks - I edited the post as you must have been answering - turns out you can do it in DSM.
cool :)

jasonic8
Posts: 121
Joined: Wed Jul 01, 2015 3:03 am
Location: Somerset, UK

Re: Synology SPK for DVR Record Engine

Post by jasonic8 » Tue Feb 06, 2018 10:58 am

No Recordings can be found... any ideas?

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

Re: Synology SPK for DVR Record Engine

Post by demonrik » Tue Feb 06, 2018 11:17 am

jasonic8 wrote:
Tue Feb 06, 2018 10:58 am
No Recordings can be found... any ideas?
Do you have log files in the recordpath?
Try shutting down the engine via the appcenter.. delete the logfiles if they exist.. then start up the engine
Do you get a new logfile?

If you have new logfile... then am not sure as engine is running.. would possibly be just waiting for my.hdhomerun.com to catch up (maybe wait 30mins or so).

If no new logfile.. then something is most likely wrong with permissions.. and changing through FileStation didn't resolve and we need to go to ssh login to resolve.

jasonic8
Posts: 121
Joined: Wed Jul 01, 2015 3:03 am
Location: Somerset, UK

Re: Synology SPK for DVR Record Engine

Post by jasonic8 » Tue Feb 06, 2018 1:09 pm

No that doesn't cure it and now (after SSH sudo) I have the "Unable to play channel. DVR failure" message again.

jasonl
Silicondust
Posts: 13627
Joined: Sun Oct 28, 2007 9:23 pm

Re: Synology SPK for DVR Record Engine

Post by jasonl » Tue Feb 06, 2018 1:12 pm

What's the device ID for your HDHomeRun?

jasonic8
Posts: 121
Joined: Wed Jul 01, 2015 3:03 am
Location: Somerset, UK

Re: Synology SPK for DVR Record Engine

Post by jasonic8 » Tue Feb 06, 2018 2:08 pm

Hi - it's 12301DB4

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

Re: Synology SPK for DVR Record Engine

Post by demonrik » Tue Feb 06, 2018 2:20 pm

jasonic8 wrote:
Tue Feb 06, 2018 1:09 pm
No that doesn't cure it and now (after SSH sudo) I have the "Unable to play channel. DVR failure" message again.
when you re ssh'd to the box..
Can you do the following?

Code: Select all

ps -ef | grep hdh
you should see either this for x86 NAS

Code: Select all

http      9705     1  0 Feb05 ?        00:10:21 /tmp/hdhomerun_record_x64 start --conf /volume1/@appstore/HDHomeRunDVR/etc/HDHomeRunDVR.conf
or for arm

Code: Select all

http      9705     1  0 Feb05 ?        00:10:21 /tmp/hdhomerun_record_arm start --conf /volume1/@appstore/HDHomeRunDVR/etc/HDHomeRunDVR.conf

If you don't see anything.. then we have a problem that the record engine is not starting for some reason.
In the same ssh session - lets get some data
first - lets check the platform

Code: Select all

uname -a
If the output is arm then please try

Code: Select all

/var/packages/HDHomeRunDVR/target/bin/hdhr_wrapper_arm
otherwise if it's x86_64 please try

Code: Select all

/var/packages/HDHomeRunDVR/target/bin/hdhr_wrapper_x86_64
If it's neither - then I may have caused something with my mods for the wrapper.

You should see the following

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>         |
|                                                           |
+===========================================================+
If you get something like

Code: Select all

cannot execute binary file: Exec format error
Then we have a performance mismatch I need to fix.

To remove the wrapper and resolve back to 0.3 like execution (but new engine and fixes) you can modify the following file
/var/packages/HDHomeRunDVR/scripts/common

Change from line 71 from:

Code: Select all

start_engine() {
    if [[ $EUID -ne 0 ]]; then
        $hdhr_bin_path/$hdhr_bin start --conf $hdhr_etc_path/$hdhr_conf
    else
        if [[ "$arch" =~ "arm"* ]]; then
            echo "Determined Platform is ARM from $arch"
            $hdhr_bin_path/$hdhr_wrap_arm -u $hdhr_user -b $hdhr_bin_path/$hdhr_bin -- start --conf $hdhr_etc_path/$hdhr_conf
        elif [[ "$arch" =~ "x86_64"* ]]; then
            echo "Determined Platform is x86_64 from $arch"
            $hdhr_bin_path/$hdhr_wrap_x86 -u $hdhr_user -b $hdhr_bin_path/$hdhr_bin -- start --conf $hdhr_etc_path/$hdhr_conf
        else
            echo "Unable to determine the platform - will default to no wrapper"
            $hdhr_bin_path/$hdhr_bin start --conf $hdhr_etc_path/$hdhr_conf
        fi
    fi
}
To

Code: Select all

start_engine() {
        $hdhr_bin_path/$hdhr_bin start --conf $hdhr_etc_path/$hdhr_conf
}

jasonic8
Posts: 121
Joined: Wed Jul 01, 2015 3:03 am
Location: Somerset, UK

Re: Synology SPK for DVR Record Engine

Post by jasonic8 » Tue Feb 06, 2018 2:31 pm

I'm on x86 and get the text describing the wrapper successfully.

It was allowing me to view live channels before so I'm not sure what's changed.

I'm rubbish at vi.

Post Reply