Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nexcloud file path not working #27

Open
cloo opened this issue Jun 12, 2022 · 20 comments
Open

Nexcloud file path not working #27

cloo opened this issue Jun 12, 2022 · 20 comments

Comments

@cloo
Copy link

cloo commented Jun 12, 2022

Photo path "/media/disk/nextcloud/data/username/files/Foto" is not accepted:
Something went wrong Server error: invalid root path at (userAddRootPath)

I would expect permissions issue, but I have no idea how to deal with it. Naturally permissions for nextcloud folder are:
drwxr-xr-x 10 nextcloud nextcloud 4096 Jun 11 22:07 Foto

@rndmh3ro
Copy link

Same here. I even gave the photoview user permissions on the Photos-folder in Nextcloud:

chmod 770 /home/yunohost.app/nextcloud/data/basti/files/Photos/

I verified this by creating a file in the folder with the photoview-user.

@Dont-ask-for-it
Copy link

Same here. Yunohost. What folder have to be specified?

@Jules-Bertholet
Copy link
Member

I recommend using /home/yunohost.multimedia/$YOUR_USER_NAME/Picture or /home/yunohost.multimedia/shared/Picture to store your images. The yunohost.multimedia subdirectories are designed to share media files between YunoHost apps. They should be accessible from Nextcloud as an external storage

@cloo
Copy link
Author

cloo commented Jun 20, 2022

@Jules-Bertholet it is not very suitable for usual situations.
Normally you run your linux [yunohost] system on SSD, and you normally do not use SSD for your photo collection - you dedicate a larger, cheaper and slower drive for that.

@Jules-Bertholet
Copy link
Member

@cloo Maybe a symlink or bind mount from yunohost.multimedia to your HDD could work?

@cloo
Copy link
Author

cloo commented Jun 20, 2022

It does not work. Probably because links/binds make no changes to permissions, they are still nextcloud nextcloud

@Jules-Bertholet
Copy link
Member

I mean move the yunohost.multimedia folder to your SSD, transfer your photos to it, and symlink/bind mount original yunohost.multimedia location to new location

@cloo
Copy link
Author

cloo commented Jun 20, 2022

Btw, I also tried adding photoview user to groups of nextcloud and www-data, and it did not help.

@cloo
Copy link
Author

cloo commented Jun 20, 2022

I mean move the yunohost.multimedia folder to your SSD, transfer your photos to it, and symlink/bind mount original yunohost.multimedia location to new location

That seems to be strange idea. If you mount that folder with nextcloud, nextcloud will impose its permissions, and only thing left will be the name. Also, how can it be treated by Yunohost as somehow "special" folder in a different path? Do I get something wrong? Not moving my gigabytes for that yet :)

@Jules-Bertholet
Copy link
Member

Jules-Bertholet commented Jun 20, 2022

The /home/yunohost.multimedia/$YOUR_USER_NAME folder should already be available from Nextcloud under the name "Multimedia"; the Nextcloud YunoHost app should have configured it for you on install. It's configured as Nextcloud "external storage", so it doesn't need to have the same permissions as the main Nextcloud folder.

Of course, test it with a small number of files before moving your whole image library around.

@cloo
Copy link
Author

cloo commented Jun 20, 2022

That is more interesting, thanks!
I might have deleted that "Multimedia" folder, and it probably does not go to recycle bin, as it wasnt there.
Anyways, mounted /home/yunohost.multimedia/USERNAME/Picture as external storage, which is linked to HDD now.
Sadly no success.

@Jules-Bertholet
Copy link
Member

Jules-Bertholet commented Jun 20, 2022

Are the permissions on the folder correct? /home/yunohost.multimedia/ should be owned by root:root, and /home/yunohost.multimedia/USERNAME and all contents should be owned by root:USERNAMEUSERNAME:root. The folders also use extended attribute permissions, if they were messed up you can restore them with:

sudo setfacl -RnL -m g:multimedia:rwX,g::rwX,o:r-X "/home/yunohost.multimedia"
sudo setfacl -RnL -m d:g:multimedia:rwX,g::rwX,o:r-X "/home/yunohost.multimedia"
sudo setfacl -RL -m m::rwx "/home/yunohost.multimedia"

I think Nextcloud also sometimes doesn't like to follow symlinks. You can use a bind mount instead or set localstorage.allowsymlinks to true in Nextcloud config.php

@cloo
Copy link
Author

cloo commented Jun 20, 2022

My yunohost.multimedia/USER/Picture folder now is owned by "nextcloud nextcloud".
because

symlinks does not have permissions. Anyone can read where the symlink points to. The permissions of the target determines the access.

It totally makes sense. I'll try to (amateurishly) theorize here a bit.

How could there be folders (and files within) with several different sets of permissions at once? It would be terrible for security.
So even if I changed permissions for my /drive of photos/ mount folder from nextcloud to root:username, it would naturally become inaccessible for nextcloud. Or wouldn't it?

My guess is that it should be solvable by correct user/group/chmod combination, which I do not know. Old bad chmod777 might work, but I'm not rushing to that :)

My other guess is that it is not doable by design.

@Jules-Bertholet
Copy link
Member

Jules-Bertholet commented Jun 20, 2022

if I changed permissions for my /drive of photos/ mount folder from nextcloud to root:username, it would naturally become inaccessible for nextcloud. Or wouldn't it?

This is what the extended attribute/ACL permissions (setfacl stuff, more info here) are for. Those commands give permission to the multimedia group (which nextcloud should be a member of already) to access the multimedia folder, in addition to root:USERNAME.

@cloo
Copy link
Author

cloo commented Jun 20, 2022

Thanks, possibly some progress: nextcloud can read the pictures folder, linked from /home/yunohost.multimedia/USER/Picture and owned by USERNAME:root. (not root:USERNAME - I think you mistyped that).
and yet.. Photoview does not seem to scan it. Displays black thumbnails of folders, and no error.

@Jules-Bertholet
Copy link
Member

Is there anything in /var/log/photoview/photoview.log? Also, if you open the Network tab of your browser's developer tools, and refresh the Photoview gallery page, what do you see? (Any HTTP error codes, like 403 or 404?)

@cloo
Copy link
Author

cloo commented Jun 20, 2022

Thanks for your patience!
Ther is something:

Network tab: `Content Security Policy: This site (https://foto.domain.name) has a Report-Only policy without a report URI. CSP will not block and cannot report violations of this policy. 4 GRAPHQL ENDPOINT https://foto.domain.name/api/graphql apolloClient.ts:31:8 Content Security Policy: The page’s settings observed the loading of a resource at wss://foto.domain.name/api/graphql (“default-src”). A CSP report is being sent. client.ts:557:15 Content Security Policy: This site (https://foto.domain.name) has a Report-Only policy without a report URI. CSP will not block and cannot report violations of this policy. Content Security Policy: The page’s settings observed the loading of a resource at wss://foto.domain.name/api/graphql (“default-src”). A CSP report is being sent. Content Security Policy: This site (https://foto.domain.name) has a Report-Only policy without a report URI. CSP will not block and cannot report violations of this policy.`
photoview.log: `admin@domain:/media$ sudo cat /var/log/photoview/photoview.log 2022/06/21 00:10:25 Starting Photoview... 2022/06/21 00:10:25 Connecting to MYSQL database: photoview:daC4oxkQ0FTqwgrScFxRDcFd@tcp(localhost:3306)/photoview?multiStatements=true&parseTime=true 2022/06/21 00:10:26 Initializing scanner queue with 3 workers 2022/06/21 00:10:26 Queue waiting 2022/06/21 00:10:26 Periodic scan interval changed: disabled 2022/06/21 00:10:26 Scan interval runner: Waiting for signal 2022/06/21 00:10:26 Scan interval runner: New ticker detected 2022/06/21 00:10:26 Scan interval runner: Waiting for signal 2022/06/21 00:10:26 Found executable worker: darktable (this is darktable-cli 2.6.0) 2022/06/21 00:10:26 Found executable worker: ffmpeg (ffmpeg version 4.1.9-0+deb10u1 Copyright (c) 2000-2022 the FFmpeg developers) 2022/06/21 00:10:26 Found exiftool 2022/06/21 00:10:26 Initializing face detector 2022/06/21 00:10:26 Photoview API endpoint listening at http://localhost:4001/api 2022/06/21 00:10:26 Photoview API public endpoint ready at /api 2022/06/21 00:10:26 Photoview UI public endpoint ready at / 2022/06/21 00:10:46 POST 200 foto.domain.name/api/graphql 1.000976ms unauthenticated 2022/06/21 00:10:46 POST 200 foto.domain.name/api/graphql 1.270662ms unauthenticated 2022/06/21 00:10:46 POST 200 foto.domain.name/api/graphql 2.717692ms unauthenticated 2022/06/21 00:10:46 GET 200 foto.domain.name/logo192.png 5.491225ms unauthenticated 2022/06/21 00:10:46 GET 200 foto.domain.name/photoview-logo.svg 8.378084ms unauthenticated 2022/06/21 00:10:46 Did not find auth-token cookie 2022/06/21 00:10:46 Did not find auth-token cookie 2022/06/21 00:10:46 POST 200 foto.domain.name/api/graphql 407.998µs unauthenticated 2022/06/21 00:10:46 POST 200 foto.domain.name/api/graphql 421.306µs unauthenticated 2022/06/21 00:10:46 Did not find auth-token cookie 2022/06/21 00:10:46 GET 200 foto.domain.name/photoview-logo.svg 3.51245ms unauthenticated 2022/06/21 00:10:47 Did not find auth-token cookie 2022/06/21 00:10:47 GET 200 foto.domain.name/service-worker.js 672.083µs unauthenticated 2022/06/21 00:10:50 GET 0 foto.domain.name/api/graphql 4.144704501s unauthenticated 2022/06/21 00:10:50 Did not find auth-token cookie 2022/06/21 00:10:50 Did not find auth-token cookie 2022/06/21 00:10:50 GET 200 foto.domain.name/logo192.png 831.683µs unauthenticated 2022/06/21 00:10:50 Did not find auth-token cookie 2022/06/21 00:10:50 Did not find auth-token cookie 2022/06/21 00:10:50 POST 200 foto.domain.name/api/graphql 1.144351ms unauthenticated 2022/06/21 00:10:50 GET 200 foto.domain.name/photoview-logo.svg 5.791142ms unauthenticated 2022/06/21 00:10:50 Did not find auth-token cookie 2022/06/21 00:10:50 GET 200 foto.domain.name/photoview-logo.svg 1.75344ms unauthenticated 2022/06/21 00:10:51 Did not find auth-token cookie 2022/06/21 00:10:51 GET 200 foto.domain.name/service-worker.js 1.106884ms unauthenticated 2022/06/21 00:11:53 Did not find auth-token cookie 2022/06/21 00:11:53 POST 200 foto.domain.name/api/graphql 280.809881ms unauthenticated 2022/06/21 00:11:53 GET 0 foto.domain.name/api/graphql 1m3.347206745s unauthenticated 2022/06/21 00:11:54 Registering notification listener 2022/06/21 00:11:54 POST 200 foto.domain.name/api/graphql 1.691036ms user: USER 2022/06/21 00:11:54 POST 200 foto.domain.name/api/graphql 333.672µs user: USER 2022/06/21 00:11:54 GET 200 foto.domain.name/logo192.png 197.102µs user: USER 2022/06/21 00:11:54 POST 200 foto.domain.name/api/graphql 1.289196ms user: USER 2022/06/21 00:11:54 GET 200 foto.domain.name/photoview-logo.svg 2.616372ms user: USER 2022/06/21 00:11:54 POST 200 foto.domain.name/api/graphql 2.188231ms user: USER 2022/06/21 00:11:54 POST 200 foto.domain.name/api/graphql 2.386427ms user: USER 2022/06/21 00:11:54 GET 200 foto.domain.name/photoview-logo.svg 6.163473ms user: USER 2022/06/21 00:11:54 POST 200 foto.domain.name/api/graphql 3.83496ms user: USER 2022/06/21 00:11:54 GET 200 foto.domain.name/service-worker.js 339.05µs user: USER 2022/06/21 00:12:02 POST 200 foto.domain.name/api/graphql 16.774811ms user: USER 2022/06/21 00:12:04 POST 200 foto.domain.name/api/graphql 8.228764ms user: USER 2022/06/21 00:12:04 POST 200 foto.domain.name/api/graphql 10.013383ms user: USER 2022/06/21 00:12:04 POST 200 foto.domain.name/api/graphql 10.292633ms user: USER 2022/06/21 00:12:07 POST 200 foto.domain.name/api/graphql 1.456234ms user: USER 2022/06/21 00:12:07 POST 200 foto.domain.name/api/graphql 1.475519ms user: USER 2022/06/21 00:12:07 POST 200 foto.domain.name/api/graphql 1.9617ms user: USER 2022/06/21 00:12:07 POST 200 foto.domain.name/api/graphql 3.741992ms user: USER 2022/06/21 00:12:13 POST 200 foto.domain.name/api/graphql 8.235472ms user: USER 2022/06/21 00:12:13 POST 200 foto.domain.name/api/graphql 9.176668ms user: USER 2022/06/21 00:12:14 Deregistering notification listener 2022/06/21 00:12:14 POST 200 foto.domain.name/api/graphql 279.392µs user: USER 2022/06/21 00:12:20 GET 0 foto.domain.name/api/graphql 26.182666569s user: USER 2022/06/21 00:12:20 Registering notification listener 2022/06/21 00:12:20 GET 200 foto.domain.name/logo192.png 2.745141ms user: USER 2022/06/21 00:12:20 POST 200 foto.domain.name/api/graphql 1.46435ms user: USER 2022/06/21 00:12:20 POST 200 foto.domain.name/api/graphql 2.682125ms user: USER 2022/06/21 00:12:20 POST 200 foto.domain.name/api/graphql 3.665571ms user: USER 2022/06/21 00:12:20 GET 200 foto.domain.name/photoview-logo.svg 4.689281ms user: USER 2022/06/21 00:12:20 POST 200 foto.domain.name/api/graphql 2.109396ms user: USER 2022/06/21 00:12:20 POST 200 foto.domain.name/api/graphql 2.009624ms user: USER 2022/06/21 00:12:20 GET 200 foto.domain.name/photoview-logo.svg 7.608137ms user: USER 2022/06/21 00:12:20 POST 200 foto.domain.name/api/graphql 2.249399ms user: USER 2022/06/21 00:12:21 GET 200 foto.domain.name/service-worker.js 755.699µs user: USER 2022/06/21 00:12:21 POST 200 foto.domain.name/api/graphql 13.232479ms user: USER 2022/06/21 00:12:23 POST 200 foto.domain.name/api/graphql 1.539088ms user: USER 2022/06/21 00:12:23 POST 200 foto.domain.name/api/graphql 1.045008ms user: USER 2022/06/21 00:12:23 POST 200 foto.domain.name/api/graphql 1.390224ms user: USER 2022/06/21 00:12:23 POST 200 foto.domain.name/api/graphql 4.124625ms user: USER 2022/06/21 00:12:29 POST 200 foto.domain.name/api/graphql 7.31898ms user: USER 2022/06/21 00:12:29 POST 200 foto.domain.name/api/graphql 7.508652ms user: USER 2022/06/21 00:12:29 POST 200 foto.domain.name/api/graphql 8.686722ms user: USER 2022/06/21 00:12:32 POST 200 foto.domain.name/api/graphql 1.079733ms user: USER 2022/06/21 00:12:32 POST 200 foto.domain.name/api/graphql 2.497625ms user: USER 2022/06/21 00:12:32 POST 200 foto.domain.name/api/graphql 3.584593ms user: USER 2022/06/21 00:12:32 POST 200 foto.domain.name/api/graphql 4.041853ms user: USER 2022/06/21 00:12:32 POST 200 foto.domain.name/api/graphql 4.593151ms user: USER 2022/06/21 00:12:32 POST 200 foto.domain.name/api/graphql 4.265455ms user: USER 2022/06/21 00:12:33 POST 200 foto.domain.name/api/graphql 486.87µs user: USER 2022/06/21 00:12:33 POST 200 foto.domain.name/api/graphql 1.824164ms user: USER 2022/06/21 00:12:33 POST 200 foto.domain.name/api/graphql 2.609864ms user: USER 2022/06/21 00:12:33 POST 200 foto.domain.name/api/graphql 3.824871ms user: USER 2022/06/21 00:12:41 POST 200 foto.domain.name/api/graphql 13.364311ms user: USER 2022/06/21 00:12:42 POST 200 foto.domain.name/api/graphql 5.718612ms user: USER 2022/06/21 00:12:42 POST 200 foto.domain.name/api/graphql 8.128057ms user: USER 2022/06/21 00:12:42 POST 200 foto.domain.name/api/graphql 8.96774ms user: USER 2022/06/21 00:12:43 POST 200 foto.domain.name/api/graphql 7.753081ms user: USER 2022/06/21 00:14:22 POST 200 foto.domain.name/api/graphql 7.798353ms user: USER 2022/06/21 00:14:22 POST 200 foto.domain.name/api/graphql 8.850758ms user: USER 2022/06/21 00:14:54 GET 200 foto.domain.name/static/js/main.cfe16a3b.chunk.js.map 9.556391ms user: USER 2022/06/21 00:14:54 GET 200 foto.domain.name/static/js/8.acda5b54.chunk.js.map 104.003131ms user: USER 2022/06/21 00:14:54 GET 200 foto.domain.name/static/css/main.53033c04.chunk.css.map 5.457008ms user: USER 2022/06/21 00:15:06 GET 200 foto.domain.name/static/js/15.e4ae32bc.chunk.js.map 2.328977ms user: USER 2022/06/21 00:15:06 GET 200 foto.domain.name/static/js/1.a2e56b8f.chunk.js.map 2.374439ms user: USER 2022/06/21 00:15:06 GET 200 foto.domain.name/static/js/16.9ac0f7ed.chunk.js.map 3.017538ms user: USER 2022/06/21 00:15:06 GET 200 foto.domain.name/static/js/13.6679fbeb.chunk.js.map 1.917959ms user: USER 2022/06/21 00:15:06 GET 200 foto.domain.name/static/js/2.c87fce1c.chunk.js.map 6.692927ms user: USER 2022/06/21 00:15:06 GET 200 foto.domain.name/static/js/0.eaef5b7a.chunk.js.map 4.951203ms user: USER 2022/06/21 00:15:06 GET 200 foto.domain.name/static/js/10.4a867388.chunk.js.map 7.377905ms user: USER 2022/06/21 00:15:06 GET 200 foto.domain.name/static/js/main.cfe16a3b.chunk.js.map 6.964883ms user: USER 2022/06/21 00:15:06 GET 200 foto.domain.name/static/js/4.64272527.chunk.js.map 13.420084ms user: USER 2022/06/21 00:15:06 GET 200 foto.domain.name/static/js/8.acda5b54.chunk.js.map 100.737883ms user: USER`

@Jules-Bertholet
Copy link
Member

No clear error messages in the logs :( Can you share a screenshot of your Photoview?

@cloo
Copy link
Author

cloo commented Jun 20, 2022

image
220621-004434

@cloo
Copy link
Author

cloo commented Jun 20, 2022

Tried cliclking "scan all users". Gave an error:

Something went wrong Server error: failed to add user for scanning (1): find albums for user (user_id: 1): begin database transaction: insert album into database: Error 1366: Incorrect string value: '\xC5\xAB\xC5\xA1iu...' for column photoview.albums.title at row 1 at (scanAll)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants