An application that I run called “yt-dlp” throws errors about Fixing “cannot create directory” and “directory does not exist” when the directory name contains characters such as but not limited to these:
"ö"
"ä"
"ü"
"ß"
"İ"
"ş"
note that the path is < 260 characters. Also note the application can create folders with these names locally on macOS, it’s only when it tried to create them on my TrueNAS SMB share that it fails.
AI explained that the root cause is a difference between how macOS and Windows encodes/decodes these characters.
It recommended adding these parameters to Samba to fix the issue:
vfs objects = catia fruit streams_xattr
I did some google searches and looked over the TN SMB service and SMB share configuration options, and I didn’t see anyplace to add this line.
All I found was “Use Apple-style Character Encoding”, so I created a new SMB share with that option enabled, and tested it. No change to the behavior.
Is there an officially supported way to add the vfs objects option that I need? I don’t want to do something hacky that will be erased the next time I upgrade the server software.
I did find notes about migrating from core to scale which removed any vfs object options, so it might be a technical reason that TN does not support them.
Where do you run this application? Are you able to create such files/directories from your Mac using the Finder on your NAS? I’m wondering if AI is steering you wrong. Because I’m able, using the Finder on my Mac, to create files with those characters in the filename on my NAS, which indicates that there aren’t any special settings needed for this purpose.
I believe they’re running yt-dlp on their Mac and pointing the download to an SMB share.
I don’t think the problem is in the characters that were listed. I have a hunch that the title of a YouTube video contains : or some other illegal character.
That’s what I thought, but why? Run it on the NAS. Use a frontend like MeTube or TubeArchivist. Downloading data on a client system just to save it to the NAS seems terribly inefficient.
I suspect you’re right. Which points, as I also suspected, to an AI misdiagnosis.
I suppose running it from a client requires fewer steps than having to open an SSH session to run it on the NAS server itself.
There’s also the convenience of using the client’s file manager (Explorer, Finder, Nautilus), and then choosing “Open terminal in this folder”. With SSH on the NAS server, you need to rely on terminal commands to navigate and create folders.
I don’t mind this, which is how I use yt-dlp on my server, but I can understand why someone would rather just run it on their client and use an SMB share to create folders and point it where to download.[1]
While it’s slower to have to travel the local network, you might not notice any performance drop, since the bottleneck is your ISP’s download speed. ↩︎
Only marginally so. But I was thinking more of one of the many web-based frontends to it, two of which I mentioned in my post. In any event, not that OP’s (presumed) use case is invalid, but it just doesn’t seem like the best way to go about whatever he’s trying to accomplish.
I verified replacing the “ö” , “İ”, and “ş” using the replace-metadata directive ( that replaces one character with another ) to replace them with o, I, and s which fixed the issue.
I’m running with that for now, plus I adjust my NFO generator Go application I wrote to also make the same character swaps.
It would be nice to not have to do that as it’s more code to maintain.
That command was helpful. I deleted the test share so I could not check it. This is from my main share without the “Use Apple-style Character Encoding" box checked
comment = root folder for zpool-media's media
ea support = No
path = /mnt/zpool-media/media
posix locking = No
read only = No
smbd max xattr size = 2097152
vfs objects = fruit streams_xattr shadow_copy_zfs ixnas zfs_core io_uring
fruit:resource = stream
fruit:metadata = stream
The output has everything except “catia” . Tbh , I don’t know what that does. I did check a time machine share, and it has the same vfs objects.
There are some general unicode normalization issues that can occur if file is written in non-macos form (form-D) in some versions of macos. We have a docs article on it. There’s not really anything to be done server-side that can really fix this without some gross hacks (and then it might break other clients). Flip-flopping character encoding settings on already-existing data is a terrible idea and should not ever be done without proper planning and understanding what you’re doing. We have an explicit warning about this.
If you’re using SMB in multi-protocol environment your best bet is to standardize on form-d and ensure your applications are writing appropriately.
@majorgear consider the --windows-filenames option with yt-dlp. I haven’t used it myself, since I run yt-dlp directly on my server, but it might be useful in your case.
Yeah, this is a weird translation bug / design issue with unicode normalization in macos (can’t recall if it’s fixed in more recent versions). The client writes with whatever form is supplied by the application, but internally normalizes when trying to read from the share. E.g. writes composed but then only tries, reads dir listing OK with composed, but then converts to decomposed when trying to actually open the file. This is different from what catia / “name mangling” (where we do the SFM character translation for restricted SMB/NTFS characters differently). The “name mangling” in UI is strictly server-side and not client-visible.
Unicode normalization patterns is client-side and basically invisible to the server for all practical purposes.
I encountered a similar problem with filenames having accented Latin characters. Based on that, I agree with what @awalkerix said, but I will express it a little differently.
@majorgear , I suspect that the underlying problem stems from a combination of three causes.
There are multiple ways to express an accented Latin script character like “ö” , “İ”, or “ş” as bytes in the underlying filename storage. It can be expressed as a single character code, or as the character code for the unaccented letter followed by a second character code for the combining accent.
Most Unix-derived software chose the first option. MacOS chose the second option. Samba, the ZFS filesystem, and the OS under TrueNAS, as far as I know, take no position. When filenames come by, they studiously look the other way and pretend the filenames are inscrutable byte sequences. They do not act to make filenames on the server filesystem consistently use one option or the other.
By running software on the server which writes filenames one way, and also accessing files on the server from macOS which writes filenames the other way, you are causing filenames to coexist on the server filesystem which follow both conventions.
Complications ensue.
You are evading the problem by limiting your filename to those characters for which the two options overlap and share the same result. That is the workaround suggested by the SMB Share MacOS Client Limitations When Using Decomposed Unicode Characters tech note to which Andrew linked. You could also make a policy that yt-dlp and friends may only use unaccented letters in filenames, while software using the server from macOS may use any accented characters it pleases.
I wish there was a better option, but I don’t know of one.
It’s definitely weird. I wonder if it has anything to do with macOS 27.2 I can create and browser directories with the characters in Finder ( the macOS file explorer) and in zsh shell.
Even when yt-dlp moves a file, it will say “directory does not exist” . But if I do the move from the shell using the same source and destination paths in the error message, it works.
I like the idea of running my wrapper script and go app on TN. I was resisting because shell command syntax is tested on the macOS ports of GNU utils, and my development environment is on VS Code on my Mac.
I’ll need to retool for remote development and change syntax on some the shell commands, but running directly on the TN server should fix issues with unicode characters and “too long” path names.
I might need to make a patch for yt-dlp if I run into any more filesystem issues.
Hmm… that’s odd. If you can get pcap of the failure I can look at it if I get some spare time. You can send me via PM. It still smells like a composed vs decomposed issue.