Samba could not be configured. Try again. Exception: Syntax error while checking the temporary samba config file - V2

[Please complete the below template with details of the problem reported on your Web-UI. Be as detailed as possible. Community members, including developers, shall try and help. Thanks for your time in reporting this issue! We recommend purchasing commercial support for expedited support directly from the developers.]

Brief description of the problem

Unable to create Samba workgroup WORKGROUP
Rockstor 3.9.2-57

Detailed step by step instructions to reproduce the problem

Start Samba, enter WORKGROUP, Submit

Web-UI screenshot


Error Traceback provided on the Web-UI

Traceback (most recent call last): File "/opt/rockstor/src/rockstor/smart_manager/views/", line 99, in post update_global_config(global_config, adconfig) File "/opt/rockstor/src/rockstor/system/", line 199, in update_global_config test_parm(npath) File "/opt/rockstor/src/rockstor/system/", line 47, in test_parm raise Exception("Syntax error while checking the temporary samba config file") Exception: Syntax error while checking the temporary samba config file

Hi @bscaife, and welcome!

The error you are seeing tells us that samba has detected a syntax error with its config file, as we use its built-in tool testparm to verify that the file is valid.
Now, just to make sure, could you confirm the settings you entered in the configuration window?

  1. What did you enter in the Workgroup field?
  2. What did you enter in the Custom global settings field (if anything at all)?

Once we have rule that out, we can try to dig a little deeper into what is causing this issue as I couldn’t quickly reproduce it on my end for now.

Hope this helps,

All I entered was WORKGROUP


OK… so that’s an odd one, then, as there shouldn’t be any reason for that temp file to be incorrect.

Indeed, the way Rockstor implements the writing of the smb.conf file essentially boils down to writing some required defaults settings, and add to it custom settings set by the user in the “Samba service configuration” dialog window. If curious, the most important bit of that is:

Now, as you can see in the first few lines of this function, all of that is written in a temporary file that is then checked by Samba’s built-in tool testparm before moving the temp file to its final and expected location (/etc/samba/smb.conf). In your case, this verification is failing.
I have to admit that I’m at a loss as to why that temp file is incorrectly written but we can try to see how it looks like and see what is happening, hopefully.

Unfortunately, this temporary file is automatically generated and thus has a random and unpredictable name. I do see a few ways to find out what that name is, however. The simpler (does not require changing code), would be as follows:

  1. Go to System > Services, and then click on the little wrench icon to configure the Samba service. Enter WORKGROUP as workgroup, and leave the custom options field empty.
  2. After that, you should see the same error message as you originally reported.
  3. run the following command: grep "workgroup" /tmp/tmp*
    This should list all the files (if any) that contain the workgroup string. In your case, you should hopefully see a line that includes the string workgroup = WORKGROUP. The beginning of the file is the temporary file name.
    If that worked, you can then simply print the file (using cat <filename>) and paste its content here.

Sorry for not being able to give you a more straight answer or solution at the moment, but I’ll admit that I’m puzzled by how that happened. Hopefully that will give us some clues, however.


Thanks - did as you suggested and then went to system shell and I get
[bscaife@rockstor ~]$ grep “workgroup” /tmp/tmp*
grep: /tmp/tmpeCSkAM: Permission denied
grep: /tmp/tmpld52eo: Permission denied
Gave myself SUDO rights and then got nothing.