Bug 476424 - Files can't be imported to album on SMB share
Summary: Files can't be imported to album on SMB share
Status: RESOLVED INTENTIONAL
Alias: None
Product: digikam
Classification: Applications
Component: Import-Albums (other bugs)
Version First Reported In: 8.1.0
Platform: Manjaro Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-01 16:34 UTC by kde
Modified: 2025-04-13 06:22 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 8.7.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kde 2023-11-01 16:34:53 UTC
SUMMARY

I have the following setup:
- digiKam 8.1.0-2 from Manjaro's extra repository
- mySQL DB on a NAS (NetGear ReadyNAS RN 102)

Pictures and videos are stored on that NAS. The directory containing these media files is mounted in my home directory using "smb4k", so I'm able to access the share via "/home/<user>/smb4k/<host>/<share>/Fotos".

In digiKam's settings I set up that album correspondingly. It's listed under "Sammlungen in Netzwerkfreigaben" (which most probably translates to "Collections on network shares") using that home path. In front of that album the dialog places a check mark and the tooltip says "Keine Probleme aufgetreten: genießen Sie die Sammlung." ("No issues: enjoy the collection.").

STEPS TO REPRODUCE
1. Place a file to import on your local hard drive. 
2. Open the importer via Import/Bilder hinzufügen (Import/Import files).
3. Select that file and specify the pattern "yyyy/yyyyMMdd" for "Date based sub-albums".
4. Import the file to the album on the network share.

OBSERVED RESULT

digiKam's status bar reports an error while importing. The file is not imported.

KSystemLog shows an entry "01.11.23 17:00	digikam	digikam.import: Failed to open destination file for writing: "/home/<user>/smb4k/<host>/<share>/Fotos/Camera-dndsbh-7ae5030d.digikamtempfile.IMG_20230201_070442.jpg"

EXPECTED RESULT

The file is successfully imported.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 6.4.16-5-Manjaro 
(available in About System)
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.11

ADDITIONAL INFORMATION
Comment 1 kde 2023-11-01 16:45:45 UTC
I forgot to mention that it's possible to create a new album on that share from digiKam's main window, and delete it again.
Comment 2 Maik Qualmann 2023-11-01 18:08:45 UTC
The error message is quite clear, QFile could not open the output file for writing. If you can create a folder, it's strange. But there will be some problem with the rights. Can you create a file in the same directory using Dolphin? From a technical point of view, we can't fix anything here in digiKam.

Maik
Comment 3 Maik Qualmann 2023-11-01 18:15:16 UTC
When I read the instructions for smb4k, I wonder if this is actually a classic mounted SMB? Because things like sysncronization don't sound like it.

Maik
Comment 4 Maik Qualmann 2023-11-01 22:30:19 UTC
A test here with an SMB share via SMB4k shows no problems importing images.

Maik
Comment 5 kde 2023-11-02 06:03:53 UTC
Hi Maik,

thanks for you efforts.

I also was thinking of rights and first checked this. But everything seemed fine to me, the user running digiKam is the same user which is set up as owner of that mounted share. File and directory permissions are 0755. In consequence, creating a file via Dolphin works (verified right now by just copying/pasting an image).

This is then where I was lost and hoped to get some advice from this bug report. Also this setup worked for years now. But unfortunately, I used it months ago so I can't tell if there has been some causing change. At least, no major change comes to my mind.

But since you were wondering about smb4k: what would be the "classic" approach to mount such a network share? Probably I could give that a try? (which still would not answer why the current setup is not working anymore … which would make me wonder for a long time :) )

Or is there any chance to get some deeper insights via some debug logging or similar?
Comment 6 kde 2023-11-20 20:59:17 UTC
Tried again today. I was able to create a new (sub-)album (Fotos/2023/20231120 Test) on that share and copy an image from another album (Fotos/2023/20230101) into that new album using the album view. Worked like a charm.

But importing still does not work due to "Failed to open destination file for writing: '/home/<user>/smb4k/<HOST>/<share>/Fotos/Camera-<somereallylonghash>.jpg'".

I then realized that this temp file is to be created is in the album root, so I also tried to copy/paste into that album root using the album view. Also worked.

Next step I tried is to not use "Bilder hinzufügen …" (Add pictures …) but "Ordner hinzufügen …" (Add directory …) from the "Importieren" (Import) menu. That actually worked :O
But that approach to import pictures is mostly useless since I'm not able to setup the picture rotation, file renaming, etc.
Comment 7 Maik Qualmann 2023-11-20 21:38:48 UTC
Your collection root  cannot be read-only.
1. We create the .dtrash folder for the trash here.
2. From digiKam-8.2.0 onwards, a UUID file is saved in the .dtrash folder.
3. When importing images can first be saved in the collection root and then moved to corresponding auto-created folders.

Maik
Comment 8 caulier.gilles 2025-04-13 06:22:17 UTC
Close with Maik comment 2 and 7 : operating to a collection based on read only FS is not supported