Is there any way to reset my samba config to Freenas defaults?

anderstn

Dabbler
Joined
Oct 2, 2017
Messages
41
Hi

I had an unexpected shut down when trying to disable atime on a pool. At the time I was sharing files from this pool and that has apparently caused some issues with my samba config. When I start the service in the GUI it just says it failed to start so I tried doing it via SSH just to see what messages it actually returned and got this:

Code:
[: ==: unexpected operator
Performing sanity check on Samba configuration: FAILED


Now I have been messing around with samba files manually in Linux, but that is a long time ago so I was wondering if there was a way to remove the bad file and have Freenas generate a new one.
 

anderstn

Dabbler
Joined
Oct 2, 2017
Messages
41
So I found the smb4.conf and I can't see anything out of the ordinary. What other samba related files can be causing this issue?

(added the config in a spoiler to avoid taking up a lot of space)
[global]
username map = /usr/local/etc/smbusers
server min protocol = SMB2_02
server max protocol = SMB3
interfaces = 127.0.0.1 192.168.1.101
bind interfaces only = yes
encrypt passwords = yes
dns proxy = no
strict locking = no
oplocks = yes
deadtime = 15
max log size = 51200
private dir = /var/db/samba4/private
max open files = 468857
logging = file
load printers = no
printing = bsd
printcap name = /dev/null
disable spoolss = yes
getwd cache = yes
guest account = nobody
obey pam restrictions = yes
ntlm auth = no
directory name cache size = 0
kernel change notify = no
nsupdate command = /usr/local/bin/samba-nsupdate -g
server string = FreeNAS Server
ea support = yes
store dos attributes = yes
lm announce = yes
hostname lookups = yes
time server = yes
acl allow execute always = true
dos filemode = yes
multicast dns register = yes
domain logons = no
local master = yes
idmap config *: backend = tdb
idmap config *: range = 90000001-100000000
server role = standalone
netbios name = FREENAS
workgroup = WORKGROUP
security = user
create mask = 0666
directory mask = 0777
client ntlmv2 auth = yes
dos charset = CP437
unix charset = UTF-8
log level = 1


[musikk]
path = "/mnt/TOSHIBA_N300_MIRROR/musikk"
printable = no
veto files = /.snapshot/.windows/.mac/.zfs/
writeable = yes
browseable = yes
access based share enum = no
vfs objects = zfs_space zfsacl streams_xattr
hide dot files = yes
guest ok = no
nfs4:mode = special
nfs4:acedup = merge
nfs4:chown = true
zfsacl:acesort = dontcare
 

anderstn

Dabbler
Joined
Oct 2, 2017
Messages
41
Looking into how to fix the issue I came across testparm. Running it didn't say much in itself but it did spit out a few new error messages which lead me to another thread on the forums: https://www.ixsystems.com/community...ty-check-on-samba-configuration-failed.74186/. Basically the problem I encountered was the same as this user here. The samba4 database, or log area?, had been messed up bad when my pool went down and testparm was unable to create a messaging context.

PS: It is somewhat annoying that the service can't indicate that this is where the problem lies as most would probably go straight to the configuration which is perfectly fine in a case like this. But that's probably a samba issue and not a Freenas problem :)
 

anderstn

Dabbler
Joined
Oct 2, 2017
Messages
41
Hi

With the old config it gave the same error as seen in the linked tread. Something about incorrect permissions on the samba db directory and then "Unable to initialize messaging context!". I have backed up the old directories in "/var/db/samba4" so if the permissions can indicate the fault more clearly to you than it did to me I can always do a side by side comparison with the new folder which samba generated to show the differences.

After the issue I also checked where the log directories was stored and Freenas had decided to put them on the mirrored pool which I was trying to disable atime on when the server crashed. Still with the exception of a weird hostname issue, see https://www.ixsystems.com/community...incorrect-what-should-i-do.76194/#post-530230, which may be permission related this has not seemed to mess up any other permissions inside "/var".

Off topic: I have since moved "/var" to the thumb drive where the OS is located as the idea og having logging stored on a medium which may fail, at which point the logs telling me why it failed could be useful, seems like a bad idea all around. Also it's a high quality 32 gig thumb drive I bought brand new for Freenas so I'm not really worried about the write cycles being spent in the immediate future :p
 

Stefan Fox

Cadet
Joined
Dec 28, 2019
Messages
1
# Global parameters
[global]
aio max threads = 2
bind interfaces only = Yes
disable spoolss = Yes
dns proxy = No
enable web service discovery = Yes
kernel change notify = No
load printers = No
logging = file
max log size = 51200
netbios name = WINDOWS
nsupdate command = /usr/local/bin/samba-nsupdate -g
restrict anonymous = 2
server min protocol = NT1
server role = standalone server
server string = FreeNAS Server
idmap config *: range = 90000001-100000000
idmap config * : backend = tdb
allocation roundup size = 0
directory name cache size = 0
dos filemode = Yes
include = /usr/local/etc/smb4_share.conf


[Windows]
aio write size = 0
ea support = No
mangled names = illegal
path = /mnt/HomeFreeNAS/Windows
read only = No
vfs objects = streams_xattr shadow_copy_zfs ixnas
nfs4:acedup = merge
nfs4:chown = true
 
Top