Cannot download anything via FTP?

Hey,

I got a Raspberry PI 2 running with OSMC and installed the ftp module. I can connect and upload files without any problems but once I try to download anything, I get an error like “stream could not be read” and similiar (depending on the client).

Does anyone know why I can upload but not download files?

No one? :frowning:

I guess nobody has had the same problem as you. I know I haven’t seen this issue.

Have you tried using a different ftp client ?

Yes, I tried 4 FTP clients on Windows and Mac.

What disk are you trying to FTP from - the SD card, or a partition on an external drive ? If the latter, what file system is on the external drive ?

It is an external drive which has either NTFS or exFAT - can’t remember. I can check, if it makes a difference.

osmc@osmc:~$ df -T
/dev/sda2      fuseblk  1953308672 1166259456 787049216   60% /media/Untitled

Yes it does make a difference. I ask, because there may be a permissions problem that we have overlooked, and the permissions are set up differently for each file system type.

Is it all files that you can’t download or only those you uploaded via ftp ?

It’s actually an exFAT.

The biggest file that I found which I haven’t uploaded was the vmlinuz which is 5,4 MB and I downloaded it without problems.

Tiny files like .txt and .nfo as well as empty folders can be downloaded as well, even though I created/uploaded them with a ftp client. Two somehow small files (15,6 MB; 33,1 MB) did start but not finish to download. It always gets up to 2,5-3,0 MB but then stalls and fails. Very weird.

Thanks for the help so far!

I changed the file system to ext4:

/dev/sda2 on /media/Untitled type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks)

Still no success. All files have osmc as owner:

drwx------  2 osmc osmc       4096 Jun 28 12:16 .

Any idea?

You’re going to have to provide a bit more info than that. Please post the error log from your FTP client showing the exact error you are getting.

I’ve just re-tested the FTP server using FileZilla on Windows uploading and downloading to an external USB drive formatted with Ext4 and I can’t reproduce any problems.

Sure, I have Mac with following clients:

Transmit:

 Could not download “files.rar”. - File couldn’t be found. Make sure that the file wasn’t unexpectedly moved or renamed.

It started to download about 4 MB in the first 1-2 seconds and stalled.

Terminal:

ftp> get files.rar
local: files.rar remote: files.rar
229 Entering Extended Passive Mode (|||60576|).
150 Opening BINARY mode data connection for files.rar (645795380 bytes).
  0% |                                                                                                                                                                                                                  |  5888 KiB  226.22 KiB/s  - stalled -426 Failure writing network stream.
6029312 bytes received in 00:26 (226.20 KiB/s)

As you can see, it tried to download the file for 26 seconds. 5888 KiB where downloaded within the first 1-2 seconds and then it stalled.

FileZilla:

Status:           Connecting to 1.1.1.39:21...
Status:           Connection established, waiting for welcome message...
Status:           Insecure server, it does not support FTP over TLS.
Status:           Server does not support non-ASCII characters.
Status:           Connected
Status:           Starting download of /media/Untitled/files.rar
Command:     CWD /media/Untitled/files.rar
Response:     250 Directory successfully changed.
Command:     PWD
Response:     257 "/media/Untitled/files.rar"
Command:     TYPE I
Response:     200 Switching to Binary mode.
Command:     PASV
Response:     227 Entering Passive Mode (1,1,1,39,172,108).
Command:     RETR files.rar
Response:     150 Opening BINARY mode data connection for files.rar (645795380 bytes).
Error:             Connection timed out after 20 seconds of inactivity
Error:             File transfer failed after transferring 2097152 bytes in 20 seconds
Status:           Disconnected from server
Status:           Connecting to 1.1.1.39:21...
Status:           Connection established, waiting for welcome message...
Status:           Insecure server, it does not support FTP over TLS.
Status:           Server does not support non-ASCII characters.
Status:           Connected
Status:           Starting download of /media/Untitled/files.rar
Command:     CWD /media/Untitled/files.rar
Response:     250 Directory successfully changed.
Command:     TYPE I
Response:     200 Switching to Binary mode.
Command:     PASV
Response:     227 Entering Passive Mode (1,1,1,39,92,14).
Command:     REST 2097152
Response:     350 Restart position accepted (2097152).
Command:     RETR files.rar
Response:     150 Opening BINARY mode data connection for files.rar (645795380 bytes).
Response:     426 Failure writing network stream.
Error:             File transfer failed
Status:           Starting download of /media/Untitled/files.rar
Command:     PASV
Response:     227 Entering Passive Mode (1,1,1,39,41,183).
Command:     REST 0
Response:     350 Restart position accepted (0).
Command:     RETR files.rar
Response:     150 Opening BINARY mode data connection for files.rar (645795380 bytes).
Response:     426 Failure writing network stream.
Error:             File transfer failed after transferring 2097152 bytes in 1 second
Status:           Starting download of /media/Untitled/files.rar
Command:     PASV
Response:     227 Entering Passive Mode (1,1,1,39,175,237).
Command:     REST 2097152
Response:     350 Restart position accepted (2097152).
Command:     RETR files.rar
Response:     150 Opening BINARY mode data connection for files.rar (645795380 bytes).
Response:     426 Failure writing network stream.
Error:             File transfer failed
Status:           Starting download of /media/Untitled/files.rar
Command:     PASV
Response:     227 Entering Passive Mode (1,1,1,39,105,232).
Command:     REST 0
Response:     350 Restart position accepted (0).
Command:     RETR files.rar
Response:     150 Opening BINARY mode data connection for files.rar (645795380 bytes).
Response:     426 Failure writing network stream.
Error:             File transfer failed after transferring 2097152 bytes in 1 second
Status:           Starting download of /media/Untitled/files.rar
Command:     PASV
Response:     227 Entering Passive Mode (1,1,1,39,205,42).
Command:     REST 2097152
Response:     350 Restart position accepted (2097152).
Command:     RETR files.rar
Response:     150 Opening BINARY mode data connection for files.rar (645795380 bytes).
Response:     426 Failure writing network stream.
Error:             File transfer failed

Ok. The timeouts you’re seeing can only really be a network problem. It’s not going to be a permissions problem is the transfer does partially complete and then times out.

Is the Pi using Ethernet or Wifi ? What about the device at the other end ?

The Pi is using Ethernet and I tried both on my MacBook.

Also, since you’re mentioning the network: I’m using an ASUS RT-AC66U wireless router which I never had any kind of problems with.

Can you upload your system journal after repeating the failed attempts at FTP ?

Have you tried using a different power adaptor for the Pi and/or reducing your overclock if you are not on the default settings ?

Low voltage can cause the Ethernet connection to drop and reconnect - this would interrupt your transfer part way through. If this is happening it should show up in the system journal.

Is your external drive powered off the Pi ? If so this can also contribute to low voltage that can cause Ethernet to drop out.

Whatever the cause, it’s going to be hardware related not software.

I’ll get the journal right after posting this.

However, I’m using a suggested power adaptor and it never had any problems uploading files (I assume I’d need the same amount of power for writing files and for reading files?)

Yes, I set “max_usb_current=1” and am now powering a 2,5" external drive off the Pi.

Ehm, there’s no /var/log/journal?

sudo journalctl | paste-log

Or use the log uploader in My OSMC.

Thanks! However, it only pasted the first 400 lines: http://paste.osmc.io/iherihohop

So full version here:

This is what was marked red in journalctl:

Jul 08 16:24:09 osmc systemd[1]: Cannot add dependency job for unit display-manager.service, ignoring: Unit display-manager.service failed to load: No such file or directory.
Jul 08 16:24:09 osmc systemd[1]: Found ordering cycle on basic.target/start
Jul 08 16:24:09 osmc systemd[1]: Found dependency on sysinit.target/start
Jul 08 16:24:09 osmc systemd[1]: Found dependency on kbd.service/start
Jul 08 16:24:09 osmc systemd[1]: Found dependency on remote-fs.target/start
Jul 08 16:24:09 osmc systemd[1]: Found dependency on remote-fs-pre.target/start
Jul 08 16:24:09 osmc systemd[1]: Found dependency on connman.service/start
Jul 08 16:24:09 osmc systemd[1]: Found dependency on dbus.service/start
Jul 08 16:24:09 osmc systemd[1]: Found dependency on basic.target/start
Jul 08 16:24:09 osmc systemd[1]: Breaking ordering cycle by deleting job kbd.service/start
Jul 08 16:24:09 osmc systemd[1]: Job kbd.service/start deleted to break ordering cycle starting with basic.target/start
Jul 08 16:24:09 osmc systemd[1]: Found ordering cycle on basic.target/start
Jul 08 16:24:09 osmc systemd[1]: Found dependency on sysinit.target/start
Jul 08 16:24:09 osmc systemd[1]: Found dependency on rpcbind.service/start
Jul 08 16:24:09 osmc systemd[1]: Found dependency on network-online.target/start
Jul 08 16:24:09 osmc systemd[1]: Found dependency on network.target/start
Jul 08 16:24:09 osmc systemd[1]: Found dependency on connman.service/start
Jul 08 16:24:09 osmc systemd[1]: Found dependency on dbus.service/start
Jul 08 16:24:09 osmc systemd[1]: Found dependency on basic.target/start
Jul 08 16:24:09 osmc systemd[1]: Breaking ordering cycle by deleting job rpcbind.service/start
Jul 08 16:24:09 osmc systemd[1]: Job rpcbind.service/start deleted to break ordering cycle starting with basic.target/start

Jul 08 16:24:11 osmc connmand[235]: Failed to open RFKILL control device
Jul 08 16:24:11 osmc dbus[232]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service'
Jul 08 16:24:11 osmc connmand[235]: lo {newlink} index 1 address 00:00:00:00:00:00 mtu 65536
Jul 08 16:24:11 osmc connmand[235]: lo {newlink} index 1 operstate 0 <UNKNOWN>
Jul 08 16:24:11 osmc connmand[235]: eth0 {create} index 2 type 1 <ETHER>
Jul 08 16:24:11 osmc connmand[235]: eth0 {update} flags 4098 <DOWN>
Jul 08 16:24:11 osmc connmand[235]: eth0 {newlink} index 2 address B8:27:EB:15:4B:96 mtu 1500
Jul 08 16:24:11 osmc connmand[235]: eth0 {newlink} index 2 operstate 2 <DOWN>
Jul 08 16:24:12 osmc connmand[235]: Adding interface eth0 [ ethernet ]
Jul 08 16:24:12 osmc connmand[235]: eth0 {update} flags 36867 <UP>
Jul 08 16:24:12 osmc connmand[235]: eth0 {newlink} index 2 address B8:27:EB:15:4B:96 mtu 1500
Jul 08 16:24:12 osmc connmand[235]: eth0 {newlink} index 2 operstate 2 <DOWN>


Jul 08 16:29:56 osmc kernel: usb 1-1.2: USB disconnect, device number 4
Jul 08 16:29:57 osmc kernel: sd 0:0:0:0: [sda]
Jul 08 16:29:57 osmc kernel: Result: hostbyte=0x01 driverbyte=0x00
Jul 08 16:29:57 osmc kernel: sd 0:0:0:0: [sda] CDB:
Jul 08 16:29:57 osmc kernel: cdb[0]=0x28: 28 00 1f 58 dc 00 00 00 f0 00
Jul 08 16:29:57 osmc kernel: blk_update_request: I/O error, dev sda, sector 525917184
Jul 08 16:29:57 osmc kernel: Aborting journal on device sda2-8.
Jul 08 16:29:57 osmc kernel: sd 0:0:0:0: [sda]
Jul 08 16:29:57 osmc kernel: Result: hostbyte=0x01 driverbyte=0x00
Jul 08 16:29:57 osmc kernel: sd 0:0:0:0: [sda] CDB:
Jul 08 16:29:57 osmc kernel: cdb[0]=0x28: 28 00 1f 58 dc f0 00 00 10 00
Jul 08 16:29:57 osmc kernel: blk_update_request: I/O error, dev sda, sector 525917424
Jul 08 16:29:57 osmc kernel: JBD2: Error -5 detected when updating journal superblock for sda2-8.

Jul 08 16:30:02 osmc kernel: EXT4-fs error (device sda2): ext4_find_entry:1289: inode #2: comm vsftpd: reading directory lblock 0
Jul 08 16:30:02 osmc sudo[514]: osmc : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/sbin/hdparm -S 240 /dev/sdb
Jul 08 16:30:02 osmc sudo[514]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jul 08 16:30:02 osmc udisks-glue[299]: SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Jul 08 16:30:02 osmc udisks-glue[299]: /dev/sdb:
Jul 08 16:30:02 osmc udisks-glue[299]: setting standby to 240 (20 minutes)
Jul 08 16:30:02 osmc sudo[514]: pam_unix(sudo:session): session closed for user root
Jul 08 16:30:02 osmc udisks-glue[299]: Device file /dev/sdb2 inserted
Jul 08 16:30:02 osmc udisks-glue[299]: Trying to automount /dev/sdb2...
Jul 08 16:30:02 osmc kernel: EXT4-fs (sdb2): recovery complete
Jul 08 16:30:02 osmc kernel: EXT4-fs (sdb2): mounted filesystem with ordered data mode. Opts: (null)
Jul 08 16:30:02 osmc udisks-glue[299]: Successfully automounted /dev/sdb2 at /media/Untitled
Jul 08 16:30:02 osmc udisks-glue[299]: Device file /dev/sdb1 inserted
Jul 08 16:30:02 osmc udisks-glue[299]: Trying to automount /dev/sdb1...
Jul 08 16:30:03 osmc kernel: FAT-fs (sdb1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
Jul 08 16:30:03 osmc udisks-glue[299]: Successfully automounted /dev/sdb1 at /media/EFI
Jul 08 16:30:03 osmc udisks-glue[299]: Device file /dev/sdb2 mounted at /media/Untitled
Jul 08 16:30:03 osmc udisks-glue[299]: Device file /dev/sdb1 mounted at /media/EFI
Jul 08 16:30:29 osmc sudo[479]: pam_unix(sudo:session): session closed for user root
Jul 08 16:30:31 osmc sudo[537]: osmc : TTY=pts/0 ; PWD=/home/osmc ; USER=root ; COMMAND=/bin/journalctl
Jul 08 16:30:31 osmc sudo[537]: pam_unix(sudo:session): session opened for user root by osmc(uid=0)
Jul 08 16:30:40 osmc sudo[537]: pam_unix(sudo:session): session closed for user root
Jul 08 16:30:42 osmc kernel: EXT4-fs error (device sda2): ext4_put_super:789: Couldn't clean up the journal
Jul 08 16:30:42 osmc kernel: EXT4-fs (sda2): Remounting filesystem read-only

To me it looks like the external drive is being reconnected but can’t see the resaon.

Thanks a lot for the help so far by the way!