Library on samba share

Hello.
Just installed photostructure, trying to have one photo library in home.
My setup is - latest ubuntu server vm on proxmox and I want to keep my library on my freenas smb share.

on ubuntu vm I’m mounting smb share by systemd .mount file:

[Unit]
Description=CIFS Mount
Requires=network-online.target
After=network-online.service

[Mount]
What=//192.168.0.110/zdjecia
Where=/media/zdjecia
Options=guest,rw,file_mode=0777,dir_mode=0777,vers=3.0
Type=cifs

[Install]
WantedBy=multi-user.target

Photostructure is installed according to PhotoStructure for Node ubuntu instructions.
Photostructure service is also set up according to your instructions.

I can write and create directories as photostructure user to mounted smb share.

But when setting up, I get error “Cannot write to /media/zdjecia/PhotoStructure. Please choose a different directory for your library.”

Oh and I also tried to add .uuid file as in your instructions to /media/zdjecia

Could someone point me in direction what should I check next?

thanks.

Howdy @btd, welcome to PhotoStructure!

Apologies that things didn’t “just work”!

That permission error happens when there are file operation errors due to insufficient permissions, or (much rarer), a buggy CIFS implementation where readdir doesn’t match the actual contents of the directory. To try to avoid issue from related issues, PhotoStructure does a mkdir in your library directory and copies a file into the new directory, and then verifies that the directory exists and the SHA of the copied file is correct.

I had FreeNAS test box running a while back that seemed to work OK (I nuked and paved it with UnRAID: I just didn’t have any users on FreeNAS (!!)), so I’m convinced that this is the issue.

Does everything work if your library is stored on a local volume?

The other issue that pops up with libraries on remote filesystems is due to SQLite. This issue and solution is detailed here:

If none of this addresses your issue, can you could send me logs? (Note that I’ve currently trying to ship v1.2, so it’s going to take several days before I can look at them).

Thx for reply.

When setting my library on local volume everything works fine.

I have tried with PS_FORCE_LOCAL_DB_REPLICA=true env variable but it didn’t help.

When I do sudo --login --user photostructure bash I can write as photostructure user to mounted smb share without any problem.

Anyone have any pointers to check with permissions? Create photostructure user on freenas box?

To add:
I have set logging level to info by environment variable, but logs are empty when I try to setup library on smb share.

Ideally you don’t have to do any user mapping in samba: matching userids on the mountpoint would certainly make things simpler.

OK, shut it down, and in a new terminal, run this:

cd ~/photostructure-for-servers
./photostructure --verbose

(this will emit to stdout, so we’re not fighting any file permissions)

ok so those are the logs, copied from terminal:

btd@photos:~$ sudo --login --user photostructure bash
photostructure@photos:~$ cd photostructure-for-servers/
photostructure@photos:~/photostructure-for-servers$ ./photostructure --verbose
LogTail(): Tailing /home/photostructure/.config/PhotoStructure/logs/**/*.log...
PhotoStructure is ready: <http://localhost:1787/>
2021-08-31T16:32:35.127Z main-1260 info  SettingsIO.importFileSettings(/home/photostructure/.config/PhotoStructure/settings.toml) loaded { imported: { copyAssetsToLibrary: true, scanAllDrives: false } }
2021-08-31T16:32:35.130Z main-1260 info  mergeAndArchiveSystemSettingsDir_(.config/PhotoStructure/PhotoStructure => photostructure/.config/PhotoStructure) no-op, missing or same directory { currentResolvedConfigDir: '/home/photostructure/.config/PhotoStructure' }
2021-08-31T16:32:35.136Z main-1260 info  mergeAndArchiveSystemSettingsDir_(.config/PhotoStructure/photostructure => photostructure/.config/PhotoStructure) no-op, missing or same directory { currentResolvedConfigDir: '/home/photostructure/.config/PhotoStructure' }
2021-08-31T16:32:35.138Z main-1260 info  mergeAndArchiveSystemSettingsDir_(photostructure/.config/photostructure => photostructure/.config/PhotoStructure) no-op, missing or same directory { priorResolvedConfigDir: '/home/photostructure/.config/PhotoStructure',
  currentResolvedConfigDir: '/home/photostructure/.config/PhotoStructure' }
2021-08-31T16:32:35.139Z main-1260 info  MergeConfigDirs done
2021-08-31T16:32:35.150Z main-1260 info  SettingsIO.importFileSettings(/home/photostructure/.config/PhotoStructure/settings.toml) loaded { imported: { copyAssetsToLibrary: true, scanAllDrives: false } }
2021-08-31T16:32:35.151Z main-1260 info  SettingsIO _libraryHasSettings { result: false }
2021-08-31T16:32:35.163Z main-1260 info  Sentry Sentry initialized { isElectron: false }
2021-08-31T16:32:35.169Z main-1260 info  Service(main) setup() { version: '1.1.0',
  start: 1630427554109,
  argv:
   [ '/usr/bin/node',
     '/home/photostructure/photostructure-for-servers/bin/main.js',
     '--verbose' ],
  arch: 'x64',
  platform: 'linux',
  isDocker: false,
  os: 'Ubuntu 20.04.3 LTS on x64',
  isPacked: true,
  isElectron: false,
  versions:
   { node: '16.8.0',
     v8: '9.2.230.21-node.20',
     uv: '1.42.0',
     zlib: '1.2.11',
     brotli: '1.0.9',
     ares: '1.17.2',
     modules: '93',
     nghttp2: '1.42.0',
     napi: '8',
     llhttp: '6.0.2',
     openssl: '1.1.1k+quic',
     cldr: '39.0',
     icu: '69.1',
     tz: '2021a',
     unicode: '13.0',
     ngtcp2: '0.1.0-DEV',
     nghttp3: '0.1.0-DEV' },
  settings: { logLevel: 'info', httpPort: 1787, rpcPort: 1807 },
  NODE_ENV: 'production',
  PS_EXPOSE_NETWORK_WITHOUT_AUTH: '1',
  PS_FORCE_LOCAL_DB_REPLICA: 'true',
  PS_LOG_LEVEL: 'info',
  PS_TAIL_LOGS: 'true' }
2021-08-31T16:32:35.202Z main-1260 info  RpcServer Setting up RPC...
2021-08-31T16:32:35.209Z main-1260 info  rpc.Server listening on 1807
2021-08-31T16:32:35.209Z main-1260 info  RpcServer RPC service serving port 1807
2021-08-31T16:32:35.216Z main-1260 info  ChildService pathToService() { result:
   Promise { { nativePath: '/home/photostructure/photostructure-for-servers/bin/web.js' } },
  cmd: 'web.js',
  isPacked: true,
  dirs:
   [ '/home/photostructure/photostructure-for-servers/bin/web.js',
     '/home/photostructure/photostructure-for-servers/app.asar/web.js',
     '/home/photostructure/photostructure-for-servers/dist/app/web.js' ] }
2021-08-31T16:32:35.222Z main-1260 info  WatchedChild(web) _restart() { stopped: false, ended: false }
2021-08-31T16:32:35.223Z main-1260 info  WatchedChild(web) _stop() { stopped: false, ended: false }
2021-08-31T16:32:35.227Z main-1260 info  WatchedChild(web) restart() { startRate: { ctor: 'Rate', epm: undefined, eventCount: 1, msSinceLastEvent: 1700 },
  maxErrorsPerMinute: 3 }
2021-08-31T16:32:35.228Z main-1260 info  WatchedChild(web) _start() { stopped: false, ended: false }
2021-08-31T16:32:35.248Z main-1260 info  WatchedChild(web:1273) _start(): spawned pid 1273
2021-08-31T16:32:36.587Z web-1273 info  SettingsIO.importFileSettings(/home/photostructure/.config/PhotoStructure/settings.toml) loaded { imported: { copyAssetsToLibrary: true, scanAllDrives: false } }
2021-08-31T16:32:36.589Z web-1273 info  SettingsIO _libraryHasSettings { result: false }
2021-08-31T16:32:36.602Z web-1273 info  Sentry Sentry initialized { isElectron: false }
2021-08-31T16:32:36.608Z web-1273 info  Service(web) setup() { version: '1.1.0',
  start: 1630427555432,
  argv:
   [ '/usr/bin/node', '/home/photostructure/photostructure-for-servers/bin/web.js' ],
  arch: 'x64',
  platform: 'linux',
  isDocker: false,
  os: 'Ubuntu 20.04.3 LTS on x64',
  isPacked: true,
  isElectron: false,
  versions:
   { node: '16.8.0',
     v8: '9.2.230.21-node.20',
     uv: '1.42.0',
     zlib: '1.2.11',
     brotli: '1.0.9',
     ares: '1.17.2',
     modules: '93',
     nghttp2: '1.42.0',
     napi: '8',
     llhttp: '6.0.2',
     openssl: '1.1.1k+quic',
     cldr: '39.0',
     icu: '69.1',
     tz: '2021a',
     unicode: '13.0',
     ngtcp2: '0.1.0-DEV',
     nghttp3: '0.1.0-DEV' },
  settings: { logLevel: 'info', httpPort: 1787, rpcPort: 1807 },
  NODE_ENV: 'production',
  PS_EXPOSE_NETWORK_WITHOUT_AUTH: 'true',
  PS_FORCE_LOCAL_DB_REPLICA: 'true',
  PS_LOG_LEVEL: 'info' }
2021-08-31T16:32:36.623Z main-1260 info  rpc.Server Connection from IPv4:127.0.0.1:42068
2021-08-31T16:32:36.701Z web-1273 info  WebService Setting up settings router...
2021-08-31T16:32:36.706Z web-1273 info  WebService online { httpPort: 1787,
  ips: [ '127.0.0.1', '::1', '192.168.0.22', 'fe80::3c1c:42ff:fe97:1dcb' ] }
2021-08-31T16:32:36.710Z main-1260 info  MainService Got HTTP port number from web service:1787
2021-08-31T16:32:47.836Z web-1273 info  WebService Setting up welcome router...
2021-08-31T16:32:48.355Z web-1273 info  SystemIds cpuid failed {}
2021-08-31T16:32:51.250Z web-1273 info  LibrarySettings librarySettings { result: { scanAllDrives: false, scanPath: [], copyAssets: true, reportErrors: true } }
2021-08-31T16:32:51.250Z web-1273 info  SettingsRouter requestSettings { scanAllDrives: false, scanPath: [], copyAssets: true, reportErrors: false }
2021-08-31T16:32:51.250Z web-1273 info  LibrarySettings librarySettings { result: { scanAllDrives: false, scanPath: [], copyAssets: true, reportErrors: false } }
2021-08-31T16:32:51.367Z web-1273 info  SuggestedLibraryDir addSuggestion(): path is a library { path: '/home/photostructure/Pictures',
  isLibrary: true,
  vol:
   { filesystem: '/dev/mapper/ubuntu--vg-ubuntu--lv',
     mountpoint: '/',
     size: 21003583488,
     used: 8832237568,
     available: 11080826880,
     ignorable: false,
     remote: false,
     uuid: '036200bf-3274-4ec5-a3a5-2c4722ab0554' },
  isCurrentLibrary: false }
2021-08-31T16:32:51.462Z web-1273 info  SuggestedLibraryDir addVolume(): adding default suggestion '/PhotoStructure'
2021-08-31T16:32:51.499Z web-1273 info  SuggestedLibraryDir addVolume(): adding default suggestion '/media/photos/PhotoStructure'
2021-08-31T16:32:51.512Z web-1273 info  SuggestedLibraryDir addSuggestion(): path is new and in a read/write dir { path: '/media/photos/PhotoStructure',
  s:
   { path: '/media/photos/PhotoStructure',
     isLibrary: false,
     vol:
      { filesystem: '//192.168.0.110/photos',
        mountpoint: '/media/photos',
        size: 1982096661504,
        used: 346112,
        available: 1982096315392,
        ignorable: false,
        remote: true,
        remoteHost: '192.168.0.110',
        remoteShare: 'photos',
        uuid: 'c87fae6c-da04-4668-42b6-f706f0892f4e' },
     isCurrentLibrary: false } }
2021-08-31T16:32:51.643Z web-1273 info  ffmpeg ffmpegVersion { version: '4.2.4-1ubuntu0.1',
  code: 0,
  stdout: 'ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers' }
2021-08-31T16:32:51.645Z web-1273 info  SettingsIO _libraryHasSettings { result: false }
2021-08-31T16:32:51.663Z web-1273 info  SettingsRouter rendering settings { scanAllDrives: false,
  scanPath: [],
  copyAssets: true,
  reportErrors: true,
  welcome: true,
  title: 'Welcome!',
  isVideoTranscodingSupported: true,
  videoToolDetails: 'FFmpeg 4.2.4-1ubuntu0.1',
  picturesPath: '/home/photostructure/Pictures',
  delimiter: ':',
  exampleScanPath: '/home/photostructure/Pictures:/mnt/nas/homes/photos',
  minFreeAvailable: '6 GB',
  suggestedLibraryDirs:
   [ { path: '/home/photostructure/Pictures',
       isLibrary: true,
       vol:
        { filesystem: '/dev/mapper/ubuntu--vg-ubuntu--lv',
          mountpoint: '/',
          size: 21003583488,
          used: 8832237568,
          available: 11080826880,
          ignorable: false,
          remote: false,
          uuid: '036200bf-3274-4ec5-a3a5-2c4722ab0554' },
       isCurrentLibrary: false },
     { path: '/media/photos/PhotoStructure',
       isLibrary: false,
       vol:
        { filesystem: '//192.168.0.110/photos',
          mountpoint: '/media/photos',
          size: 1982096661504,
          used: 346112,
          available: 1982096315392,
          ignorable: false,
          remote: true,
          remoteHost: '192.168.0.110',
          remoteShare: 'photos',
          uuid: 'c87fae6c-da04-4668-42b6-f706f0892f4e' },
       isCurrentLibrary: false } ],
  samplePath: '2021/2021-08-31',
  subTier: 'plus',
  subTrial: true,
  subEmail: 'brandthedwarf@gmail.com',
  subExpiresInDuration: '1 week',
  subExpiresAt: '2021-09-13' }
2021-08-31T16:33:17.396Z web-1273 info  LibrarySettings librarySettings { result: { scanAllDrives: false, scanPath: [], copyAssets: true, reportErrors: true } }
2021-08-31T16:33:17.396Z web-1273 info  SettingsRouter requestSettings { scanAllDrives: false, scanPath: [], copyAssets: true, reportErrors: true }
2021-08-31T16:33:17.396Z web-1273 info  LibrarySettings librarySettings { result: { scanAllDrives: false, scanPath: [], copyAssets: true, reportErrors: true } }
2021-08-31T16:33:17.396Z web-1273 info  SettingsRouter POST { libraryDir: '/media/photos/guest',
  settings: { scanAllDrives: false, scanPath: [], copyAssets: true, reportErrors: true },
  body:
   { libraryDirRadio: 'libraryDirCustom',
     libraryDir: '/media/photos/guest',
     scan: 'scanPath',
     copyAssets: 'copyEnabled',
     reportErrors: 'true',
     action: '' } }
2021-08-31T16:33:17.397Z web-1273 info  LibrarySettings librarySettings { result: { scanAllDrives: false, scanPath: [], copyAssets: true, reportErrors: true } }
2021-08-31T16:33:17.403Z web-1273 info  SettingsIO _libraryHasSettings { result: false,
  libraryDir: '/media/photos/guest',
  librarySettingsFile: '/media/photos/guest/.photostructure/settings.toml' }
2021-08-31T16:33:17.429Z web-1273 warn  BaseFile(/media/photos/guest/.photostructure/.metadata_never_index) trap: utimes() failed: Error: EPERM: operation not permitted, utime '/media/photos/guest/.photostructure/.metadata_never_index'
2021-08-31T16:33:17.522Z web-1273 warn  BaseFile(/home/photostructure/photostructure-for-servers/public/images/splashbg1-1024w.jpg.gz) copyFile_(/media/photos/guest/.tmp-ftzkzn/.write-test.jpg.gz) failed: Error: EPERM: operation not permitted, copyfile '/home/photostructure/photostructure-for-servers/public/images/splashbg1-1024w.jpg.gz' -> '/media/photos/guest/.tmp-ftzkzn/.write-test.jpg.gz'
2021-08-31T16:33:17.525Z web-1273 warn  BaseFile(/media/photos/guest/.tmp-ftzkzn/.write-test.jpg.gz) trap: unlink() failed: Error: ENOENT: no such file or directory, unlink '/media/photos/guest/.tmp-ftzkzn/.write-test.jpg.gz'
2021-08-31T16:33:17.527Z web-1273 warn  BaseFile(/media/photos/guest/.tmp-ftzkzn/write-test.jpg.gz) trap: unlink() failed: Error: ENOENT: no such file or directory, unlink '/media/photos/guest/.tmp-ftzkzn/write-test.jpg.gz'
2021-08-31T16:33:17.528Z web-1273 warn  BaseFile(/home/photostructure/photostructure-for-servers/public/images/splashbg1-1024w.jpg.gz) _copyFile failed, trying _nativeCopyFile { dest: '/media/photos/guest/.tmp-ftzkzn/write-test.jpg.gz',
  src:
   '/home/photostructure/photostructure-for-servers/public/images/splashbg1-1024w.jpg.gz',
  error:
   { errno: -1,
     code: 'EPERM',
     syscall: 'copyfile',
     path:
      '/home/photostructure/photostructure-for-servers/public/images/splashbg1-1024w.jpg.gz',
     dest: '/media/photos/guest/.tmp-ftzkzn/.write-test.jpg.gz' } }
2021-08-31T16:33:17.549Z web-1273 warn  ChildProcess cp(1295) resulted in errors: [ {} ]
2021-08-31T16:33:17.561Z web-1273 warn  LibraryHealthChecks Failed to copy sample file to library. Is /media/photos/guest writable?
2021-08-31T16:33:17.585Z web-1273 warn  LibrarySettings Failed to set up library at /media/photos/guest { cause: {} }
2021-08-31T16:33:17.641Z web-1273 info  SettingsIO maybeWriteFile(): wrote settings { dest: { nativePath: '/home/photostructure/.config/PhotoStructure/.settings.toml' },
  file: { nativePath: '/home/photostructure/.config/PhotoStructure/settings.toml' },
  nonDefaults:
   { copyAssetsToLibrary: true,
     scanAllDrives: false,
     forceLocalDbReplica: true,
     logColor: true,
     logLevel: 'info',
     exposeNetworkWithoutAuth: true },
  wip: true }
2021-08-31T16:33:17.670Z web-1273 info  SettingsIO Equivalent contents { dest: { nativePath: '/home/photostructure/.config/PhotoStructure/.settings.toml' },
  file: { nativePath: '/home/photostructure/.config/PhotoStructure/settings.toml' },
  a: { copyAssetsToLibrary: true, scanAllDrives: false },
  b: { copyAssetsToLibrary: true, scanAllDrives: false } }
2021-08-31T16:33:17.687Z main-1260 info  MainService.restartSync() priorSync
2021-08-31T16:33:17.688Z web-1273 info  SettingsRouter error saving library settings [ { error:
     'Cannot write to /media/photos/guest. Please choose a different directory for your library.' } ]
2021-08-31T16:33:17.689Z web-1273 warn  SettingsRouter fail(): Cannot write to /media/photos/guest. Please choose a different directory for your library.
2021-08-31T16:33:17.706Z main-1260 info  SettingsIO.importFileSettings(/home/photostructure/.config/PhotoStructure/settings.toml) loaded { imported: { copyAssetsToLibrary: true, scanAllDrives: false } }
2021-08-31T16:33:17.706Z main-1260 info  SettingsIO _libraryHasSettings { result: false }
2021-08-31T16:33:17.706Z main-1260 info  MainService.restartSync() restartSync(): no library settings {}
2021-08-31T16:33:17.799Z web-1273 info  SuggestedLibraryDir addSuggestion(): path is a library { path: '/home/photostructure/Pictures',
  isLibrary: true,
  vol:
   { filesystem: '/dev/mapper/ubuntu--vg-ubuntu--lv',
     mountpoint: '/',
     size: 21003583488,
     used: 8832241664,
     available: 11080822784,
     ignorable: false,
     remote: false,
     uuid: '036200bf-3274-4ec5-a3a5-2c4722ab0554' },
  isCurrentLibrary: false }
2021-08-31T16:33:17.866Z web-1273 info  SuggestedLibraryDir addVolume(): adding default suggestion '/PhotoStructure'
2021-08-31T16:33:17.886Z web-1273 info  SuggestedLibraryDir addVolume(): adding default suggestion '/media/photos/PhotoStructure'
2021-08-31T16:33:17.895Z web-1273 info  SuggestedLibraryDir addSuggestion(): path is new and in a read/write dir { path: '/media/photos/PhotoStructure',
  s:
   { path: '/media/photos/PhotoStructure',
     isLibrary: false,
     vol:
      { filesystem: '//192.168.0.110/photos',
        mountpoint: '/media/photos',
        size: 1982096625664,
        used: 345088,
        available: 1982096280576,
        ignorable: false,
        remote: true,
        remoteHost: '192.168.0.110',
        remoteShare: 'photos',
        uuid: 'c87fae6c-da04-4668-42b6-f706f0892f4e' },
     isCurrentLibrary: false } }
2021-08-31T16:33:18.024Z web-1273 info  ffmpeg ffmpegVersion { version: '4.2.4-1ubuntu0.1',
  code: 0,
  stdout: 'ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers' }
2021-08-31T16:33:18.025Z web-1273 info  SettingsIO _libraryHasSettings { result: false }
2021-08-31T16:33:18.027Z web-1273 info  SettingsRouter rendering settings { err:
   'Cannot write to /media/photos/guest. Please choose a different directory for your library.',
  scanAllDrives: false,
  scanPath: [],
  copyAssets: true,
  reportErrors: true,
  welcome: true,
  title: 'Welcome!',
  isVideoTranscodingSupported: true,
  videoToolDetails: 'FFmpeg 4.2.4-1ubuntu0.1',
  picturesPath: '/home/photostructure/Pictures',
  delimiter: ':',
  exampleScanPath: '/home/photostructure/Pictures:/mnt/nas/homes/photos',
  minFreeAvailable: '6 GB',
  suggestedLibraryDirs:
   [ { path: '/home/photostructure/Pictures',
       isLibrary: true,
       vol:
        { filesystem: '/dev/mapper/ubuntu--vg-ubuntu--lv',
          mountpoint: '/',
          size: 21003583488,
          used: 8832241664,
          available: 11080822784,
          ignorable: false,
          remote: false,
          uuid: '036200bf-3274-4ec5-a3a5-2c4722ab0554' },
       isCurrentLibrary: false },
     { path: '/media/photos/PhotoStructure',
       isLibrary: false,
       vol:
        { filesystem: '//192.168.0.110/photos',
          mountpoint: '/media/photos',
          size: 1982096625664,
          used: 345088,
          available: 1982096280576,
          ignorable: false,
          remote: true,
          remoteHost: '192.168.0.110',
          remoteShare: 'photos',
          uuid: 'c87fae6c-da04-4668-42b6-f706f0892f4e' },
       isCurrentLibrary: false } ],
  samplePath: '2021/2021-08-31',
  subTier: 'plus',
  subTrial: true,
  subEmail: 'brandthedwarf@gmail.com',
  subExpiresInDuration: '1 week',
  subExpiresAt: '2021-09-13' }
2021-08-31T16:33:35.257Z web-1273 info  Service(web) --health-check { ok: [ "Library isn't set up yet", 'Memory by web (33 MB) is OK' ],
  warn: [],
  bad: [],
  fail: [] }

This is a file permission issue: PhotoStructure is getting an EPERM when trying to copy the test image into a new temporary directory.

File permissions with SAMBA are easy to get wrong. What I normally resort to is just mounting a given directory hierarchy with the user I want the files to be owned by.

Here’s from my workstation to mount my NAS named “rusty”:

$ grep rusty-home /etc/fstab 
//rusty.local/homes /media/mrm/rusty-home cifs uid=mrm,credentials=/home/mrm/.smbcredentials,iocharset=utf8,sec=ntlmssp 0 0

$ cat ~/.smbcredentials 
username=mrm
password=XXXXXXXXXXXXXXXXXX

HTH!

Mounted as same user as added in truenas, disabled guest access, still nope. When accessing from windows and logging in as added user all works. When browsing this mounted share from this linux vm all works.

logs:

2021-08-31T18:53:28.657Z web-1521 info LibrarySettings librarySettings { result: { scanAllDrives: false, scanPath: , copyAssets: true, reportErrors: true } }
2021-08-31T18:53:28.659Z web-1521 info SettingsIO libraryHasSettings { result: false,
libraryDir: ‘/media/photos/PhotoStructure’,
librarySettingsFile: ‘/media/photos/PhotoStructure/.photostructure/settings.toml’ }
2021-08-31T18:53:28.751Z web-1521 warn BaseFile(/media/photos/PhotoStructure/.photostructure/.metadata_never_index) trap: utimes() failed: Error: EPERM: operation not permitted, utime ‘/media/photos/PhotoStructure/.photostructure/.metadata_never_index’
2021-08-31T18:53:28.835Z web-1521 warn BaseFile(/home/photostructure/photostructure-for-servers/public/images/splashbg1-1024w.jpg.gz) copyFile
(/media/photos/PhotoStructure/.tmp-4q0xhc/.write-test.jpg.gz) failed: Error: EPERM: operation not permitted, copyfile ‘/home/photostructure/photostructure-for-servers/public/images/splashbg1-1024w.jpg.gz’ → ‘/media/photos/PhotoStructure/.tmp-4q0xhc/.write-test.jpg.gz’
2021-08-31T18:53:28.837Z web-1521 warn BaseFile(/media/photos/PhotoStructure/.tmp-4q0xhc/.write-test.jpg.gz) trap: unlink() failed: Error: ENOENT: no such file or directory, unlink ‘/media/photos/PhotoStructure/.tmp-4q0xhc/.write-test.jpg.gz’
2021-08-31T18:53:28.839Z web-1521 warn BaseFile(/media/photos/PhotoStructure/.tmp-4q0xhc/write-test.jpg.gz) trap: unlink() failed: Error: ENOENT: no such file or directory, unlink ‘/media/photos/PhotoStructure/.tmp-4q0xhc/write-test.jpg.gz’
2021-08-31T18:53:28.840Z web-1521 warn BaseFile(/home/photostructure/photostructure-for-servers/public/images/splashbg1-1024w.jpg.gz) _copyFile failed, trying _nativeCopyFile { dest: ‘/media/photos/PhotoStructure/.tmp-4q0xhc/write-test.jpg.gz’,
src:
‘/home/photostructure/photostructure-for-servers/public/images/splashbg1-1024w.jpg.gz’,
error:
{ errno: -1,
code: ‘EPERM’,
syscall: ‘copyfile’,
path:
‘/home/photostructure/photostructure-for-servers/public/images/splashbg1-1024w.jpg.gz’,
dest: ‘/media/photos/PhotoStructure/.tmp-4q0xhc/.write-test.jpg.gz’ } }
2021-08-31T18:53:28.860Z web-1521 warn ChildProcess cp(1543) resulted in errors: [ {} ]
2021-08-31T18:53:28.871Z web-1521 warn LibraryHealthChecks Failed to copy sample file to library. Is /media/photos/PhotoStructure writable?
2021-08-31T18:53:28.894Z web-1521 warn LibrarySettings Failed to set up library at /media/photos/PhotoStructure { cause: {} }
2021-08-31T18:53:28.944Z web-1521 info SettingsIO maybeWriteFile(): wrote settings { dest: { nativePath: ‘/home/photostructure/.config/PhotoStructure/.settings.toml’ },
file: { nativePath: ‘/home/photostructure/.config/PhotoStructure/settings.toml’ },
nonDefaults:
{ copyAssetsToLibrary: true,
scanAllDrives: false,
forceLocalDbReplica: true,
logColor: true,
logLevel: ‘info’,
exposeNetworkWithoutAuth: true },
wip: true }
2021-08-31T18:53:28.954Z web-1521 info SettingsIO Equivalent contents { dest: { nativePath: ‘/home/photostructure/.config/PhotoStructure/.settings.toml’ },
file: { nativePath: ‘/home/photostructure/.config/PhotoStructure/settings.toml’ },
a: { copyAssetsToLibrary: true, scanAllDrives: false },
b: { copyAssetsToLibrary: true, scanAllDrives: false } }
2021-08-31T18:53:28.968Z main-1508 info MainService.restartSync() priorSync
2021-08-31T18:53:28.971Z web-1521 info SettingsRouter error saving library settings [ { error:
‘Cannot write to /media/photos/PhotoStructure. Please choose a different directory for your library.’ } ]
2021-08-31T18:53:28.971Z web-1521 warn SettingsRouter fail(): Cannot write to /media/photos/PhotoStructure. Please choose a different directory for your library.
2021-08-31T18:53:28.981Z main-1508 info SettingsIO.importFileSettings(/home/photostructure/.config/PhotoStructure/settings.toml) loaded { imported: { copyAssetsToLibrary: true, scanAllDrives: false } }
2021-08-31T18:53:28.981Z main-1508 info SettingsIO _libraryHasSettings { result: false }
2021-08-31T18:53:28.982Z main-1508 info MainService.restartSync() restartSync(): no library settings {}
2021-08-31T18:53:29.069Z web-1521 info SuggestedLibraryDir addSuggestion(): path is a library { path: ‘/home/photostructure/Pictures’,
isLibrary: true,
vol:
{ filesystem: ‘/dev/mapper/ubuntu–vg-ubuntu–lv’,
mountpoint: ‘/’,
size: 21003583488,
used: 8832512000,
available: 11080552448,
ignorable: false,
remote: false,
uuid: ‘036200bf-3274-4ec5-a3a5-2c4722ab0554’ },
isCurrentLibrary: false }
2021-08-31T18:53:29.125Z web-1521 info SuggestedLibraryDir addVolume(): adding default suggestion ‘/PhotoStructure’
2021-08-31T18:53:29.140Z web-1521 info SuggestedLibraryDir addVolume(): adding default suggestion ‘/media/photos/PhotoStructure’
2021-08-31T18:53:29.143Z web-1521 info SuggestedLibraryDir addSuggestion(): path is new and in a read/write dir { path: ‘/media/photos/PhotoStructure’,
s:
{ path: ‘/media/photos/PhotoStructure’,
isLibrary: false,
vol:
{ filesystem: ‘//192.168.0.110/photos’,
mountpoint: ‘/media/photos’,
size: 1982096131072,
used: 154624,
available: 1982095976448,
ignorable: false,
remote: true,
remoteHost: ‘192.168.0.110’,
remoteShare: ‘photos’,
uuid: ‘fa269180-ae8c-4237-af33-4e1601d14338’ },
isCurrentLibrary: false } }
2021-08-31T18:53:29.279Z web-1521 info ffmpeg ffmpegVersion { version: ‘4.2.4-1ubuntu0.1’,
code: 0,
stdout: ‘ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers’ }
2021-08-31T18:53:29.279Z web-1521 info SettingsIO _libraryHasSettings { result: false }
2021-08-31T18:53:29.281Z web-1521 info SettingsRouter rendering settings { err:
‘Cannot write to /media/photos/PhotoStructure. Please choose a different directory for your library.’,
scanAllDrives: false,
scanPath: ,
copyAssets: true,
reportErrors: true,
welcome: true,
title: ‘Welcome!’,
isVideoTranscodingSupported: true,
videoToolDetails: ‘FFmpeg 4.2.4-1ubuntu0.1’,
picturesPath: ‘/home/photostructure/Pictures’,
delimiter: ‘:’,
exampleScanPath: ‘/home/photostructure/Pictures:/mnt/nas/homes/photos’,
minFreeAvailable: ‘6 GB’,
suggestedLibraryDirs:
[ { path: ‘/home/photostructure/Pictures’,
isLibrary: true,
vol:
{ filesystem: ‘/dev/mapper/ubuntu–vg-ubuntu–lv’,
mountpoint: ‘/’,
size: 21003583488,
used: 8832512000,
available: 11080552448,
ignorable: false,
remote: false,
uuid: ‘036200bf-3274-4ec5-a3a5-2c4722ab0554’ },
isCurrentLibrary: false },
{ path: ‘/media/photos/PhotoStructure’,
isLibrary: false,
vol:
{ filesystem: ‘//192.168.0.110/photos’,
mountpoint: ‘/media/photos’,
size: 1982096131072,
used: 154624,
available: 1982095976448,
ignorable: false,
remote: true,
remoteHost: ‘192.168.0.110’,
remoteShare: ‘photos’,
uuid: ‘fa269180-ae8c-4237-af33-4e1601d14338’ },
isCurrentLibrary: false } ],
samplePath: ‘2021/2021-08-31’,
subTier: ‘plus’,
subTrial: true,
subEmail: ‘brandthedwarf@gmail.com’,
subExpiresInDuration: ‘1 week’,
subExpiresAt: ‘2021-09-13’ }
2021-08-31T18:54:10.078Z web-1521 info Service(web) --health-check { ok: [ “Library isn’t set up yet”, ‘Memory by web (28 MB) is OK’ ],
warn: ,
bad: ,
fail: }

so, no other ideas what should be checked next?

If we’re still fighting EPERM, it’s a file permission issue for that directory.

Are the user ids (not names, but the uid) the same?

Is samba (either on the client or server side) doing anything “clever” with user/group mappings?

(I’ve lost more time than I’d care to admit due to uid/gid mismatches between a NAS and one of my linux boxes!)

You should be able to run this on the same machine you’re trying to run PhotoStructure on. These should be equivalent to the file operations that PhotoStructure is trying to do:

sudo --login --user photostructure bash
cd /path/to/library
mkdir -p .photostructure/.tmp-123
echo "this should work" > .photostructure/.tmp-123/test.txt

So I am confused.

those bash instructions went just fine, folders created, file too.

but photostructure is still saying that can’t write to same folder on samba share.

I have switched smb mounting from systemd .mount file to good old fstab, with just options like you have shared, and nada.

Ah, are you calling ./start.sh via systemd, or from the terminal? If it’s via systemd, is this section in your /etc/systemd/system/photostructure.service correct? It should look like:

...
[Service]
User=photostructure
Group=photostructure
...

You could try running it as root, just to see if it’s a network-enforced EPERM from your FreeNAS. If that’s the case, at least you know what to fix.

If you do that, though, you’ll need to restore proper ownership bits via chown -R photostructure ~photostructure/.config /path/to/library.

Yes, I run via systemd service, service section is like you mentioned, it was copied from instructions on site.

Even when i changed service to be run as root, it is all the same - Cannot write to.

I think I will just start over with fresh VM and will see.

I hit this same issue recently. Following the EPERM fix recommendations and doing a restart with systemctl restart photostructure resolved it. I also knew it worked because in setup it recommended my NAS mount in /media where before it did not.