Debugging
How to Run Bacula Under the Debugger Manually?
If for some reason you cannot get the automatic traceback, or if you want to interactively examine the variable contents after a crash, you can run Bacula under the debugger. Assuming you want to run the Storage daemon under the debugger (the technique is the same for the other daemons, only the name changes), you would do the following:
Start the Director and the File daemon. If the Storage daemon also starts, you will need to find its PID (
ps fax | grep bacula-sd
) and kill it with a command like the following:kill -15 PIDwhere you replace PID by the actual value.
At this point, the Director and the File daemon should be running but the Storage daemon should not.
cd
to the directory containing the Storage daemonStart the Storage daemon under the debugger:
gdb ./bacula-sdRun the Storage daemon:
run -s -f -c ./bacula-sd.confYou may replace the ./bacula-sd.conf with the full path to the Storage daemon’s configuration file.
At this point, Bacula will be fully operational.
In another shell command window, start the Console program and do what is necessary to cause Bacula to die.
When Bacula crashes, the
gdb
shell window will become active andgdb
will show you the error that occurred.To get a general traceback of all threads, issue the following command:
thread apply all btAfter that you can issue any debugging command.
How to Get Debug Output from Bacula?
Each of the daemons normally has debug compiled into the program, but disabled. There are two ways to enable the debug output. One is to add the -d nnn option on the command line when starting the debugger. The nnn is the debug level, and generally anything between 50 and 200 is reasonable. The higher the number, the more output is produced. The output is written to standard output.
The second way of getting debug output is to dynamically turn it on using the Console using the
setdebug
command. The full syntax of the command is:setdebug level=nnn client=client-name storage=storage-name dirIf none of the options are given, the command will prompt you. You can selectively turn on/off debugging in any or all the daemons (i.e. it is not necessary to specify all the components of the above command).
See also
Go back to:
Go to:
Go back to the Bacula Enterprise Troubleshooting chapter.