Samba 4.x package support thread

I have a SMB on another server that I would like my OpenWrt box to have access to. I downloaded samba4-client and luci-app-samba4 but can't figure out how to setup Samba4 to access my share. Is this possible with the GUI or do I need to manually configure it? If manual, do you know any guides to help set this up?

I'm not aware that we have a specific luci module for the smb client service. Yet you can setup it either via fstab + kernel module or on startup (admin/system/startup.. local startup) or as custom command (luci-app-commands) in luci.

I would also try use the default kernel mod to mount the share, instead of the smbclient. This way you can use it via fstab and it should be faster and more stable. Check the guide here: https://openwrt.org/docs/guide-user/services/nas/cifs.client

1 Like

Hi) I constantly see such errors:

Sun Nov 15 11:13:04 2020 daemon.err smbd[13293]: [2020/11/15 11:13:04.605375,  0] ../../lib/param/loadparm.c:801(lpcfg_map_parameter)
Sun Nov 15 11:13:04 2020 daemon.err smbd[13293]:   Unknown parameter encountered: "write cache size"
Sun Nov 15 11:13:04 2020 daemon.err smbd[13293]: [2020/11/15 11:13:04.606014,  0] ../../lib/param/loadparm.c:1841(lpcfg_do_global_parameter)
Sun Nov 15 11:13:04 2020 daemon.err smbd[13293]:   Ignoring unknown parameter "write cache size"
Sun Nov 15 11:13:04 2020 daemon.err smbd[13294]: [2020/11/15 11:13:04.938283,  0] ../../lib/param/loadparm.c:801(lpcfg_map_parameter)
Sun Nov 15 11:13:04 2020 daemon.err smbd[13294]:   Unknown parameter encountered: "write cache size"
Sun Nov 15 11:13:04 2020 daemon.err smbd[13294]: [2020/11/15 11:13:04.938754,  0] ../../lib/param/loadparm.c:1841(lpcfg_do_global_parameter)
Sun Nov 15 11:13:04 2020 daemon.err smbd[13294]:   Ignoring unknown parameter "write cache size"
Sun Nov 15 11:13:05 2020 daemon.err smbd[13295]: [2020/11/15 11:13:05.406580,  0] ../../lib/param/loadparm.c:801(lpcfg_map_parameter)
Sun Nov 15 11:13:05 2020 daemon.err smbd[13295]:   Unknown parameter encountered: "write cache size"
Sun Nov 15 11:13:05 2020 daemon.err smbd[13295]: [2020/11/15 11:13:05.407098,  0] ../../lib/param/loadparm.c:1841(lpcfg_do_global_parameter)
Sun Nov 15 11:13:05 2020 daemon.err smbd[13295]:   Ignoring unknown parameter "write cache size"
Sun Nov 15 11:13:09 2020 daemon.err smbd[13310]: [2020/11/15 11:13:09.215256,  0] ../../lib/param/loadparm.c:801(lpcfg_map_parameter)
Sun Nov 15 11:13:09 2020 daemon.err smbd[13310]:   Unknown parameter encountered: "write cache size"
Sun Nov 15 11:13:09 2020 daemon.err smbd[13310]: [2020/11/15 11:13:09.215709,  0] ../../lib/param/loadparm.c:1841(lpcfg_do_global_parameter)
Sun Nov 15 11:13:09 2020 daemon.err smbd[13310]:   Ignoring unknown parameter "write cache size"

Samba works normally, but why it is generating unknown options? :upside_down_face:

The newer snapshots versions has removed this parameter, just ignore it for now.

1 Like

Hi! I can't get my MacBook Pro to connect to the drive as a time machine drive. ps says:

4335 root     31964 S    /usr/sbin/smbd -F
4336 root     19260 S    /usr/sbin/nmbd -F

and OSX says there is a problem connecting to the server. Prior to installing Samba I installed AFP Netatalk, now uninstalled, should I also uninstall Avahi or AvahiUtils? Could avahi service file or daemon be causing a conflict with SMB? I am running Mac OSX 10.15.7 on my main machine, and the latest stable build of OpenWRT. My Mac can find a server called OpenWrt it thinks is a time capsule, but cannot connect to it, that's in Finder. It can also find backups in OpenWrt local in the Time Machine interface, but cannot connect OSStatus error 64. The drive is mounted in /mnt/sda1, but may be mounted improperly, how do I check and remount properly?

When I try Finder > Go > Connect to Server > smb://192.168.1.1 I get the server unavailable message, check the ip address. It seems I cannot connect to my router as an SMB server. What would be causing this? Also, I cannot find a UUID for the drive in LuCI. Is it not mounted properly? Should I unmount, reformat, and try again?

To update, I have uninstalled Avahi and installed umdns and reformatted and remounted the disk. Now MacOS cannot find the disk at all.

Further update: Rebooted the router and Samba was totally uninstalled on reboot! No idea why. Now cannot reinstall:

Installing samba4-server (4.11.12-1) to root...
Collected errors:
 * check_conflicts_for: The following packages conflict with samba4-server:
 * check_conflicts_for: 	samba36-server * 
 * opkg_install_cmd: Cannot install package samba4-server.

Do not have samba36 installed.
I am thinking of just reflashing the device and starting again.

UPDATE: Now solved, reflashed the device and started from scratch. I can access the drive, SUCCESS! Now I have a question, if I actually need to use this disk (formatted in Ext4) to restore a previous state of my Mac, say from the recovery OS, do I do this wirelessly through my router, or if I have to plug the disk in, will MacOS even recognise it as it's Ext4? I just thought of this.

Quick info, if this (19.07) samba4: update to 4.11.17 is merged, i recommend updating samba4 on stable.
It has been a while since i updated stable 19.07 and many bugs/CVE's where fixed.

PS: You can also update the wsdd2 package to resolve a minor naming issue.

Quick notice: The new PR for 4.13.3 in snapshots will also now enable the io_uring support by default, this should have no negative impacts, but report any issues here.

If you just upgrade samba4, without the newer compatible io_uring kernel support enabled, the module should fail gracefully and the older userspace default aio path will be taken. If your kernel supports io_uring than the new module will replace all aio operations with this newer kernel based way. The module is also not loaded if you disable async io via the UCI option.

You can verify/debug if the module is working correctly via manually running smbd in debug mode
smbd -i -d3

PS: Don't expect any crazy speed improvements on simple none threaded read/writes.
On the upside many DB's and file io heavy projects now test/ship with io_uring support, which in return gets tested/improved this way. I think that's an improvement over just relying on the samba teams efforts on there own aio implementation.

Hi, so I've reflashed my router, and decided to install Samba. I think the luci-app-samba4 is broken. I installed luci-app-samba4 using Luci, and checked the configuration template. It's totally blank, same problem I had last time (this is a fresh install of OpenWRT.) Here's a screenshot:

There was an error message in the install, I can't remember it now, dbus unknown something or other I think. I did not think to write down the error. I assume this blank config file means Samba is not going to work, and won't proceed. What do you advise?

you do have to read errors then you don't have to post thing here
I'm going to guess the error is "not enough room" or "out out of space"

No, the error was about something being "unknown". Damn I should have written it down, I clicked dismiss before I had fully registered it. I could try uninstalling and reinstalling, and writing the error down this time. I certainly have enough room on the machine.

Need to investigate if i can duplicate this bug, but you can just copy the default template by hand into the field and save.

PS: Can you check if the template file was actually missing under /etc/samba/smb.conf.template

Hi Andy,

/etc/samba/smb.conf.template is present and this is the output:

[global]
	netbios name = |NAME| 
	interfaces = |INTERFACES|
	server string = |DESCRIPTION|
	unix charset = |CHARSET|
	workgroup = |WORKGROUP|

	## This global parameter allows the Samba admin to limit what interfaces on a machine will serve SMB requests.
	bind interfaces only = yes

	## time for inactive connections to-be closed in minutes
	deadtime = 15

	## disable core dumps
	enable core files = no

	## set security (auto, user, domain, ads)
	security = user

	## This parameter controls whether a remote client is allowed or required to use SMB encryption.
	## It has different effects depending on whether the connection uses SMB1 or SMB2 and newer:
    ## If the connection uses SMB1, then this option controls the use of a Samba-specific extension to the SMB protocol introduced in Samba 3.2 that makes use of the Unix extensions.
	## If the connection uses SMB2 or newer, then this option controls the use of the SMB-level encryption that is supported in SMB version 3.0 and above and available in Windows 8 and newer. 
	## (default/auto,desired,required,off)
	#smb encrypt = default

	## set invalid users
	invalid users = root

	## map unknow users to guest
	map to guest = Bad User

	## allow client access to accounts that have null passwords. 
	null passwords = yes

	## The old plaintext passdb backend. Some Samba features will not work if this passdb backend is used. (NOTE: enabled for size reasons)
	## (tdbsam,smbpasswd,ldapsam)
	passdb backend = smbpasswd

	## Set location of smbpasswd ('smbd -b' will show default compiled location)
	#smb passwd file = /etc/samba/smbpasswd 

	## LAN (IPTOS_LOWDELAY TCP_NODELAY) WAN (IPTOS_THROUGHPUT) WiFi (SO_KEEPALIVE) try&error for buffer sizes (SO_RCVBUF=65536 SO_SNDBUF=65536)
	socket options = IPTOS_LOWDELAY TCP_NODELAY

	## If this integer parameter is set to a non-zero value, Samba will read from files asynchronously when the request size is bigger than this value.
	## Note that it happens only for non-chained and non-chaining reads and when not using write cache.
	## The only reasonable values for this parameter are 0 (no async I/O) and 1 (always do async I/O).
	## (1/0)
	#aio read size = 0
	#aio write size = 0

	## If Samba has been built with asynchronous I/O support, Samba will not wait until write requests are finished before returning the result to the client for files listed in this parameter.
	## Instead, Samba will immediately return that the write request has been finished successfully, no matter if the operation will succeed or not.
	## This might speed up clients without aio support, but is really dangerous, because data could be lost and files could be damaged. 
	#aio write behind = /*.tmp/

	## lower CPU useage if supported and aio is disabled (aio read size = 0 ; aio write size = 0)
	## is this still broken? issue is from 2019 (NOTE: see https://bugzilla.samba.org/show_bug.cgi?id=14095 )
	## (no, yes)
	#use sendfile = yes

	## samba will behave as previous versions of Samba would and will fail the lock request immediately if the lock range cannot be obtained.
	#blocking locks = No

	## disable loading of all printcap printers by default (iprint, cups, lpstat)
	load printers = No
	printcap name = /dev/null

	## Enabling this parameter will disable Samba's support for the SPOOLSS set of MS-RPC's.
	disable spoolss = yes

	## This parameters controls how printer status information is interpreted on your system.
	## (BSD, AIX, LPRNG, PLP, SYSV, HPUX, QNX, SOFTQ)
	printing = bsd

	## Disable that nmbd is acting as a WINS server for unknow netbios names
	#dns proxy = No

	## win/unix user mapping backend
	#idmap config * : backend = tdb

	## Allows the server name that is advertised through MDNS to be set to the hostname rather than the Samba NETBIOS name.
	## This allows an administrator to make Samba registered MDNS records match the case of the hostname rather than being in all capitals.
	## (netbios, mdns)
	mdns name = mdns

	## Clients that only support netbios won't be able to see your samba server when netbios support is disabled.
	#disable netbios = Yes

	## Setting this value to no will cause nmbd never to become a local master browser.
	#local master = no

	## (auto, yes) If this is set to yes, on startup, nmbd will force an election, and it will have a slight advantage in winning the election. It is recommended that this parameter is used in conjunction with domain master = yes, so that nmbd can guarantee becoming a domain master. 
	#preferred master = yes

	## (445 139) Specifies which ports the server should listen on for SMB traffic.
	## 139 is netbios/nmbd
	#smb ports = 445 139

	## This is a list of files and directories that are neither visible nor accessible.
	## Each entry in the list must be separated by a '/', which allows spaces to be included in the entry. '*' and '?' can be used to specify multiple files or directories as in DOS wildcards.
	veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/

	## If a directory that is to be deleted contains nothing but veto files this deletion will fail unless you also set the delete veto files parameter to yes.
	delete veto files = yes

################ Filesystem and creation rules ################
	## reported filesystem type (NTFS,Samba,FAT)
	#fstype = FAT

	## Allows a user who has write access to the file (by whatever means, including an ACL permission) to modify the permissions (including ACL) on it.
	#dos filemode = Yes

	## file/dir creating rules
	#create mask = 0666
	#directory mask = 0777
	#force group = root
	#force user = root
	#inherit owner = windows and unix
################################################################

Should I proceed with copying the default template into the Luci text-box?

Ah this is mysterious! The text box in Luci is now filled! This was a mysterious bug. Ok I will proceed with setting up my drive.

Ok proceeded and formatted drive etc. Drive is recognised by the router at /dev/sda1 however it is not at /mnt and when I click the link on 'Path' in the Luci Samba app I get

## 404 Not Found

Sorry, the object you requested was not found.

Unable to dispatch: /cgi-bin/luci/admin/system/mounts

So there is a problem somewhere.

Edit: Reboot fixed it.

Edit2: Ok, so the drive is mounted, and I added a directory on it called NAS1 to shared directories under the path /mnt/sda1/NAS1 On my Mac, under Network in Finder there is visible a server called 'workgroup'. However, I cannot connect to this server, and connection always fails and sometimes tells me to check my network connection. What am I doing wrong?

Try also add avahi-dbus-daemon for macOS and for windows clients add the wsdd2 package.
You can also try enable the "macOS compatibility" option in the luci settings page, but should also work without.

In finder you can add the share via the smb option, either by "routername/sharename" or via ip "routerip/sharename"

PS: Sorry its been a while since i tested on macOS.

Hi Andy, thanks for your help. avahi-dbus-daemon was already installed (although I recall my original error on install was something to do with dbus?) and I installed wsdd2 . No sign of the share on Windows, and I tried the Finder option Go -> Connect to server -> smb://192.168.1.1/NAS1 and also NAS (share-name in Luci) and also just the ip, no luck connecting on any attempt.

Is your actual share name "NAS1"? You need to use the name of the network share name, you have setup in the samba4 luci setup page.

That's 'NAS1' yep.

So even from windows explorer \\192.168.1.1\NAS1 wont work?

Is the smbd process running on the router?

1 Like