[Samba] [4.13.13-Debian] " reopen_one_log: Unable to open new log file '/var/log/samba/': Is a directory"?

Rowland Penny rpenny at samba.org
Wed Jan 11 10:33:19 UTC 2023

On 11/01/2023 10:23, Michael Tokarev via samba wrote:
> 11.01.2023 13:15, Rowland Penny via samba wrote:
>>>> smb.conf: log file = /var/log/samba/%m
>>> some daemons work without client information, ie, they're not 
>>> client-specific.
>>> These will try to open log files too. Without client info, "%m" 
>>> expands to
>>> nothing, to an empty string. So you'll have the error message like that.
>>> Fix your log file setting. Check what's the default for this.
>> There isn't a default and '%m' is supposed to work.
>> I think we need to see how the OP is running Samba, to do this, we 
>> need the output of 'testparm -s' or 'samba-tool testparm' if it is a 
>> DC (which it shouldn't be, because it looks like nmbd is running).
> Sigh.  Rowland, sometimes you're not helpful at all. Like in this case.
> Yes there's no default for "log file" parameter, - that's my bad, I 
> remember
> seeing "/var/log/samba/log.%m" somewhere - it is not the default, it is the
> "example value" in man 5 smb.conf.
> As you wrote multiple times yourself, netbios is dead. %m is a netbios
> name of the client. And at the description of %m in man 5 smb.conf we
> can see:
>             This parameter is not available when Samba listens on port 
> 445, as
>             clients no longer send this information. If you use this 
> macro in
>             an include statement on a domain that has a Samba domain 
> controller
>             be sure to set in the [global] section smb ports = 139. This 
> will
>             cause Samba to not listen on port 445 and will permit include
>             functionality to function as it did with Samba 2.x.
> /var/log/samba/%m is *not* supposed to work, exactly the way it doesn't
> work in the OP case.  The only thing needed for him is to fix the
> log file parameter as I suggested to fix the issue.
> Please stay a bit more focused.
> Thanks,
> /mjt

No, you are not being helpful, try reading the smb.conf manpage, where 
you will find this:

        log file (G)

            This option allows you to override the name of the Samba log 
            (also known as the debug file).

            This option takes the standard substitutions, allowing you 
to have
            separate log files for each user or machine.

            No default

            Example: log file = /usr/local/samba/var/log.%m

As you can see, there is (as I said) no default and the example clearly 
shows that '%m' is expected to work.

Now what could be happening is that the OP is running Samba as a DC and 
has somehow started nmbd as well (a lot of the variable substitutions do 
not work on a DC), though I think this is unlikely.

If the OP is running a standalone server (much more likely), it should 
work. If it isn't working, then it it is likely to be a bug.


More information about the samba mailing list