PhotoStructure for Servers - Command Line Tools - "Cannot determine appData" error

I installed PhotoStructure for Servers v0.9.1 on a Ubuntu 20.04 VM, following the instructions for node, and when trying any of the command line tools, i’m getting a “Cannot determine appData” error. Full stack trace below for running one of the commands (for example, info):

#> ./photostructure info
Failed  Error: Cannot determine appData¹
    at a.thunk (/home/photostructure/photostructure-for-servers/bin/info.js:3:902)
    at apply (/home/photostructure/photostructure-for-servers/bin/info.js:3:454609)
    at Object.t.defaultLogDir (/home/photostructure/photostructure-for-servers/bin/info.js:3:63344)
    at defaultValue (/home/photostructure/photostructure-for-servers/bin/info.js:3:324225)
    at Object.t.tot (/home/photostructure/photostructure-for-servers/bin/info.js:3:472259)
    at t.StringSetting.get defaultValue [as defaultValue] (/home/photostructure/photostructure-for-servers/bin/info.js:3:315302)
    at t.StringSetting.get valueOrDefault [as valueOrDefault] (/home/photostructure/photostructure-for-servers/bin/info.js:3:315519)
    at Object.t.setupLogger (/home/photostructure/photostructure-for-servers/bin/info.js:3:64316)
    at Object.g [as setServiceName] (/home/photostructure/photostructure-for-servers/bin/info.js:3:86063)
    at new t.CLI (/home/photostructure/photostructure-for-servers/bin/info.js:3:498342)

Any ideas, perhaps something i’ve not configured correctly? The web UI has been running fine, and it appears to have synced at least a few times, but there were some images from earlier this month that hadn’t yet synced so I was going to look into the logs to see when things last ran and came upon this.

Thanks in advance for the help!

Did you try to run start.sh first? It installs all the missing dependencies and the issue you are having won’t appear.

This error will show up if PhotoStructure can’t determine your “app data” directory.

On Windows, this defaults to PS_CONFIG_DIR or %APPDATA% (typically ~/AppData/Roaming)

On macOS, this is PS_CONFIG_DIR or ~/Library/Application Support.

On Linux, PhotoStructure looks at PS_CONFIG_DIR, XDG_DATA_HOME, XDG_CONFIG_HOME, and then defaults to ~/.config.

From this list of directories:

  1. PhotoStructure returns the first path that is already a directory.

  2. If no paths are directories, it returns the first path that it can create.

  3. If it can’t create any directories, it throws this error.

So: I suspect your user permissions are wonky: you may want to check the ownership of ~/.config. It may be owned by root, or is a file.

The simplest solution would be to make ~/.config a directory that is owned by your user. Many other apps will have issues if this isn’t a writable directory: it’s not just PhotoStructure.

If you don’t like that solution, and want PhotoStructure to use a different configuration directory, say, ~/.photostructure, add this to your .bashrc or .bash_login:

export PS_CONFIG_DIR="$HOME/.photostructure"

and then run

mkdir -p $HOME/.photostructure

Holler if this doesn’t fix it!

(Also, sorry that this topic was unlisted and then listed: I was on mobile and a bad tap clicked the wrong thing)

Thanks Matthew! That makes sense.

In case others run into this issue - I was logged in to the console for this VM as root and running the command. I tried changing to ~/.config and it (/root/.config/) didn’t exist, so that was why photostructure couldn’t find it. I suspect that it would still not work if /root/.config/ existed and wasn’t owned by the photostructure user.

If I login as the photostructure user I created:
sudo --login --user photostructure bash
…and then run ./photostructure info it works just fine. So is this ./photostructure command trying to run as the photostructure user or just the logged in user (I guess logged in)?

1 Like

No: PhotoStructure doesn’t do any user shenanigans. It just runs as the user that runs it.