Database Issues on Unraid

I just wanted to clarify the proper Unraid setup. I was running into some database issues at first all sorts of Sqlite errors that I couldn’t even read as the docker would crash so quickly in a loop. I initially had my database on a share on my array but I’ve since moved it to my appdata. Since doing that and setting PS_FORCE_LOCAL_DB_REPLICA=true (I had it as false also) it seems to have cleared up. I’m wondering if I happened to have something misconfigured that is commonly known. I’m running 2.1.0-alpha7 as I couldn’t get the stable build to even load on Unraid. I really hope my database doesn’t end up corrupted again because I really love the look and feel of the program and I’m hoping it can be a long term solution for me. As an aside I have my pictures on Dropbox mounted via rclone. I’m hoping that isn’t part of the issue.

Edit: on second thought I think it broke after I edited settings.toml over SMB. I’m wondering if I created a permissions issue?

There are several of us that use PhotoStructure on Unraid with minimal issues. Can you share your container set up so we can verify that everything looks good? I’m sure we can get you going!

Sure thanks for your help! /upload and /photo both point to my rclone mount.

I tinkered around with this a little more and I was able to reproduce these issues by deleting my photostructure appdata folder and letting the docker re-create it. It seems that with the Unraid template the appdata/library folder permissions aren’t set correctly at times. I set the permissions manually to drwxrwxrwx and things seem stable. Looking back I think I was having some odd permissions issues based on the quick flash of the logs I was able to see at the time. My library is now reindexing and everything seems good. I assume once the new stable version releases the docker template may be updated?

OK… glad you are running now!

A couple of quick followup questions just to make sure we have you set up the best way possible:

  1. do you have an SSD cache in your Unraid setup?
  2. are you using photostructure’s auto-organization feature?

Yes. I’m running an SSD for my cache pool. I’m running 6.12-rc5 where the nomenclature for Cache (yes, no prefer) has changed given the addition of ZFS pools but my appdata is essentially set to prefer. In 6.12 primary storage for appdata is set to cache and the mover action is set to array → cache. I’m not using the auto-organization. I have my library hand-organized a certain way I like so I didn’t want PhotoStructure to change any of that. I’m assuming running 2.1.0-alpha7 is the preferred build for most people?

Yes, 2.1.0-alpha7 is the way to go right now!

Your setup looks good to me… the only thing I would consider changing is getting rid of the Temp/Scratch disk path, as that is not needed (Photostructure will create a temp directory inside your library automatically).

How’s your experience been with Unraid 6.12 so far? I usually wait for the dot 1 release before I upgrade, so I haven’t looked at it yet. Seems like there was some initial confusion on how cache is configured now, but it looks like it’s more of a semantic change rather than a functional one.

I find that the new UI for configuring cache within shares actually makes more sense now to those who aren’t familiar with Unraid. 6.12 has been stable for me so far. I still have issues with Windows locking when I try to use VirtioFS in my VM which has been an issue since they released that feature so I keep that disabled and use SMB. Other than that there have been some changes with Plugins that require developers to make significant updates. The big one has been a rewrite of the Appdata Backup plugin, that has been entirely replaced and rewritten by the developer so there is some user intervention required to remove/replace deprecated plugins.

If I remove the scratch disk path will that break anything now that my library is indexing or do I need to recreate the appdata after doing that?

It won’t hurt anything… but I would wait until your sync is done. Once sync is done, stop the Photostructure container, remove the path, and then start it back up. You’ll be all set!

It’s strange I just stopped my container for something else. I changed my log level from debug back to error on restarting I got a ton of Sqlite errors!

Then I went into the Unraid file manager and changed the permissions on my appdata folder again:

After doing that I’m back up. I’m wondering if it was because I ran a userscript:

 docker exec PhotoStructure ./photostructure sync

I get a permissions warning when I do that and I’m thinking that may have been the root cause of my issues. Is there another switch I need when running a manual sync from the command line to keep the permissions set properly?

I think @mrm needs to chime in on this… it’s not clear to me that SQLITE_READONLY is a file permission issue, or just a state within the SQL database.

For what it’s worth, I’ve not had any file permission issues with photostructure since setting the UMASK to 0002.

Thanks for your help. I think this was PEBKAC on my part. Perhaps @mrm can confirm for me. I changed my command to docker exec -u node and things seem better. Once my sync finishes I’m going to restart my docker but so far it seems that the permissions errors are gone. This forum post helped. I think when I was running that script it was changing the ownership of my database to root. It was also warning me of this my I very intelligently ignored that warning. :confused:

Edit: my sync finished and I was able to run docker exec -u node PhotoStructure ./photostructure sync with no further permission errors.

Sorry for being late to this party–I was going to suggest this post as a solution–glad it worked.

FWIW, I’ve made a bunch of improvements in the next release to both the dockerfile and the to both highlight as well as try (harder) to avoid running as root, as it can cause all sorts of pain and suffering. I also added a new health check to specifically call out running as root.

Thanks so much for the response. I was running into some other issues where random pictures would appear and then disappear with an asset not found message with seemingly no way to fix it. I tried manually syncing at the command line and also a library rebuild with no luck. I decided to give up for now since it was getting stressful to try and troubleshoot. It’s really genius how PhotoStructure shows different photos every time. I love that! My only issue is I work IT all day so when I get home I just want things to work with minimal tweaking. As I’ve gotten older I’ve gotten sick of maintaining things. When the new update drops I’m definitely going to try it! I really believe good software is worth paying for and will absolutely get a year of Plus once things are more stable on my server. Do you think it’s coming soon? Thanks!

@mrm I decided to give PhotoStructure another try today. Out of every solution I’ve tested yours is the best! Do you know how I can get around those asset not found messages when pictures sometimes disappear and suddenly reappear? Also is 23.5 coming soon? It seems like that is going to fix pretty much every problem I’m experiencing so I’m excited to try that! I really want to pay for Plus, but I just want to make sure my setup is stable first.