Announcement

#1 2022-01-04 21:44:35

bunkerhill
Member
2022-01-04
8

Symlink error (working on Windows, failing on Pi)

Hello,

I have been enjoying this program on Windows for a few months now and I absolutely love it. I've configured my entire photo gallery under one master folder and a few symlinks on Windows 10, working flawlessly, everything is automatically synchronized, I'm very happy.

However I was setting up Piwigo on aRaspberry Pi 4 for my brother who is going through a tough time now. And I wanted him to be able to use a humble home server to take care of his family photos, and help his mood, but no matter what I do, this in links will not work. I promise you, I covered everything lol. Please help me.

I've changed permissions, tested in the terminal, everything loads correctly, I can 'see' all folders and photos in a file manager AND the terminal, symlinks are setup correct. But in Piwigo, it just refuses to see ANYTHING. I'm feeling stupid.

Can someone please tell me, why symlinks work on Windows but not Linux / Pi 4.

Does it matter if the symlinks have root:root? I didn't think so because, again, I can view, access, move, confirm all photos in symlink folders in file manager and terminal. It's just Piwigo refuses to see anything.

Yes, I've mounted the network share, fyi, the symlink is for a network share.

sudo ln -s /mnt/Family_Photos/ /var/www/html/gallery/galleries/myfamilypics
(with or without sudo, both fail in Piwigo)

sudo mount --bind -r /mnt/Family_Photos/ /var/www/html/gallery/galleries/myfamilypics

etc.

sudo mount -t cifs,cifs '\\192.168.1.48\Our_Photos\sharedfolderonnetwork' /mnt/Family_Photos --verbose -o user=brother

etc.

I've tried every approach I could think of, but Piwigo hates my symlinks. But they are setup correct, as seen in terminals and file managers.

Please, help me. I feel so stupid I can't help him. Windows symlinks worked instantly. :(

And yes, I spent the last 4 hours searching this forum reading every single network share/symlink/mount thread, and nothing helped. I tried all the code I could find.

Thank you kindly, seriously.

I worked really hard on this message, I hope someone can help me.

********

    Piwigo 12.2.0 Check for upgrade
    Operating system: Linux
    PHP: 7.4.25 (Show info) [2022-01-04 15:43:08]
    MySQL: 5.5.5-10.5.12-MariaDB-0+deb11u1 [2022-01-04 15:43:08]
    Graphics Library: GD 2.3.0
    Cache size 5.58 MB  
----------------------------------------------------


tl;dr

Symlinks work correctly in terminal and file manager - all photos can be accessed, viewed, etc.
But Piwigo just refuses to "see" the symlink and any photos. No matter what I try to do to fix it.

Last edited by bunkerhill (2022-01-04 22:04:42)

Offline

 

#2 2022-01-05 03:31:44

erAck
Only trying to help
2015-09-06
1998

Re: Symlink error (working on Windows, failing on Pi)

It's probably not a problem of the symlinks that anyway have permissions lrwxrwxrwx i.e. read/write/traverse for all, but the permissions of the directories they point to, here /mnt/Family_Photos/

Your user or root when viewing directory content may have all permissions to see it. But the user the web server runs as needs read and traverse permissions in directories and file read access.


Running Piwigo at https://erack.net/gallery/

Offline

 

#3 2022-01-05 03:44:58

bunkerhill
Member
2022-01-04
8

Re: Symlink error (working on Windows, failing on Pi)

erAck wrote:

It's probably not a problem of the symlinks that anyway have permissions lrwxrwxrwx i.e. read/write/traverse for all, but the permissions of the directories they point to, here /mnt/Family_Photos/

Your user or root when viewing directory content may have all permissions to see it. But the user the web server runs as needs read and traverse permissions in directories and file read access.

Hello friend. Thank you so very much for responding with trying to help me.

However, I tried to change permissions like you suggest, great idea I didn't think of that - it's root:root, you're right.

But it fails.

I tried changing permissions for /mnt/Family_Photos and I received no error message in the terminal.
Yet I checked, and everything still says root:root for the mount point. Please help :( I'm so close.
Thank you.

sudo chown -R pi:pi /mnt/Family_Photos/
(no error)

ls -la /mnt/Family_Photos/

shows ROOT:ROOT

:(

I even tried unmounting first, to make sure permissions stuck.

sudo umount /mnt/Family_Photos
sudo chown -R pi:pi /mnt/Family_Photos/
sudo mount /mnt/Family_Photos

******************
UPDATE:

I tried manually "adding photos" from the Piwigo dashboard, just a few from the mount share, and it WORKS. If I manually browse to the Piwigo install galleries SYMLINK, I can see ALL my photos in the photo uploader.

BUT, the symlink cannot find any photos automatically as it does in Windows. Obviously uploading every single photo defeats the purpose of having the symlink but my point is, the Piwigo install sees the mounted symlink photos in the ADD PHOTOS dialog.

But having the galleries folder scanned and trying to find all the photos automagically, simply does not work.

Please advise :( I am so close to solving.

Last edited by bunkerhill (2022-01-05 04:04:02)

Offline

 

#4 2022-01-05 14:02:37

erAck
Only trying to help
2015-09-06
1998

Re: Symlink error (working on Windows, failing on Pi)

May it be that you have absolutely no clue what you are doing?

This

I even tried unmounting first, to make sure permissions stuck.

sudo umount /mnt/Family_Photos
sudo chown -R pi:pi /mnt/Family_Photos/
sudo mount /mnt/Family_Photos

changes the permissions of the mount point /mnt/Family_Photos which has no effect on effective permissions of directories of the device mounted there (unless it leads to a situation where you can't even mount that anymore).

Apart from that, the mount point being owned by root:root is perfectly fine if the device is mounted as root, as long as the effective permissions of the mounted device's directories are sufficient for the user in question.

Seeing further above that you mounted a CIFS device (why -t cifs,cifs btw? it's a single -t cifs) without specifying permissions that likely is the problem, and trying anything with chown on CIFS will not be successful anyway because it has no means to change ownership of files, the chown command does nothing there. But you didn't give details what user the web server runs as and what ls -ld of a directory under /mnt/Family_Photos/ gives, so this is speculative.

You probably want to mount with options
username=brother,uid=pi,gid=pi,file_mode=0640,dir_mode=0750
if your web server user and group is 'pi', else adapt accordingly.

man mount.cifs


Running Piwigo at https://erack.net/gallery/

Offline

 

#5 2022-01-05 15:24:59

bunkerhill
Member
2022-01-04
8

Re: Symlink error (working on Windows, failing on Pi)

erAck wrote:

May it be that you have absolutely no clue what you are doing?

This

I even tried unmounting first, to make sure permissions stuck.

sudo umount /mnt/Family_Photos
sudo chown -R pi:pi /mnt/Family_Photos/
sudo mount /mnt/Family_Photos

changes the permissions of the mount point /mnt/Family_Photos which has no effect on effective permissions of directories of the device mounted there (unless it leads to a situation where you can't even mount that anymore).

Apart from that, the mount point being owned by root:root is perfectly fine if the device is mounted as root, as long as the effective permissions of the mounted device's directories are sufficient for the user in question.

Seeing further above that you mounted a CIFS device (why -t cifs,cifs btw? it's a single -t cifs) without specifying permissions that likely is the problem, and trying anything with chown on CIFS will not be successful anyway because it has no means to change ownership of files, the chown command does nothing there. But you didn't give details what user the web server runs as and what ls -ld of a directory under /mnt/Family_Photos/ gives, so this is speculative.

You probably want to mount with options
username=brother,uid=pi,gid=pi,file_mode=0640,dir_mode=0750
if your web server user and group is 'pi', else adapt accordingly.

man mount.cifs

I posted here because I don't know what I'm doing. Thanks.

The "effective permissions of directories of the device mounted there" response I have for you is, the directories on located on his Windows machine with all his HDDs in there. They have the expected normal every read permissions for both share and ntfs.

The photos are hosted on a Windows machine, shared using the user/password of : xbmc:xbmc.
The web server on the PI running Piwigo is setup with user group as pi:pi yes.

It's clear I am confused about the process to solve this.

I did:

sudo mount -t cifs '\\192.168.1.xx\Our_Photos\master' /mnt/Family_Photos --verbose -o  username=xbmc,uid=pi,gid=pi,file_mode=0640,dir_mode=0750

I tried mounting and it had no errors. But Piwigo refuses to see my symlink.
But again, it can see the photos manually no problem in the manual upload dashboard. Ok?
Why is this?

Why can I:
browse photos via symlink in galleries subfolder in file explorer, piwigo, and terminal? all photos OK

Why can't Piwigo:
see the symlink which is setup correctly on the system now, with correct permissions?
How can this not be a piwigo problem now?

I can literally browse and edit all the photos via the symlink itself IN the galleries folder.
But the piwigo dash fails to see anything sync.

What else could it be other than Piwigo? (other than me having absolutely no clue?)

Last edited by bunkerhill (2022-01-05 16:13:35)

Offline

 

#6 2022-01-05 17:09:41

erAck
Only trying to help
2015-09-06
1998

Re: Symlink error (working on Windows, failing on Pi)

The mount command looks good from a first glance.

When mounted, what is the output of these ls commands if you execute

Code:

sudo -u pi -i
ls -ld /mnt/Family_Photos
ls -ld /mnt/Family_Photos/*
ls -ld /var/www/html/gallery/galleries/myfamilypics/*

Running Piwigo at https://erack.net/gallery/

Offline

 

#7 2022-01-05 17:15:13

bunkerhill
Member
2022-01-04
8

Re: Symlink error (working on Windows, failing on Pi)

erAck wrote:

The mount command looks good from a first glance.

When mounted, what is the output of these ls commands if you execute

Code:

sudo -u pi -i
ls -ld /mnt/Family_Photos
ls -ld /mnt/Family_Photos/*
ls -ld /var/www/html/gallery/galleries/myfamilypics/*

SSH is enabled and the default password for the 'pi' user has not been changed.

drwxr-xr-x 2 root root 4096 Jan  4 13:48 /mnt/Family_Photos/

drwxr-xr-x 2 root root 0 Jan  2 19:54  /mnt/Family_Photos/Folder1
drwxr-xr-x 2 root root 0 Jan  3 09:48  /mnt/Family_Photos/Folder2
drwxr-xr-x 2 root root 0 Jan  1 20:01  /mnt/Family_Photos/Folder3

drwxr-xr-x 2 root root 0 Jan  2 19:54  /var/www/html/gallery/galleries/symlink/Folder1
drwxr-xr-x 2 root root 0 Jan  2 19:56  /var/www/html/gallery/galleries/symlink/Folder2
drwxr-xr-x 2 root root 0 Jan  2 19:58  /var/www/html/gallery/galleries/symlink/Folder3

Thank you for trying to help. I appreciate it greatly.

Last edited by bunkerhill (2022-01-05 17:15:35)

Offline

 

#8 2022-01-05 17:42:26

erAck
Only trying to help
2015-09-06
1998

Re: Symlink error (working on Windows, failing on Pi)

Looks ok. A tad odd that even after mounting with uid=pi,gid=pi everything is owned by root:root, but all other users have read access so that should be ok (it's over a decade ago that I did anything with CIFS so I really don't remember well). As seen, also the pi user can read at least in the Folder[123] directories.

So, when you say "Why can't Piwigo see the symlink", what exactly are you referring? What did you try, what did you expect, and what happened instead?

Dumb question: did you actually synchronize the folders once to have Piwigo read in the images?
See How To Add Pictures ... by FTP.


Running Piwigo at https://erack.net/gallery/

Offline

 

#9 2022-01-05 17:58:15

bunkerhill
Member
2022-01-04
8

Re: Symlink error (working on Windows, failing on Pi)

erAck wrote:

Looks ok. A tad odd that even after mounting with uid=pi,gid=pi everything is owned by root:root, but all other users have read access so that should be ok (it's over a decade ago that I did anything with CIFS so I really don't remember well). As seen, also the pi user can read at least in the Folder[123] directories.

So, when you say "Why can't Piwigo see the symlink", what exactly are you referring? What did you try, what did you expect, and what happened instead?

Dumb question: did you actually synchronize the folders once to have Piwigo read in the images?
See How To Add Pictures ... by FTP.

Hello.

Well, I hit synchronize and even the simulation failed, 0 photos found.

On the FTP upload page in the Piwigo dash, this is the instructions, but this doesn't apply to me, how can it?
-----------------
Administration » Tools » Synchronize
Quick Start

    Create a directory on your computer.
    Copy some photos inside this directory, resize them for web display. Warning: the name of directories and files must contain only letters, figures, "-", "_" or ".". No blank space, nor accentuated characters.
    With a FTP client, copy your directory in the "galleries" directory of your Piwigo installation.
    Logon your gallery and go to Administration and click on the big Synchronization button.

Congratulations! You have successfully created the first album of your photo gallery.

----------------

Why would I copy my entire photo gallery (i.e. the 50GB of photos from the symlink location on the windows server) via FTP into the galleries folder? lol that'll just literally copy the photos into the Piwigo galleries folder, on my Pi, and that's not what I want. That defeats the point of symlinks. :)

I want to have Piwigo manage the photos via the symlink so I can maintain it where the photos already are located. I don't understand.

Please elaborate?

Last edited by bunkerhill (2022-01-05 17:58:47)

Offline

 

#10 2022-01-05 18:07:25

erAck
Only trying to help
2015-09-06
1998

Re: Symlink error (working on Windows, failing on Pi)

It would not copy the image files. It would create albums from the directory structure and read the images' metadata as if you had uploaded them by FTP. Without that you won't see any of those albums nor images in Piwigo.


Running Piwigo at https://erack.net/gallery/

Offline

 

#11 2022-01-05 18:09:36

bunkerhill
Member
2022-01-04
8

Re: Symlink error (working on Windows, failing on Pi)

erAck wrote:

It would not copy the image files. It would create albums from the directory structure and read the images' metadata as if you had uploaded them by FTP. Without that you won't see any of those albums nor images in Piwigo.

If I copy a directory from location A to B, why would it not copy all files inside it? lol

How does one, copy a folder via FTP without actually copying the contents of the folder? :) Please, teach me this.

Drag and drop folder in FileZilla from left pane to right pane, I promise you it'll copy all the folders and files and photos within. What do you mean?

It goes against literally everything I've ever learned about copy and paste :P

Thanks!

Offline

 

#12 2022-01-06 02:33:36

erAck
Only trying to help
2015-09-06
1998

Re: Symlink error (working on Windows, failing on Pi)

You did not understand. If you symlink an existing directory structure into the galleries/ folder that is as if you had uploaded it by FTP. If you then do the Piwigo database sync from FTP no files are copied.


Running Piwigo at https://erack.net/gallery/

Offline

 

#13 2022-01-06 02:37:26

bunkerhill
Member
2022-01-04
8

Re: Symlink error (working on Windows, failing on Pi)

erAck wrote:

You did not understand. If you symlink an existing directory structure into the galleries/ folder that is as if you had uploaded it by FTP. If you then do the Piwigo database sync from FTP no files are copied.

No lol. I understand that completely. I guess I wasn't clear.

I did symlink an existing directory, and as you say, that is indeed just as if I uploaded it via FTP.
But sync is not working! I hit sync, and zero photos are found.

That's the whole reason I started this thread.

How am I supposed to "sync" via FTP when I already have a fully functioning symlink in the galleries folder, as you see, and Piwigo still sees nothing? No photos detected?

Where is the magic FTP "sync" option, other than the Sync option I've already tried? Simulation + non-simulation fail.

What am I missing?

There is no special " Piwigo database sync from FTP"  option, anywhere. Just the basic admin sync options.

Last edited by bunkerhill (2022-01-06 02:38:04)

Offline

 

#14 2022-01-06 02:58:36

erAck
Only trying to help
2015-09-06
1998

Re: Symlink error (working on Windows, failing on Pi)

I give up. I don't know what's wrong in your CIFS mount that Piwigo does not see the files during Synchronise.


Running Piwigo at https://erack.net/gallery/

Offline

 

#15 2022-01-06 03:48:04

bunkerhill
Member
2022-01-04
8

Re: Symlink error (working on Windows, failing on Pi)

erAck wrote:

I give up. I don't know what's wrong in your CIFS mount that Piwigo does not see the files during Synchronise.

Do any of the devs think there is any chance this could be a bug?
I mean, it works on Windows to windows, but not Pi to Windows.

I seriously think there is a problem here, I wish it could be fixed. Sad. Thank you for your efforts. Hope eventually something can fix this.

Last edited by bunkerhill (2022-01-06 03:52:12)

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact