> I also get an email saying "24-Feb 21:46 bacula-dir JobId 0: Loaded
plugin: ldap-dir.so”.
If a runscript stanza runs as 'console' instead of using 'command' to run
an actual script file, the resulting bacula log entries will be associated
with 'jobid 0'. I'd check your bacula director configuration for any
instance of the word 'console'.
'grep -i console /opt/bacula/etc/bacula-dir.conf'
Look for lines like 'console = some bconsole command'
Bill A previously had these words to say about why it's better to put your
bconsole commands in a script that echos the command to bconsole, vs using
'console ='.
>From Bill A's previous emails on this list:
"
*NOTE: I don't recommend using the `Console =` option in RunsScript{}
stanzas for a few reasons.
- If you use `Console =`, any output from them appears mixed into your
bacula.log file, identified as `JobID: 0` so you never
know what job actually caused the outputs
- Using `Command =` you are able to fully control everything in a script.
- Any stdout in your script is printed in the Admin joblog that called it.
So you can add any output you like so your Admin
job log is quite verbose and you know everything that happened, and when.
(bconsole: ll joblog jobid=xxxx)
- If you use `Console =` you cannot get the outputs from the above bconsole
command
"
The alternative to 'console = some bconsole command' is to echo the desired
command to bconsole.
In some cases you can get away with `echo "this is my command" | bconsole`
though for a script you should define things like the bconsole binary path,
and the bconsole config location.
Additionally, you can use echo to pass newlines through to bconsole, and
thus step through an interactive bconsole menu.
See example from Bill A below:
"
Example script to call with the `Command =` setting in your RunScript:
----8<----
#!/bin/bash
bcbin="/opt/bacula/bin/bconsole"
bccfg="/opt/bacula/etc/bconsole.conf"
echo "Whatever you want to appear in Admin joblog"
echo -e "your bconsole command\nquit\n" | ${bcbin} -c ${bccfg} # All
output will be in your Admin Job's joblog
echo "Whatever else you want to appear in Admin joblog"
----8<----
"
I THINK Bill has previously asserted that it's better to 'quit' your
bconsole sessions after entering commands. I'm fuzzy on the reason, but I
think it was something like 'if you don't quit your bconsole sessions,
they'll stay resident in the background', or something like that. I could
be hallucinating all of this. Don't blame Bill if I'm misremembering. IIRC,
others asserted that this wasn't current bacula behavior. Either way, you
can see how this could be useful, especially if you needed to provide
multiple stages of input.
Martin S has warned that echo commands and shell behavior varies,
particularly around handling of newlines. Some echo's don't have -e. Some
shells directly handle \n, others don't. Test the echo command I gave and
make sure it works for you. Or try printf (I have no experience there, but
martin suggested it).
>chrisw@m910q:~$ bacula-dir -t
>24-Feb 21:46 Message delivery ERROR: Msg delivery error: fopen
/opt/bacula/working/bacula-dir.bacula-dir.-1616568216.mail failed:
ERR=Permission denied
>24-Feb 21:46 Message delivery ERROR: fopen /var/log/bacula/bacula.log
failed: ERR=Permission denied
Those errors make sense, at least.
Only user bacula can write to /opt/bacula/working. User chrisw is not user
bacula.
Members of group bacula, or 'others' cannot write to the
/opt/bacula/working directory.
> chrisw@m910q:~$ ls -l /opt/bacula/
...
> drwxr-xr-x 2 bacula bacula 12288 Feb 24 06:15 working
I'd guess similarly, user chrisw doesn't have write permission for logfile
/var/log/bacula/log/bacula.log.
On my systems, file bacula.log only allowes user bacula to write to the log.
example:
[gerber@td-bacula ~]$ ls -l /opt/bacula/log/bacula.log
-rw-r--r--. 1 bacula bacula 51378289 Feb 24 16:01 /opt/bacula/log/bacula.log
# I am curious to see the output of
id chrisw
# and
ls -l /var/log/bacula/log/bacula.log
What happens if you either:
# As root, order bacula-dir to run itself with user bacula, and group bacula
sudo bacula-dir -t -u bacula -g bacula
# Or, as any user besides bacula, run:
sudo su bacula
# then as user bacula, run:
bacula-dir -t
(for this second option, you might have to set a shell for user bacula, if
you've never become bacula before)
As a reminder, *never run the director or SD as root* (or any other user
besides bacula) to avoid messing up permissions on PID and state files
The FD already runs as root. So 'sudo bacula-fd -t' is correct for it.
Robert Gerber
402-237-8692
[email protected]
On Tue, Feb 24, 2026, 4:20 PM Chris Wilkinson <[email protected]>
wrote:
> Just recently I’ve been getting the following error in response to the
> check config command bacula-dir -t. I also get an email saying "24-Feb
> 21:46 bacula-dir JobId 0: Loaded plugin: ldap-dir.so”. Backups are running
> normally with no errors and normal completion emails
> (Bacula-v15/Debian-Bookworm compiled from source).
>
> <
> chrisw@m910q:~$ bacula-dir -t
> 24-Feb 21:46 Message delivery ERROR: Msg delivery error: fopen
> /opt/bacula/working/bacula-dir.bacula-dir.-1616568216.mail failed:
> ERR=Permission denied
> 24-Feb 21:46 Message delivery ERROR: fopen /var/log/bacula/bacula.log
> failed: ERR=Permission denied
> >
>
> DIR runs as bacula:bacula
>
> chrisw@m910q:~$ ls -l /opt/bacula/
> total 44
> drwxr-xr-x 2 root root 4096 Nov 7 2024 bin
> drwxr-x--- 2 bacula bacula 4096 Dec 24 18:32 bsr
> drwxr-xr-x 7 bacula tape 4096 Feb 21 00:16 cache
> drwxr-xr-x 2 bacula bacula 4096 Feb 23 19:44 etc
> drwxr-xr-x 2 root root 4096 Nov 9 2024 lib
> drwxr-xr-x 2 bacula bacula 4096 Feb 1 00:00 log
> drwxr-xr-x 2 root root 4096 Nov 9 2024 plugins
> drwxr-xr-x 3 root root 4096 Nov 7 2024 scripts
> drwxr-xr-x 2 bacula bacula 12288 Feb 24 06:15 working
>
> chrisw@m910q:~$ ls -l /opt/bacula/working/
> total 40
> -rw-r--r-- 1 bacula bacula 857 Jan 1 08:59 bacula.3513.traceback
> -rw-r----- 1 bacula bacula 2196 Feb 24 06:15 bacula-dir.9101.state
> -rw-r--r-- 1 bacula bacula 60 Feb 23 20:30
> bacula-dir.bacula-dir.1914724472.mail
> -rw-r----- 1 root root 2196 Feb 24 06:15 bacula-fd.9102.state
> -rw-r----- 1 bacula tape 8 Feb 23 17:39 bacula-sd.9103.pid
> -rw-r----- 1 bacula tape 2196 Feb 24 06:15 bacula-sd.9103.state
> -rw------- 1 bacula bacula 13309 Feb 24 06:15 m910q-dir.conmsg
>
> The messages resource is more or less per manual.
>
> <
> Messages {
> Name = "Standard"
> MailCommand = "/opt/bacula/bin/bsmtp -h localhost -s \"Bacula %n\" %r"
> OperatorCommand = "/opt/bacula/bin/bsmtp -h localhost -f \"\(Bacula\)
> %r\" -s \"Bacula: Intervention needed for Job:%n %j\" %r"
> Syslog = All, !Skipped
> Mail = root@localhost = All, !Skipped
> Append = /var/log/bacula/bacula.log = All, !Skipped
> Console = All, !Skipped
> Operator = root@localhost = All, !Skipped
> Catalog = All, !Skipped
> }
> >
>
> Similar commands for FD and SD run without error.
>
> I’m guessing that there is a permissions issue somewhere but I’m
> struggling to know where to look. Any suggestions would be great.
>
> Best
> -Chris-
>
>
>
>
> _______________________________________________
> Bacula-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bacula-users
>
_______________________________________________
Bacula-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-users