Jump to content

Watched List - Library.db


MagicPinball

Recommended Posts

MagicPinball

I want to backup just the watched status databaseon on my Synology NAS using the Emby package.  Using WinSCP,  I see library.db in the "/var/packages/EmbyServer/var/data" folder.  Using WinSCP, I can copy library.db to a local Windows folder.  But, I cannot copy back to the NAS.  I get a permission error.  I try to change the permission error : chmod: changing permissions of 'library.db': Operation not permitted.  How do I change the permission to library.db so I can copy my local file to the NAS?  My knowledge of linux is minimal.

Edited by MagicPinball
Link to comment
Share on other sites

MagicPinball

I tried to create a script and run it as a Synology Scheduled Task.  I tried using pscp.exe within the script and then I realized, how would Synology find the correct PC to excute it.  I really do not know linux.  I know basic ls, cp, cd, chmod and a couple other commands and that is my limit.  I do know Windows very well.

I also tried:
cp /var/packages/EmbyServer/var/data/ /volume1/Download/library.db
which worked.  But the reverse got this error, same as in WinSCP

 
 
Standard output/error: cp: cannot create regular file '/var/packages/EmbyServer/var/data/library.db': Permission denied

I assume you showed me the Synology Scheduled Task and that would bypass the permission issue?

I just want to be able to copy library.db to/from Synology to/from Windows.  If it wasn't for the permission issue, this would be simple (I think)

Any further info/suggestions?

Edited by MagicPinball
Link to comment
Share on other sites

MagicPinball

All I am trying to do is backup/restore the watched list using library.db.  I just cannot restore the file given the permissions.  Any help?

Link to comment
Share on other sites

Hi @MagicPinball if the file is on the Synology Server then you'll need to change the permissions from there, not from Windows. Can you please take a look at this article:

it goes over how to set permissions in Synology. Please let us know if this helps. Thanks.

Link to comment
Share on other sites

One other thing, is Emby Server on Synology running when you try to do this? Make sure to shut it down first. You won't be able to replace the file while the server is using it.

Link to comment
Share on other sites

unisoft
On 07/12/2022 at 02:57, MagicPinball said:

All I am trying to do is backup/restore the watched list using library.db.  I just cannot restore the file given the permissions.  Any help?

login as root user in WinSCP?

You'll have to change Synology's default password first.

log in as "admin" then run sudo su - to become "root". The sudo password is identical to the password of the "admin" user. 

Alternative method here using Telnet for a short time:

https://primalcortex.wordpress.com/2012/08/25/synology-dsm-root-password-for-ssh/

 

 

Link to comment
Share on other sites

MagicPinball

Luke, The directory I am trying to access (/var) is off the root and not accessible from a Shared Folder.  Cannot change file permissions from there.

Unisoft, I've tried to run the "sudo su -" command a couple different ways in WinSCP using SFTP and SCP protocols.  I cannot seem to get this to work.  I am not familiar with WinSCP and only guessing how to use your instructions.  Any help?

Link to comment
Share on other sites

unisoft
23 hours ago, MagicPinball said:

Luke, The directory I am trying to access (/var) is off the root and not accessible from a Shared Folder.  Cannot change file permissions from there.

Unisoft, I've tried to run the "sudo su -" command a couple different ways in WinSCP using SFTP and SCP protocols.  I cannot seem to get this to work.  I am not familiar with WinSCP and only guessing how to use your instructions.  Any help?

Did you use telnet or SSH and login as admin user first? After you connect and change the password (like I did), I then just login using WinSCP and root and can do anything (so far anyway) on the NAS.

Link to comment
Share on other sites

MagicPinball

image.thumb.png.ef4b0ca2ed82108ff982d1def6039fbc.png

I was able to change the permission as shown in WinSCP, but the copy still didn't work.

Edited by MagicPinball
Link to comment
Share on other sites

is Emby Server on Synology running when you try to do this? Make sure to shut it down first. You won't be able to replace the file while the server is using it.

Link to comment
Share on other sites

Happy2Play
6 minutes ago, Luke said:

is Emby Server on Synology running when you try to do this? Make sure to shut it down first. You won't be able to replace the file while the server is using it.

@MagicPinball Per the image all other dbs are closed so it suggests the library.db did not close properly.

Link to comment
Share on other sites

When ever you copy database files you MUST shutdown Emby first.  It's possible you copied the file when Emby was open which could corrupt the database.  Then of course putting it back is going to cause issues.

I don't use WinSCP as I just use the Synology File Manager to grab files from my local system while copies them to the proper directory (or vice versa).
Normally File Manager can't see anything under the @appdata directory, but I didn't like that so I "fixed it" for my own use.

I haven't shared how to do this as Synology hid these folders on purpose but if you do it the way I do it, mapping to my own home directory it's only available to my own username.

If there's interest in this I'll write up a tutorial how to do this along with how to set permissions of the Emby files which I could setup to run as a Task Schedule manual run job.  That should make life a little easier.

I can also include how to reset Emby file permissions via SSH as well in case this is needed.  Worse case the task manager script will make sense by understanding the procedure from the command line.

Carlo

PS I would want a couple advanced Linux guys running a Synology NAS to test first. Then let me know if they see any issues before I'd release this info publicly.

Edited by cayars
  • Like 1
Link to comment
Share on other sites

Eigeplackter
3 minutes ago, cayars said:

I haven't shared how to do this as Synology hid these folders on purpose but if you do it the way I do it, mapping to my own home directory it's only available to my own username.

If there's interest in this I'll write up a tutorial how to do this along with how to set permissions of the Emby files which I could setup to run as a Task Schedule manual run job.  That should make life a little easier.

I can also include how to reset Emby file permissions via SSH as well in case this is needed.  Worse case the task manager script will make sense by understanding the procedure from the command line.

+1 Would really appreciate it.

I‘m not really deep into linux, but since I own the syno I‘m „forced“ to learn my bit every day tinkering to fullfill some wishes😜 

So probably no candidate for the beta test, but really looking fwd to it.

Link to comment
Share on other sites

MagicPinball

This would be good if not too complicated.  My Linux knowledge is minimal at best.  But if someone could help with accessing library.db, that would be great.  And yes, Emby server is shutdown before copying to/from Synology NAS.

Question: I noticed that "emby" is the owner of this file.  What if I create an account named "emby"?

Link to comment
Share on other sites

"Emby" isn't a normal account but a system internal account. You can switch the owner a file via File Station so that's the easy part.
If you have any spare time later tonight or tomorrow I could write it up, Teamview in with you to let you follow the instructions as I watch.

I could then help you get this fixed up and working well again.

Carlo

Link to comment
Share on other sites

MagicPinball

Thank you for your offer, but given the time of year, I don't have the time.

My version of Emby in Synology is working perfectly.  I just wanted to grab a copy of watched movies (library.db), which I can do.  If needed, I wanted to be able to replace library.db in case of an issue.  This step eludes me, given the permissions.

If there is a write-up available, I could try it next week,  My PC knowledge is excellent; my Linux is poor.

Link to comment
Share on other sites

  • 1 month later...
MagicPinball

Is there a write-up on this process?

You stated " You can switch the owner a file via File Station..."  The problem is that you cannot navigate higher than Synology's Shared folders.

Link to comment
Share on other sites

55 minutes ago, MagicPinball said:

Is there a write-up on this process?

You stated " You can switch the owner a file via File Station..."  The problem is that you cannot navigate higher than Synology's Shared folders.

Hi, where exactly are you getting stuck?

Link to comment
Share on other sites

MagicPinball

In this thread, I have described how I can get library.db for backup (primarily for watched status).  The problem is restoring library.db, if needed.  I am using Emby in a Synology NAS.  I restore a copy of the file because the owner is Synology and I cannot change that permission, thus I get a permision error when trying to copy it to the NAS.  I have supplied screen shots earlier in this thread. @cayars

Link to comment
Share on other sites

By far the easiest method is using Emby's Configuration Backup plugin which easily handles full or partial restores as well.

I'm not sure what you mean by the "owner is Synology" as that isn't normally a valid username in the DSM OS running on Synology.  But it really doesn't matter what the owner of the file is currently as you need to SSH into the box.  Go Super User, then copy the database file overtop the present file (while Emby is Shutdown).

Then after the file is in place you would need to change ownership and then set access permissions. The 4 commands you would use at the command line in SSH are "sudo -i" to start an interactive super user session, cp to do the copying, chown to change owner and chmod to change/modify permissions. 

After doing the above you can restart Emby Server.  If you have trouble figuring this out, send me a PM and we can setup and do a remote support session and I'll assist you with the above,

Carlo

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...