Unable to save files to remote samba share

save
samba
Tags: #<Tag:0x00007f11cc1ac6a8> #<Tag:0x00007f11cc1ac428>

#1

Hello,

i have setup a virtualbox machine with debian buster and picard 2.0.4. In that machine a samba folder from my synology is mounted through nautilus. I am able to read and write in shell and in nautilus in that remote folder. I have setup a new remote folder for picard to save tagged files into.

After selecting a music file from the remote folder and tagging it i am not able to save it. There is that red symbol that it did not work. Also the debug log indicates that saving was not possible.

the log msg looks like this:

D: 18:52:58,777 /usr/lib/picard/picard/file.update:500: Updating file <File '07 - Folk Song.mp3'>
D: 18:52:58,823 /usr/lib/picard/picard/formats/id3._save:287: Saving file "/run/user/1000/gvfs/smb-share:server=cloud.local,share=home/Music/17 Hippies/Rock'n'Roll 13/07 - Folk Song.mp3"
E: 18:52:58,935 /usr/lib/picard/picard/util/thread.run:51: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/mutagen/_util.py", line 235, in _openfile
    fileobj = open(filename, "rb+" if writable else "rb")
OSError: [Errno 95] Operation not supported: b"/run/user/1000/gvfs/smb-share:server=cloud.local,share=home/Music/17 Hippies/Rock'n'Roll 13/07 - Folk Song.mp3"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/mutagen/_util.py", line 245, in _openfile
    fileobj = BytesIO(fileobj.read())
OSError: [Errno 22] Invalid argument

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/picard/picard/util/thread.py", line 47, in run
    result = self.func()
  File "/usr/lib/picard/picard/file.py", line 210, in _save_and_rename
    self._save(old_filename, metadata)
  File "/usr/lib/picard/picard/formats/id3.py", line 418, in _save
    self._save_tags(tags, encode_filename(filename))
  File "/usr/lib/picard/picard/formats/id3.py", line 525, in _save_tags
    tags.save(filename, v2_version=3, v1=v1, v23_sep=separator)
  File "/usr/lib/python3/dist-packages/mutagen/_util.py", line 169, in wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/mutagen/_util.py", line 139, in wrapper
    writable, create) as h:
  File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__
    return next(self.gen)
  File "/usr/lib/python3/dist-packages/mutagen/_util.py", line 247, in _openfile
    raise MutagenError(e2)
mutagen.MutagenError: [Errno 22] Invalid argument

D: 18:52:58,937 /usr/lib/picard/picard/file.update:500: Updating file <File '07 - Folk Song.mp3'>

The strange thing is that the new path from options does not show up in debug. its /run/user/1000/gvfs/smb-share:server=cloud.local,share=home/NG-Music

Its possible to save to the remote folder (and also to a local folder) if the source is not remote.

Can somebody help?

Thanks, iBot


#2

I’m not an expert with Picard, but often these types of issues come from file name translations from Linux to Windows (Samba). Illegal characters are < > * ? | " : Also, be mindful that ‘/’ is to be translated as ‘\’.

I hope that helps…


#3

So to be sure, /run/user/1000/gvfs/smb-share:server=cloud.local,share=home/Music/17 Hippies/Rock'n'Roll 13/07 - Folk Song.mp3 is the correct path and writing to this file works in general?

We had a similar issue reported for SFTP with GVFS at PICARD-985 , but there was a fix in Mutagen 1.39 for it (see b18a885). Can you check your mutagen version? Buster should actually have 1.40 AFAIK.

Picard doesn’t get so far. It always first saves the tags, then moves the files. The error already happens on saving

Can be a problem, but should not be the case here. But as a general advice this is true, users writing to NTFS or FAT32 disks, either directly or via SMB, should probably enable Options > File Naming > Windows compatibility (on by default). This will take care of the above mentioned special characters.

Picard handles this. For Picard both / and \ marks a directory separator.


#4

Looking at the errors and the line numbers more closely I can see that this is definitely a Mutagen version including the GVFS fix. It also correctly goes into the fallback code path, but than fails with another error. I will take a closer look later, but we should probably report this to Mutagen.


#5

I tested this with a SMB share from a Windows 10 system, mounted via GVFS on my local machine. This works, although it runs into the fallback code of mutagen as expected.

I also replicated nearly the exact name in case it was something path related, my path is:

/run/user/1000/gvfs/smb-share:server=bender,share=shared/Music/17 Hippies/Rock'n'Roll 13/07 - Folk Song.mp3

So I guess this is not a general Picard, Mutagen or GVFS issue but rather something on the Samba server side. But you probably don’t have too much control over your Synology samba configuration. But the next step probably would be to try to replicate this with Samba server on a Linux host instead of Win 10. But there is so much variation here, might be as well e.g. a limitation of older SMB protocols.


#6

Thanks for your effort. Motivated me to play around with synology file sharing options and it seems that i have it working with the following settings:

In the Control Panel of DSM under File Sharing > File Services > SMB/AFP/NFS > SMB > Advanced Settings i set the minimum and maximum SMB Protocol to “SMB2 and Large MTU” and it seems like this did the trick.

The only pitfall is that i am unable to access smb from my host system with debian stretch but thats another story.