File: What_Do_When_Bacula_Crashes.html

package info (click to toggle)
bacula-doc 9.6.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 241,364 kB
  • sloc: makefile: 1,869; perl: 937; sh: 218
file content (143 lines) | stat: -rw-r--r-- 14,185 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title>What To Do When Bacula Crashes (Kaboom)</title>
		<meta content="text/html; charset=utf-8" http-equiv="content-type" />
		<meta content="What To Do When Bacula Crashes (Kaboom)" name="description" />
		<meta content="problems" name="keywords" />
		<meta content="document" name="resource-type" />
		<meta content="global" name="distribution" />
		<meta content="LaTeX2HTML v2018" name="Generator" />
		<meta content="text/css" http-equiv="Content-Style-Type" />
		<link href="../css/problems.css" rel="STYLESHEET" />
		<link href="Bacula_Copyright_Trademark_.html" rel="next" />
		<link href="Dealing_with_Firewalls.html" rel="previous" />
		<link href="Problem_Resolution_Guide.html" rel="up" />
		<link href="Bacula_Copyright_Trademark_.html" rel="next" />
	</head>
	<body>
		<div class="navigation"><a href="Bacula_Copyright_Trademark_.html" name="tex2html390"> <img align="BOTTOM" alt="next" border="0" class="navigation-next" height="24" src="../images/next.png" width="37" /></a> <a href="Problem_Resolution_Guide.html" name="tex2html384"> <img align="BOTTOM" alt="up" border="0" class="navigation-up" height="24" src="../images/up.png" width="26" /></a> <a href="Dealing_with_Firewalls.html" name="tex2html378"> <img align="BOTTOM" alt="previous" border="0" class="navigation-prev" height="24" src="../images/prev.png" width="63" /></a> <a href="Contents.html" name="tex2html386"> <img align="BOTTOM" alt="contents" border="0" class="navigation-next" height="24" src="../images/contents.png" width="65" /></a> <a href="Index.html" name="tex2html388"> <img align="BOTTOM" alt="index" border="0" class="navigation-next" height="24" src="../images/index.png" width="43" /></a><br /><b> Next:</b> <a href="Bacula_Copyright_Trademark_.html" name="tex2html391">Bacula Copyright, Trademark, and</a> <b> Up:</b> <a href="Problem_Resolution_Guide.html" name="tex2html385">Problem Resolution Guide</a> <b> Previous:</b> <a href="Dealing_with_Firewalls.html" name="tex2html379">Dealing with Firewalls</a>  <b> <a href="Contents.html" name="tex2html387">Contents</a></b>  <b> <a href="Index.html" name="tex2html389">Index</a></b><br />
			<br />
		</div><a name="CHILD_LINKS"><strong>Subsections</strong></a><ul class="ChildLinks">
			<li><a href="What_Do_When_Bacula_Crashes.html#SECTION00610000000000000000" name="tex2html392">Traceback</a></li>
			<li><a href="What_Do_When_Bacula_Crashes.html#SECTION00620000000000000000" name="tex2html393">Testing The Traceback</a></li>
			<li><a href="What_Do_When_Bacula_Crashes.html#SECTION00630000000000000000" name="tex2html394">Getting A Traceback On Other Systems</a></li>
			<li><a href="What_Do_When_Bacula_Crashes.html#SECTION00640000000000000000" name="tex2html395">Manually Running Bacula Under The Debugger</a></li>
			<li><a href="What_Do_When_Bacula_Crashes.html#SECTION00650000000000000000" name="tex2html396">Getting Debug Output from Bacula</a></li>
		</ul>
		<hr />
		<h1><a name="SECTION00600000000000000000"></a> <a name="KaboomChapter"></a><br /> What To Do When Bacula Crashes (Kaboom) </h1><a name="3120"></a> <a name="3121"></a><p> If you are running on a Linux system, and you have a set of working configuration files, it is very unlikely that <b>Bacula</b> will crash. As with all software, however, it is inevitable that someday, it may crash, particularly if you are running on another operating system or using a new or unusual feature. </p>
		<p> This chapter explains what you should do if one of the three <b>Bacula</b> daemons (Director, File, Storage) crashes. When we speak of crashing, we mean that the daemon terminates abnormally because of an error. There are many cases where Bacula detects errors (such as PIPE errors) and will fail a job. These are not considered crashes. In addition, under certain conditions, Bacula will detect a fatal in the configuration, such as lack of permission to read/write the working directory. In that case, Bacula will force itself to crash with a SEGFAULT. However, before crashing, Bacula will normally display a message indicating why. For more details, please read on. </p>
		<p>
		</p>
		<h1><a name="SECTION00610000000000000000"> Traceback</a></h1><a name="3125"></a><p> Each of the three Bacula daemons has a built-in exception handler which, in case of an error, will attempt to produce a traceback. If successful the traceback will be emailed to you. </p>
		<p> For this to work, you need to ensure that a few things are setup correctly on your system: </p>
		<p>
			<ol>
				<li>You must have a version of Bacula built with debug information turned on and not stripped of debugging symbols. <p>
					</p>
				</li>
				<li>You must have an installed copy of <b>gdb</b> (the GNU debugger), and it must be on <b>Bacula's</b> path. On some systems such as Solaris, <b> gdb</b> may be replaced by <b>dbx</b>. <p>
					</p>
				</li>
				<li>The Bacula installed script file <b>btraceback</b> must be in the same directory as the daemon which dies, and it must be marked as executable. <p>
					</p>
				</li>
				<li>The script file <b>btraceback.gdb</b> must have the correct path to it specified in the <b>btraceback</b> file. <p>
					</p>
				</li>
				<li>You must have a <b>mail</b> program which is on <b>Bacula's</b> path. By default, this <b>mail</b> program is set to <b>bsmtp</b>, so it must be correctly configured. <p>
					</p>
				</li>
				<li>If you run either the Director or Storage daemon under a non-root userid, you will most likely need to modify the <b>btraceback</b> file to do something like <b>sudo</b> (raise to root priority) for the call to <b>gdb</b> so that it has the proper permissions to debug Bacula. </li>
			</ol>
		</p>
		<p> If all the above conditions are met, the daemon that crashes will produce a traceback report and email it to you. If the above conditions are not true, you can either run the debugger by hand as described below, or you may be able to correct the problems by editing the <b>btraceback</b> file. I recommend not spending too much time on trying to get the traceback to work as it can be very difficult. </p>
		<p> The changes that might be needed are to add a correct path to the <b>gdb</b> program, correct the path to the <b>btraceback.gdb</b> file, change the <b>mail</b> program or its path, or change your email address. The key line in the <b>btraceback</b> file is: </p>
		<p><pre>
gdb -quiet -batch -x /home/kern/bacula/bin/btraceback.gdb \
     $1 $2 2&gt;\&1 | bsmtp -s "Bacula traceback" your-address@xxx.com
</pre></p>
		<p> Since each daemon has the same traceback code, a single btraceback file is sufficient if you are running more than one daemon on a machine. </p>
		<p>
		</p>
		<h1><a name="SECTION00620000000000000000"> Testing The Traceback</a></h1><a name="3150"></a> <a name="3151"></a><p> To "manually" test the traceback feature, you simply start <b>Bacula</b> then obtain the <b>PID</b> of the main daemon thread (there are multiple threads). The output produced here will look different depending on what OS and what version of the kernel you are running. Unfortunately, the output had to be split to fit on this page: </p>
		<p><pre>
[kern@rufus kern]$ ps fax --columns 132 | grep bacula-dir
 2103 ?        S      0:00 /home/kern/bacula/k/src/dird/bacula-dir -c
                                       /home/kern/bacula/k/src/dird/dird.conf
 2104 ?        S      0:00  \_ /home/kern/bacula/k/src/dird/bacula-dir -c
                                       /home/kern/bacula/k/src/dird/dird.conf
 2106 ?        S      0:00      \_ /home/kern/bacula/k/src/dird/bacula-dir -c
                                       /home/kern/bacula/k/src/dird/dird.conf
 2105 ?        S      0:00      \_ /home/kern/bacula/k/src/dird/bacula-dir -c
                                       /home/kern/bacula/k/src/dird/dird.conf
</pre></p>
		<p> which in this case is 2103. Then while Bacula is running, you call the program giving it the path to the Bacula executable and the <b>PID</b>. In this case, it is: </p>
		<p><pre>
./btraceback /home/kern/bacula/k/src/dird 2103
</pre></p>
		<p> It should produce an email showing you the current state of the daemon (in this case the Director), and then exit leaving <b>Bacula</b> running as if nothing happened. If this is not the case, you will need to correct the problem by modifying the <b>btraceback</b> script. </p>
		<p> Typical problems might be that <b>gdb</b> or <b>dbx</b> for Solaris is not on the default path. Fix this by specifying the full path to it in the <b>btraceback</b> file. Another common problem is that you haven't modified the script so that the <b>bsmtp</b> program has an appropriate smtp server or the proper syntax for your smtp server. If you use the <b>mail</b> program and it is not on the default path, it will also fail. On some systems, it is preferable to use <b>Mail</b> rather than <b>mail</b>. </p>
		<p>
		</p>
		<h1><a name="SECTION00630000000000000000"> Getting A Traceback On Other Systems</a></h1><a name="3169"></a> <a name="3170"></a><p> It should be possible to produce a similar traceback on systems other than Linux, either using <b>gdb</b> or some other debugger. Solaris with <b>dbx</b> loaded works quite fine. On other systems, you will need to modify the <b>btraceback</b> program to invoke the correct debugger, and possibly correct the <b>btraceback.gdb</b> script to have appropriate commands for your debugger. If anyone succeeds in making this work with another debugger, please send us a copy of what you modified. Please keep in mind that for any debugger to work, it will most likely need to run as root, so you may need to modify the <b>btraceback</b> script accordingly. </p>
		<p><a name="ManuallyDebugging"></a></p>
		<h1><a name="SECTION00640000000000000000"> Manually Running Bacula Under The Debugger</a></h1><a name="3178"></a> <a name="3179"></a><p> 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: </p>
		<p>
			<ol>
				<li>Start the Director and the File daemon. If the Storage daemon also starts, you will need to find its PID as shown above (ps fax | grep bacula-sd) and kill it with a command like the following: <p><pre>
      kill -15 PID
</pre></p>
					<p> where you replace <b>PID</b> by the actual value. </p>
					<p>
					</p>
				</li>
				<li>At this point, the Director and the File daemon should be running but the Storage daemon should not. <p>
					</p>
				</li>
				<li>cd to the directory containing the Storage daemon <p>
					</p>
				</li>
				<li>Start the Storage daemon under the debugger: <p><pre>
    gdb ./bacula-sd
</pre></p>
					<p>
					</p>
				</li>
				<li>Run the Storage daemon: <p><pre>
     run -s -f -c ./bacula-sd.conf
</pre></p>
					<p> You may replace the <b>./bacula-sd.conf</b> with the full path to the Storage daemon's configuration file. </p>
					<p>
					</p>
				</li>
				<li>At this point, Bacula will be fully operational. <p>
					</p>
				</li>
				<li>In another shell command window, start the Console program and do what is necessary to cause Bacula to die. <p>
					</p>
				</li>
				<li>When Bacula crashes, the <b>gdb</b> shell window will become active and <b>gdb</b> will show you the error that occurred. <p>
					</p>
				</li>
				<li>To get a general traceback of all threads, issue the following command: <p><pre>
       thread apply all bt
</pre></p>
					<p> After that you can issue any debugging command. </p>
				</li>
			</ol>
		</p>
		<p>
		</p>
		<h1><a name="SECTION00650000000000000000"> Getting Debug Output from Bacula</a></h1><a name="3195"></a> 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 <b>-d nnn</b> option on the command line when starting the debugger. The <b>nnn</b> 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. <p> The second way of getting debug output is to dynamically turn it on using the Console using the <b>setdebug</b> command. The full syntax of the command is: </p>
		<p><pre>
 setdebug level=nnn client=client-name storage=storage-name dir
</pre></p>
		<p> If 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). </p>
		<p>
			<div class="navigation">
				<hr /><a href="Bacula_Copyright_Trademark_.html" name="tex2html390"> <img align="BOTTOM" alt="next" border="0" class="navigation-next" height="24" src="../images/next.png" width="37" /></a> <a href="Problem_Resolution_Guide.html" name="tex2html384"> <img align="BOTTOM" alt="up" border="0" class="navigation-up" height="24" src="../images/up.png" width="26" /></a> <a href="Dealing_with_Firewalls.html" name="tex2html378"> <img align="BOTTOM" alt="previous" border="0" class="navigation-prev" height="24" src="../images/prev.png" width="63" /></a> <a href="Contents.html" name="tex2html386"> <img align="BOTTOM" alt="contents" border="0" class="navigation-next" height="24" src="../images/contents.png" width="65" /></a> <a href="Index.html" name="tex2html388"> <img align="BOTTOM" alt="index" border="0" class="navigation-next" height="24" src="../images/index.png" width="43" /></a><br /><b> Next:</b> <a href="Bacula_Copyright_Trademark_.html" name="tex2html391">Bacula Copyright, Trademark, and</a> <b> Up:</b> <a href="Problem_Resolution_Guide.html" name="tex2html385">Problem Resolution Guide</a> <b> Previous:</b> <a href="Dealing_with_Firewalls.html" name="tex2html379">Dealing with Firewalls</a>  <b> <a href="Contents.html" name="tex2html387">Contents</a></b>  <b> <a href="Index.html" name="tex2html389">Index</a></b></div>
		</p>
	</body>
</html>