QNAP QPKG for DVR Record Engine

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

Re: QNAP QPKG for DVR Record Engine

Post by demonrik » Fri Jan 04, 2019 5:53 pm

unit1402 wrote:
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.
you should open a support ticket with SD
something is clearly wrong, as the engine shouldn't be crashing for a record event.
SD should have better diagnostics as to why the engine is crashing..
check memory, drive diagnostics, space, etc..

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

Re: QNAP QPKG for DVR Record Engine

Post by jim_a » Fri Jan 04, 2019 8:39 pm

Have you tried the manual NAS install?
FYI: my NAS is the older 231 (without the P) and has a different processor than your NAS.
I am running two 6TB WD NAS drives in raid one

numus
Posts: 541
Joined: Thu Apr 21, 2016 7:57 am

Re: QNAP QPKG for DVR Record Engine

Post by numus » Sat Jan 19, 2019 5:32 pm

Still getting the issue where I cant actually open the HDHomeRunDVR screen inside my QNAP... If I try I get

Refused to display 'http://***.***.***.***/HDHomeRunDVR/?windowId=q-app-HDHomeRunDVR-1330&v=0.9.35&' in a frame because it set 'X-Frame-Options' to 'sameorigin'.

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

Re: QNAP QPKG for DVR Record Engine

Post by demonrik » Sun Jan 20, 2019 4:41 pm

numus wrote:
Sat Jan 19, 2019 5:32 pm
Still getting the issue where I cant actually open the HDHomeRunDVR screen inside my QNAP... If I try I get

Refused to display 'http://***.***.***.***/HDHomeRunDVR/?windowId=q-app-HDHomeRunDVR-1330&v=0.9.35&' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
is a good find.
That points to an apache configuration difference between our NASes!!

Looking now I see that under default-config/apache.conf there is the following

Code: Select all

<IfModule headers_module>
Header always append X-Frame-Options SAMEORIGIN "env=!share-iframe"
Header always edit Set-Cookie ^(.*)$ $1;HttpOnly
</IfModule>
but my config/apache/apache.conf file doesn't have any headers_module in the conf file.
I wonder if qnap added it at some point, but it never got applied to my installation

So..
First can you please confirm that your config/apache/apache.conf does have the X-Frame-Options set,
i.e.

Code: Select all

grep -iC4 x-frame-option /etc/config/apache/*
If so..
Can you comment out that line so it looks more like

Code: Select all

<IfModule headers_module>
#Header always append X-Frame-Options SAMEORIGIN "env=!share-iframe"
Header always edit Set-Cookie ^(.*)$ $1;HttpOnly
</IfModule>
then restart apache

Code: Select all

/etc/init.d/Qthttpd.sh restart
Let me know how it goes.

bitminer
Posts: 5
Joined: Sun Jan 27, 2019 4:08 pm

Re: QNAP QPKG for DVR Record Engine

Post by bitminer » Sun Jan 27, 2019 4:10 pm

What version of PHP was this developed for?

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

Re: QNAP QPKG for DVR Record Engine

Post by demonrik » Sun Jan 27, 2019 4:18 pm

bitminer wrote:
Sun Jan 27, 2019 4:10 pm
What version of PHP was this developed for?
5.6
But should work with 7.x

fongw2
Posts: 7
Joined: Fri Feb 02, 2018 12:40 pm

Re: QNAP QPKG for DVR Record Engine

Post by fongw2 » Sun Feb 03, 2019 12:29 pm

Hi. I was running the QPKG V0.9.34 in early December on a TS-412 with a HDHomeRun Connect model HDHR4-2US. Everything was working fine until I tried to move the recording directory from it's standard location (Multimedia/HDHomeRun) on mirrored drives 1 & 2 to two new mirrored drives 3 & 4 using the HDHomeRunDVR UI. It hung/crashed during the attempt and since December, I have not been able to record or playback recordings on my kodi box that is running the Michael Brehm zuki.pvr.hdhomerundvr. More importantly, I now also cannot even access the HDHomeRunDVR UI on my PC. I could never run the UI on the NAS directly as has been identified in this post as I would get that error that it would not connect (BTW, what port should be used in Web Server or does that even matter?), but using the workaround with <my NAS ip>/HDHomeRunDVR used to work until the December problem started and now I get this error:

Forbidden
You don't have permission to access /HDHomeRunDVR on this server.

I double checked my NAS folder permissions and I'm pretty sure I have access, atleast I used to until I tried to change the directories in the UI. Is this in a hidden directory somewhere?

Once the file location change screw up started, I also stopped seeing my HDHomeRun Record and DVR as valid options on the my.hdhomerun.com page even though I knew I had them and had been using them since Jan 2018. Only my tuner shows up on that webpage and also when I run http://ipv4-api.hdhomerun.com/discover, nothing else and definitely no DVR.

I've been working with SD support since then but multiple attempts to delete and re-install the app on my NAS have resulted in nothing. I let my DVR license renewal lapse in Jan because I was frustrated that I couldn't set up any recordings so why pay for it, and then I saw the new QPKG v0.9.35. I installed the new version and it sort of helped in that I could now see previous recordings that I had saved in the original Multimedia/HDHomeRunDVR folder. I decided to resubscribe to the DVR again to see if everything came back and recordings from my old timers in the kodi app restarted to the old directory on Feb 1 when I renewed my subscription. I still however cannot see the UI and still get the 'Forbidden' error on my PC. I'm perplexed as to what is wrong with my installation as I have all of the pieces.

Note: Support kept asking me to check this location for my QNAP installation but it was not there:

/share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR/
instead, it was in /share/MD0_DATA/.qpkg/HDHomeRunDVR/

Not sure why or if it matters.

Any suggestions on what I can do to get access to the HDHomeRunDVR UI from my PC and have it show up in my.hdhomerun.com profile? Is there another config or directory on my NAS that was possible corrupted back in December such that I can no longer see the UI?

Thanks!

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

Re: QNAP QPKG for DVR Record Engine

Post by demonrik » Sun Feb 03, 2019 2:09 pm

fongw2 wrote:
Sun Feb 03, 2019 12:29 pm
Hi. I was running the QPKG V0.9.34 in early December on a TS-412 with a HDHomeRun Connect model HDHR4-2US. Everything was working fine until I tried to move the recording directory from it's standard location (Multimedia/HDHomeRun) on mirrored drives 1 & 2 to two new mirrored drives 3 & 4 using the HDHomeRunDVR UI. It hung/crashed during the attempt
I suspect you moved the RecordPath to something invalid and the engine can't move forward
I could never run the UI on the NAS directly as has been identified in this post as I would get that error that it would not connect (BTW, what port should be used in Web Server or does that even matter?), but using the workaround with <my NAS ip>/HDHomeRunDVR used to work
This is a known issue I've not been able to replicate directly.
@numus managed to get some info and I posted what I think could be a fix, but unfortunately no-one has responded to whether it works or not.
viewtopic.php?p=337629#p337629
until the December problem started and now I get this error:

Forbidden
You don't have permission to access /HDHomeRunDVR on this server.

I double checked my NAS folder permissions and I'm pretty sure I have access, atleast I used to until I tried to change the directories in the UI. Is this in a hidden directory somewhere?
Normal installation will create a link in /share/Web called HDHomeRunDVR
This is linked to the install directory of the QPKG - in your case it should be /share/MD0_DATA/.qpkg/HDHomeRunDVR/ui
If you are getting this error - then either /share/Web/HDHomeRunDVR is pointing to an invalid location or the permissions of the install directory got removed
So 2 tests here..
1. Check the install directory of the QPKG

Code: Select all

getcfg HDHomeRunDVR Install_Path -f /etc/config/qpkg.conf
2. Check the Web page link

Code: Select all

ls -l /share/Web/HDHomeRunDVR 
They should almost match - the Web link will have additional subfolder /ui/ but otherwise should be close.
Once the file location change screw up started, I also stopped seeing my HDHomeRun Record and DVR as valid options on the my.hdhomerun.com page even though I knew I had them and had been using them since Jan 2018. Only my tuner shows up on that webpage and also when I run http://ipv4-api.hdhomerun.com/discover, nothing else and definitely no DVR.
This will happen if you have pointed the DVR engine to a folder it can't write read/write to..
The Engine can't proceed further - so you need to set the RecordPath to something valid that the httpdusr can write to.
If you are creating a new folder/share on the new volume you will need to make sure httpuser has permissions to it.
I've been working with SD support since then but multiple attempts to delete and re-install the app on my NAS have resulted in nothing. I let my DVR license renewal lapse in Jan because I was frustrated that I couldn't set up any recordings so why pay for it, and then I saw the new QPKG v0.9.35. I installed the new version and it sort of helped in that I could now see previous recordings that I had saved in the original Multimedia/HDHomeRunDVR folder.
Probably because it mapped to the correct (and valid) RecordPath once again.
I decided to resubscribe to the DVR again to see if everything came back and recordings from my old timers in the kodi app restarted to the old directory on Feb 1 when I renewed my subscription. I still however cannot see the UI and still get the 'Forbidden' error on my PC.
See above for fix that may help with app in QTS, and what I suspect is wrong with browser access.
instead, it was in /share/MD0_DATA/.qpkg/HDHomeRunDVR/
QNAP has 2 different storage systems.
For future - you should run the following first to determine the default storage volume

Code: Select all

getcfg SHARE_DEF defVolMP -f /etc/config/def_share.info 
Then the config file will be in .qpkg/HDHomeRunDVR from there
Any suggestions on what I can do to get access to the HDHomeRunDVR UI from my PC and have it show up in my.hdhomerun.com profile? Is there another config or directory on my NAS that was possible corrupted back in December such that I can no longer see the UI?
It seems your efforts to move the RecordPath have broken a few things.. so it's a matter of one by one breaking down things to see where you broke it. Once we undo the breaks it should bring back access.

fongw2
Posts: 7
Joined: Fri Feb 02, 2018 12:40 pm

Re: QNAP QPKG for DVR Record Engine

Post by fongw2 » Mon Feb 04, 2019 7:16 pm

Thanks for responding. I tried the following as requested:
This is a known issue I've not been able to replicate directly.
@numus managed to get some info and I posted what I think could be a fix, but unfortunately no-one has responded to whether it works or not.
viewtopic.php?p=337629#p337629
Step 1:
So..
First can you please confirm that your config/apache/apache.conf does have the X-Frame-Options set,
i.e. grep -iC4 x-frame-option /etc/config/apache/*
I ran that command and got an error. Not sure why, perhaps it is because I am only running phpMyAdmin Q4.0.10.20 instead of 5.6 or higher? That's the only version available on the App Centre on my NAS. I'm not very experienced with putty but I made the following change based on the error message and got the following output:

[/] # grep -iC4 x-frame-option /etc/config/apache/*
grep: invalid option -- 4
BusyBox v1.01 (2019.01.01-19:01+0000) multi-call binary

Usage: grep [-ihHnqvs] PATTERN [FILEs...]

Search for PATTERN in each FILE or standard input.

Options:
-H prefix output lines with filename where match was found
-h suppress the prefixing filename on output
-i ignore case distinctions
-l list names of files that match
-n print line number with output lines
-q be quiet. Returns 0 if result was found, 1 otherwise
-v select non-matching lines
-s suppress file open/read error messages

[/] # grep -i x-frame-option /etc/config/apache/*
/etc/config/apache/apache.conf: Header always append X-Frame-Options SAMEORIGIN
/etc/config/apache/apache.conf.orig: Header always append X-Frame-Options SAM EORIGIN
/etc/config/apache/apache.conf.tmp: Header always append X-Frame-Options SAM EORIGIN
[/] #

Since mine does not have all of the parameters that yours seems to have, I couldn't run your additional commands. Let me know if there is anything else you would like me to try.
So 2 tests here..
1. Check the install directory of the QPKG
CODE: SELECT ALL

getcfg HDHomeRunDVR Install_Path -f /etc/config/qpkg.conf
2. Check the Web page link
CODE: SELECT ALL

ls -l /share/Web/HDHomeRunDVR
They should almost match - the Web link will have additional subfolder /ui/ but otherwise should be close.
As you suggested, they essentially are the same except for the /ui/:

[/] # getcfg HDHomeRunDVR Install_Path -f /etc/config/qpkg.conf
/share/MD0_DATA/.qpkg/HDHomeRunDVR
[/] # ls -l /share/Web/HDHomeRunDVR
lrwxrwxrwx 1 admin administ 37 Jan 25 13:57 /share/Web/HDHomeRunDVR -> /share/MD0_DATA/.qpkg/HDHomeRunDVR/ui/
This will happen if you have pointed the DVR engine to a folder it can't write read/write to..
The Engine can't proceed further - so you need to set the RecordPath to something valid that the httpdusr can write to.
If you are creating a new folder/share on the new volume you will need to make sure httpuser has permissions to it.
Is httpdusr a user I need to create or is it created by your package? I don't see it in the list of users but I think I may have deleted it since I wasn't sure who/what it was when I was was previously checking the folder permissions, my bad.

Thanks!

blocklanders
Posts: 1
Joined: Wed Feb 13, 2019 1:18 pm

Re: QNAP QPKG for DVR Record Engine

Post by blocklanders » Wed Feb 13, 2019 1:28 pm

demonrik wrote:
Sun Jan 20, 2019 4:41 pm
is a good find.
That points to an apache configuration difference between our NASes!!

Looking now I see that under default-config/apache.conf there is the following

Code: Select all

<IfModule headers_module>
Header always append X-Frame-Options SAMEORIGIN "env=!share-iframe"
Header always edit Set-Cookie ^(.*)$ $1;HttpOnly
</IfModule>
but my config/apache/apache.conf file doesn't have any headers_module in the conf file.
I wonder if qnap added it at some point, but it never got applied to my installation

So..
First can you please confirm that your config/apache/apache.conf does have the X-Frame-Options set,
i.e.

Code: Select all

grep -iC4 x-frame-option /etc/config/apache/*
If so..
Can you comment out that line so it looks more like

Code: Select all

<IfModule headers_module>
#Header always append X-Frame-Options SAMEORIGIN "env=!share-iframe"
Header always edit Set-Cookie ^(.*)$ $1;HttpOnly
</IfModule>
then restart apache

Code: Select all

/etc/init.d/Qthttpd.sh restart
Let me know how it goes.
I'm running QTS 4.3.6.0805 on a TS-251a, with version 0.9.34 of the DVR. I commented out --> Header always append X-Frame-Options SAMEORIGIN "env=!share-iframe" from my apache.conf and I can now launch the DVR directly form the UI.

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

Re: QNAP QPKG for DVR Record Engine

Post by demonrik » Wed Feb 13, 2019 1:35 pm

blocklanders wrote:
Wed Feb 13, 2019 1:28 pm
demonrik wrote:
Sun Jan 20, 2019 4:41 pm
is a good find.
That points to an apache configuration difference between our NASes!!

Looking now I see that under default-config/apache.conf there is the following

Code: Select all

<IfModule headers_module>
Header always append X-Frame-Options SAMEORIGIN "env=!share-iframe"
Header always edit Set-Cookie ^(.*)$ $1;HttpOnly
</IfModule>
but my config/apache/apache.conf file doesn't have any headers_module in the conf file.
I wonder if qnap added it at some point, but it never got applied to my installation

So..
First can you please confirm that your config/apache/apache.conf does have the X-Frame-Options set,
i.e.

Code: Select all

grep -iC4 x-frame-option /etc/config/apache/*
If so..
Can you comment out that line so it looks more like

Code: Select all

<IfModule headers_module>
#Header always append X-Frame-Options SAMEORIGIN "env=!share-iframe"
Header always edit Set-Cookie ^(.*)$ $1;HttpOnly
</IfModule>
then restart apache

Code: Select all

/etc/init.d/Qthttpd.sh restart
Let me know how it goes.
I'm running QTS 4.3.6.0805 on a TS-251a, with version 0.9.34 of the DVR. I commented out --> Header always append X-Frame-Options SAMEORIGIN "env=!share-iframe" from my apache.conf and I can now launch the DVR directly form the UI.
Thank you so much for replying and confirming..
You have confirmed my suspicions.. Will add to the mitigations/workarounds post at the start of the thread.
Not sure when they added it - but definitely an issue for many :(

fongw2
Posts: 7
Joined: Fri Feb 02, 2018 12:40 pm

Re: QNAP QPKG for DVR Record Engine

Post by fongw2 » Wed Feb 20, 2019 8:46 pm

I figured out how to edit the file in putty and was able to comment out that Header line and now I can also launch the DVR from the QNAP UI. I still have an issue with the DVR though. I only show data under two of the tabs, the Server and Logs tabs. The HDHRs shows nothing while I assume it should show my HDHomeRun device and the Recordings tab shows nothing though I know that I have recordings in the default folder that shows up under the Server tab.

Any ideas why these two tabs don't show any info?

Thanks.

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

Re: QNAP QPKG for DVR Record Engine

Post by demonrik » Thu Feb 21, 2019 7:53 am

fongw2 wrote:
Wed Feb 20, 2019 8:46 pm
I figured out how to edit the file in putty and was able to comment out that Header line and now I can also launch the DVR from the QNAP UI. I still have an issue with the DVR though. I only show data under two of the tabs, the Server and Logs tabs. The HDHRs shows nothing while I assume it should show my HDHomeRun device and the Recordings tab shows nothing though I know that I have recordings in the default folder that shows up under the Server tab.

Any ideas why these two tabs don't show any info?

Thanks.
If your missing those 2 tabs then something is up with getting the response from the discover URL on the NAS.
In the UI there is a file includes/dvrui_common.php which has a function called 'getJsonFromUrl'
This is a wrapper function to process json from URL.
My guess is it's failing for some reason..
I'm at work right now, and unable to check the NAS to see if this will report errors to the log file.. Let me get back to you later, and see if we can get more info on why this is failing.

fongw2
Posts: 7
Joined: Fri Feb 02, 2018 12:40 pm

Re: QNAP QPKG for DVR Record Engine

Post by fongw2 » Fri Feb 22, 2019 11:40 am

Sorry, just to clarify, the tabs are all there but clicking on them shows nothing under 'HDHRs' and for the 'Recordings' it actually reports 'No recordings' even though the Record engine is running and I am able to record shows to the default file location /Multimedia/HDHomeRunDVR.

Thanks!

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

Re: QNAP QPKG for DVR Record Engine

Post by demonrik » Fri Feb 22, 2019 2:22 pm

fongw2 wrote:
Fri Feb 22, 2019 11:40 am
Sorry, just to clarify, the tabs are all there but clicking on them shows nothing under 'HDHRs' and for the 'Recordings' it actually reports 'No recordings' even though the Record engine is running and I am able to record shows to the default file location /Multimedia/HDHomeRunDVR.

Thanks!
Yep - that's the URL failing to load.
It could be restriction on the NAS, or a failure in the file to get the data, etc..
Basically - the UI is requesting the following URL 'http://api.hdhomerun.com/discover'
This is a text of your discovered HDHomerun devices including the DVR
We then use this info to get a) a list of HDHomerun devices and b) the URL to the recording instances of the engine
If it fails you get neither.

Post Reply