LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   File transfer fails: iPhone to Samba on Ubuntu (https://www.linuxquestions.org/questions/linux-server-73/file-transfer-fails-iphone-to-samba-on-ubuntu-4175726887/)

LinuxOnly 07-12-2023 09:50 PM

File transfer fails: iPhone to Samba on Ubuntu
 
I am trying to transfer files using the Files app between an iPhone 8 running iOS 16.5.1 and a PC running Xubuntu 22.04. I am posting it here because SMB transfer to a Synology NAS works fine so I don't blame the phone.
An attempt to upload e.g. a file "IMG_8833.JPG" to the PC results in an error message on the phone:
Code:

The operation couldn't be completed.  File name too long
I have also seen it, with smaller files, give the same error but put a zero-length file with the correct -full- name into the target directory.
The upload directory is defined thus in /etc/samba/smb.conf (output of testparm):
Code:

[global]
        bind interfaces only = Yes
        client min protocol = NT1
        interfaces = eno1
        log file = /var/log/samba/log.%m
        logging = file
        map to guest = Bad User
        max log size = 1000
        obey pam restrictions = Yes
        pam password change = Yes
        panic action = /usr/share/samba/panic-action %d
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        passwd program = /usr/bin/passwd %u
        security = USER
        server role = standalone server
        server string = %h server (Samba, Ubuntu)
        unix password sync = Yes
        usershare allow guests = Yes
        idmap config * : backend = tdb

[Public]
        comment = Public directory
        create mask = 0775
        guest ok = Yes
        path = /home/steinbach/Public
        read only = No

I have done smbpasswd -a and smbpasswd -e with my login, and I have the firewall open for Samba (ufw status):
Code:

To        Action    From
--        ------    ----
Samba      ALLOW  192.168.1.0/24

The end of /var/log/samba/log.smbd is
Code:

2023/07/12 16:34:30.549598,  0] ../../source3/smbd/server.c:1734(main)
  smbd version 4.15.13-Ubuntu started.
  Copyright Andrew Tridgell and the Samba Team 1992-2021

Is this an encoding issue? The word encoding does not appear in smb.conf. The phone shows the contents of the Public directory but it's all grayed out.
Any pointers? Any other information I should post?
Thank you

jayjwa 07-13-2023 12:26 PM

Strange. Maybe play with the encoding or crank the logging up to see if there's more clues.

Code:

[global]
        unix charset = UTF-8
        dos charset = 850

        log level = 3 lanman:4 smb:4 auth:4


LinuxOnly 07-14-2023 09:28 PM

So I set the two charsey parameters and set loglevel=4.
With a different image I now get another error message:
Code:

The operation can't be completed because some data in "IMG_1683.jpeg" can't be read or written. (Error code -36)
But diff of log.smbd before and after this event is empty. Where does the extra logging go?

FWIW, I had also changed the firewall rules to be explicit:
Code:

139,445/tcp                ALLOW      192.168.1.0/24            # Samba tcp
137,138/udp                ALLOW      192.168.1.0/24            # Samba udp

Another addendum, how do I get to the error message on the iPhone:
I go to Files, hit Select, check one file in Downloads, then hit the folder icon at the bottom, navigate to Shared and the line for the PC (id'ed by its IP address). That displays an icon for the Public directory and at the bottom of the page 1 item, x read-only. That is wrong, the file x is not there anymore, I deleted it yesterday. When I tap on Public it says, correctly, "Folder is empty" and at the top appears copy. Tapping that results in the error message listed above.

allend 07-16-2023 08:06 PM

In the [homes] section of my smb.conf, I have
Code:

; For iPhone
  vfs objects = catia fruit streams_xattr

Further details here

LinuxOnly 07-16-2023 11:27 PM

Thank you but it didn't work for me. After reading the reference you provided I added to the Global section:
Code:

fruit:aapl = yes
fruit:nfs_aces = yes
fruit:model = MacSamba

and in the [Public] share:
Code:

    vfs objects = catia fruit streams_xattr
    fruit:resource = file
    fruit:time machine = no
    fruit:metadata = netatalk
    fruit:locking = none
    fruit:encoding = private
    fruit:veto_appledouble = yes
    fruit:posix_rename = yes
    readdir_attr:aapl_rsize = yes
    readdir_attr:aapl_finder_info = yes
    readdir_attr:aapl_max_access = no
    fruit:wipe_intentionally_left_blank_rfork = yes
    fruit:delete_empty_adfiles = yes
    fruit:zero_file_id = yes

Then I ran systemctl restart smbd and tried copying 2 images to the Samba share. Now I get the error: Input/output error.
BTW, before I navigate into the share it still shows the non existing file. I wonder whether that is a clue?
Anyway, thank you for trying to help.
Any other things to try?

allend 07-17-2023 09:14 AM

Your settings in the {Global] section are unnecessary. Samba will use the settings as they are the defaults.
Some settings in the {Public] section have settings that are different from the defaults.
Specifically:
Code:

readdir_attr:aapl_max_access = no
fruit:wipe_intentionally_left_blank_rfork = yes
fruit:delete_empty_adfiles = yes

Perhaps try commenting out all but the 'vfs objects = catia fruit streams_xattr' line.

LinuxOnly 07-17-2023 09:46 AM

I did as you suggested, allend, i.e. only the vfs objects line left, and after testparm and systemctl restart smbd the result is still Input/output error.
Any other ideas?

allend 07-17-2023 10:27 AM

Sorry, no more ideas. I have the same phone and iOS version and have no problems using the Files app to connect to my Linux PC via Samba using the additional configuration I described.

My share definition looks like this:
Code:

[ShareName]
  comment = <user>'s stuff
  path = /home/<user>/Desktop
  valid users = <user>
  public = no
  writable = yes
  printable = no
  create mask = 0765
  vfs objects = catia fruit streams_xattr


LinuxOnly 07-17-2023 12:27 PM

Oh well.......
So I copied your setup exactly, restarted smbd, and it still said "Input/output error when trying to copy files there.
Then it occurred to me to "eject" and and reconnect to the server on the phone, and voila, it works! So I assume the vfs objects line is really all it took, and the phone just doesn't read any new connection parameters from the server unless makes a new connection. Lesson learned.
Thank you very much for your help, allend

geoffp 08-11-2023 12:07 AM

Fruit works!
 
Adding
Code:

vfs objects = catia fruit streams_xattr
to my smb.conf under the [global] heading seems to have done the trick for me.

Thanks for the fix!

LinuxOnly 08-11-2023 10:29 AM

Addendum
 
Good to hear it helped you, geoffp.
Just today I meant to add one more observation of my own: It is still annoying in that almost every day (but I'm not using it every day) the "input/output error" reappears and I have to "eject" the PC and reconnect. That always works but still, it is not necessary on the NAS. Now I am guessing the difference could be that I suspend the PC overnight so the phone gives up on it but the NAS is always up - any opinions on that?

geoffp 08-11-2023 09:02 PM

I can’t say for sure, but I wouldn’t be at all surprised if suspending the PC forces you to re-establish the connection. Samba is a very server-y thing to do, and suspend / resume is not.

Should be easy to test though!

Mati 04-06-2024 10:32 AM

aye
 
Quote:

Originally Posted by geoffp (Post 6447513)
Adding
Code:

vfs objects = catia fruit streams_xattr
to my smb.conf under the [global] heading seems to have done the trick for me.

Thanks for the fix!

For me this also solved the issuse. :)


All times are GMT -5. The time now is 06:44 AM.