Backup uploads to Samba share using Samba v1 fails

Setup: Three RPis (one Rpi2, two Rpi3), all connected wirelessly to a router Asus RT-AC66U_B1. Previously I had a small 250 HDD attached to one of the RPi and other devices accessed the files on the disk via NFS share. I have now bought a bigger 2 TB disk and decided to attach it directly to the router for better throughput. Now the available services on router are UPnP/FTP/Samba (I’ve enabled them all). When enabling the Samba, there was this little warning:

Note: If you are using Windows® 10, use this FAQ to enable SMBv1 Client to ensure you have access to files stored within the network.

I didn’t pay much attention as the primary aim was to access the files from those RPis. At first all seem to work great, but then I ran into couple of movies which started playing as usually but the playback was terminated within 1-3 seconds… Not all of them, only some files. That’s when I recalled the warning, so I headed to Kodi settings and in the Services - Samba client put the Max protocol version to v1. After the reboots all 3 RPis were again capable to play everything from that Samba share.

A week later I turned on my TV and there was some error that backup upload failed… I tried to experiment with Samba protocol settings and it seems that with v3/v2 there’s no issue uploading the files to Samba, but using the v1 version always fails:

2020-01-25 15:50:21.879 T:1915819568   ERROR: SMBDirectory->GetDirectory: Unable to open directory : 'smb://ROUTER/osmc_backup'
                                            unix_err:'d' error : 'Permission denied'
2020-01-25 15:50:49.150 T:1915819568  NOTICE: NFS is idle. Closing the remaining connections.
2020-01-25 15:51:00.860 T:1915819568 WARNING: SMBFile::OpenForWrite() called with overwriting enabled! - smb://USERNAME:PASSWORD@ROUTER/osmc_backup/loznice/1
2020-01-25 15:51:18.955 T:1763701472 WARNING: CPythonInvoker(14): Script invoked without an addon. Adding all addon modules installed to python path as fallback. This behaviour will be removed in future version.
2020-01-25 15:51:22.257 T:1702863584 WARNING: SMBFile::OpenForWrite() called with overwriting enabled! - smb://USERNAME:PASSWORD@ROUTER/osmc_backup/loznice/temp_write_test
2020-01-25 15:52:56.566 T:1915819568  NOTICE: Samba is idle. Closing the remaining connections
2020-01-25 15:57:36.895 T:1702863584 WARNING: SMBFile::OpenForWrite() called with overwriting enabled! - smb://USERNAME:PASSWORD@ROUTER/osmc_backup/loznice/OSMCBACKUP_2020_01_25_15_51_22.tar.gz
2020-01-25 16:13:39.410 T:1702863584   ERROR: Copy - Failed write to file smb://ROUTER/osmc_backup/loznice/OSMCBACKUP_2020_01_25_15_51_22.tar.gz

In fact the file exists and is created but with 0 B size…
Even stranger thing is that in OSMC backup settings I can browse to osmc_backup folder on Samba and I created the folder “loznice” from that very RPi which then later failed to upload the backup. I also noticed several Addons which have the possibility to save the media performing in the same way – file gets created but then there’s the write error in logs.

I can probably think of some workaround – use UPnP/FTP for video files and Samba for Addons using e.g. .strm files OR backup to local SD card and upload with some CRON task afterwards using FTP/SCP but one thing makes me wonder: when you setup the media sources, it’s possible to define NFS, SMB, FTP, SFTP/SCP, but when you configure the Backup location, the options are local, SMB or NFS. Why is the FTP/SCP missing? I’m not sure if the problem is in router OS (as there all the shares are R/W) or it’s something inside Samba v1 protocol, or if the problem is on OSMC/Raspbian side…

I think I remember reading something somewhere sometimes about samba v1 being banned or disabled or something because of a security issue, but don’t take my word for it

Hi,

Whats the output of smbclient -U USERNAME -Lm ip.of.router smbclient -U USERNAME -L ip.of.router

Have you considered mounting your shares with:

You should get better throughput and can revert to using smbv3, which is more secure; which should resolve playback issues. Will also resolve the backup issue you are having, you will need to change the backup path to the new share (same with sources for your videos).

@k2u3 is not banned, just not recommended.

Thanks Tom.

Most NAS and operating systems disable SMBv1 support by default. Re-enabling this can vary in complexity depending on the system.

Not sure if the syntax is 100 % correct, because the output is:
192.168.1.1: Not enough '\' characters in service
When I obey the m parameter:

Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.25]

    Sharename       Type      Comment
    ---------       ----      -------
    filmy           Disk      Elements's filmy in WD Elements 2621
    etc.
    ...
    IPC$            IPC       IPC Service (RT-AC66U_B1)

Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.25]

    Server               Comment
    ---------            -------
    ROUTER               RT-AC66U_B1

    Workgroup            Master
    ---------            -------
    WORKGROUP            ROUTER

Not really – I can try this as well, but as Asus itself forces usage of smb v1, I doubt it would make any difference…

Hi,

Sorry that was typo, should have been:

smbclient -U USERNAME -L ip.of.router

Sorry misread your post, thought you were setting smb version on the router, not in kodi. But I’ve got the same model asus, which does support v2; I am running merlin firmware though:

https://www.asuswrt-merlin.net

So if you are running the latest stock firmware from asus and Samba v2 is not available, I would consider the merlin firmware.

Thanks Tom.

Using autofs solves this… Thanks Tom!

1 Like