1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <chapter id="bugreport">
9 <pubdate> 27 June 1997 </pubdate>
12 <title>Reporting Bugs</title>
15 <title>Introduction</title>
18 <indexterm><primary>Bugzilla</primary></indexterm>
19 <indexterm><primary>bug reports</primary></indexterm>
20 Please report bugs using Samba's <ulink url="https://bugzilla.samba.org/">Bugzilla</ulink> facilities and take
21 the time to read this file before you submit a bug report. Also, check to see if it has changed between
22 releases, as we may be changing the bug reporting mechanism at some point.
26 Please do as much as you can yourself to help track down the
27 bug. Samba is maintained by a dedicated group of people who volunteer
28 their time, skills, and efforts. We receive far more mail than
29 we can possibly answer, so you have a much higher chance of a response
30 and a fix if you send us a <quote>developer-friendly</quote> bug report that lets
35 <indexterm><primary>configuration problem</primary></indexterm>
36 If you suspect that your
37 problem is not a bug but a configuration problem, it is best to send
38 it to the Samba mailing list, as there are thousands of other users on
39 that list who may be able to help you.
43 You may also like to look though the recent mailing list archives,
44 which are conveniently accessible on the Samba Web pages
45 at <ulink noescape="1" url="http://samba.org/samba/">http://samba.org/samba/</ulink>.
51 <title>General Information</title>
54 Before submitting a bug report, check your config for silly
55 errors. Look in your log files for obvious messages that tell
56 you've misconfigured something. Run testparm to check your config
57 file for correct syntax.
61 Have you looked through <link linkend="diagnosis">The Samba Checklist</link>? This is extremely important.
65 If you include part of a log file with your bug report, then be sure to
66 annotate it with exactly what you were doing on the client at the
67 time and exactly what the results were.
73 <title>Debug Levels</title>
76 If the bug has anything to do with Samba behaving incorrectly as a
77 server (like refusing to open a file), then the log files will probably
78 be quite useful. Depending on the problem, a log level of between 3 and
79 10 showing the problem may be appropriate. A higher level gives more
80 detail but may use too much disk space.
84 <indexterm><primary>debug level</primary></indexterm>
85 <indexterm><primary>log level</primary></indexterm>
86 To set the debug level, use the <smbconfoption name="log level"/> in your
87 &smb.conf;. You may also find it useful to set the log
88 level higher for just one machine and keep separate logs for each machine.
89 To do this, add the following lines to your main &smb.conf; file:
93 <smbconfoption name="log level">10</smbconfoption>
94 <smbconfoption name="log file">/usr/local/samba/lib/log.%m</smbconfoption>
95 <smbconfoption name="include">/usr/local/samba/lib/smb.conf.%m</smbconfoption>
99 and create a file <filename>/usr/local/samba/lib/smb.conf.<replaceable>machine</replaceable></filename> where
100 <replaceable>machine</replaceable> is the name of the client you wish to debug. In that file put any
101 &smb.conf; commands you want; for example, <smbconfoption name="log level"/> may be useful. This also allows
102 you to experiment with different security systems, protocol levels, and so on, on just one machine.
106 The &smb.conf; entry <smbconfoption name="log level"/> is synonymous with the parameter <smbconfoption
107 name="debuglevel"/> that has been used in older versions of Samba and is being retained for backward
108 compatibility of &smb.conf; files.
112 As the <smbconfoption name="log level"/> value is increased, you will record a significantly greater level of
113 debugging information. For most debugging operations, you may not need a setting higher than
114 <constant>3</constant>. Nearly all bugs can be tracked at a setting of <constant>10</constant>, but be
115 prepared for a large volume of log data.
119 <title>Debugging-Specific Operations</title>
122 <indexterm><primary>debugging</primary></indexterm>
123 <indexterm><primary>logging</primary></indexterm>
124 <indexterm><primary>functional components</primary></indexterm>
125 <indexterm><primary>cluttering</primary></indexterm>
126 Samba-3.x permits debugging (logging) of specific functional components without unnecessarily
127 cluttering the log files with detailed logs for all operations. An example configuration to
128 achieve this is shown in:
133 <smbconfoption name="log level">0 tdb:3 passdb:5 auth:4 vfs:2</smbconfoption>
134 <smbconfoption name="max log size">0</smbconfoption>
135 <smbconfoption name="log file">/var/log/samba/%U.%m.log</smbconfoption>
140 This will cause the level of detail to be expanded to the debug class (log level) passed to
141 each functional area per the value shown above. The first value passed to the <parameter>log level</parameter>
142 of <constant>0</constant> means turn off all unnecessary debugging except the debug classes set for
143 the functional areas as specified. The table shown in <link linkend="dbgclass">Debuggable Functions</link>
144 may be used to attain very precise analysis of each SMB operation Samba is conducting.
147 <table frame="all" id="dbgclass">
148 <title>Debuggable Functions</title>
149 <tgroup cols="2" align="center">
151 <row><entry>Function Name</entry><entry>Function Name</entry></row>
154 <row><entry>all</entry><entry>passdb</entry></row>
155 <row><entry>tdb</entry><entry>sam</entry></row>
156 <row><entry>printdrivers</entry><entry>auth</entry></row>
157 <row><entry>lanman</entry><entry>winbind</entry></row>
158 <row><entry>smb</entry><entry>vfs</entry></row>
159 <row><entry>rpc_parse</entry><entry>idmap</entry></row>
160 <row><entry>rpc_srv</entry><entry>quota</entry></row>
161 <row><entry>rpc_cli</entry><entry>acls</entry></row>
171 <title>Internal Errors</title>
174 If you get the message <quote><errorname>INTERNAL ERROR</errorname></quote> in your log files,
175 it means that Samba got an unexpected signal while running. It is probably a
176 segmentation fault and almost certainly means a bug in Samba (unless
177 you have faulty hardware or system software).
181 If the message came from smbd, it will probably be accompanied by
182 a message that details the last SMB message received by smbd. This
183 information is often useful in tracking down the problem, so please
184 include it in your bug report.
188 You should also detail how to reproduce the problem, if
189 possible. Please make this reasonably detailed.
194 <indexterm><primary>core files</primary></indexterm>
195 You may also find that a core file appeared in a <filename>corefiles</filename>
196 subdirectory of the directory where you keep your Samba log
197 files. This file is the most useful tool for tracking down the bug. To
199 <indexterm><primary>gdb</primary></indexterm>
200 <indexterm><primary>debug</primary></indexterm>
202 &prompt;<userinput>gdb smbd core</userinput>
207 <indexterm><primary>dbx</primary></indexterm>
208 <indexterm><primary>stack trace</primary></indexterm>
209 adding appropriate paths to smbd and core so gdb can find them. If you
210 do not have gdb, try <userinput>dbx</userinput>. Then within the debugger,
211 use the command <command>where</command> to give a stack trace of where the
212 problem occurred. Include this in your report.
216 <indexterm><primary>disass</primary></indexterm>
217 If you know any assembly language, do a <command>disass</command> of the routine
218 where the problem occurred (if it's in a library routine, then
219 disassemble the routine that called it) and try to work out exactly
220 where the problem is by looking at the surrounding code. Even if you
221 do not know assembly, including this information in the bug report can be
227 <title>Attaching to a Running Process</title>
230 <indexterm><primary>PID</primary></indexterm>
231 <indexterm><primary>gdb</primary></indexterm>
232 <indexterm><primary>smbstatus</primary></indexterm>
233 Unfortunately, some UNIXes (in particular some recent Linux kernels)
234 refuse to dump a core file if the task has changed UID (which smbd
235 does often). To debug with this sort of system, you could try to attach
236 to the running process using
237 <userinput>gdb smbd <replaceable>PID</replaceable></userinput>, where you get
238 <replaceable>PID</replaceable> from <application>smbstatus</application>.
239 Then use <command>c</command> to continue and try to cause the core dump
240 using the client. The debugger should catch the fault and tell you
245 Sometimes it is necessary to build Samba binary files that have debugging
246 symbols so as to make it possible to capture enough information from a crashed
247 operation to permit the Samba Team to fix the problem.
251 Compile with <constant>-g</constant> to ensure you have symbols in place.
252 Add the following line to the &smb.conf; file global section:
254 panic action = "/bin/sleep 90000"
256 to catch any panics. If <command>smbd</command> seems to be frozen, look for any sleep
257 processes. If it is not, and appears to be spinning, find the PID
258 of the spinning process and type:
260 &rootprompt; gdb -p PID
262 <indexterm><primary>spinning process</primary></indexterm>
263 then type <quote>bt full</quote> to
264 get a backtrace to see where the smbd is in the call path.
270 <title>Patches</title>
274 <indexterm><primary>diff</primary></indexterm>
275 <indexterm><primary>patch</primary></indexterm>
276 The best sort of bug report is one that includes a fix! If you send us
277 patches, please use <userinput>diff -u</userinput> format if your version of
278 diff supports it; otherwise, use <userinput>diff -c4</userinput>. Make sure
279 you do the diff against a clean version of the source and let me know
280 exactly what version you used.