| 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">
 | 
|---|
| 4 | 
 | 
|---|
| 5 | <chapterinfo>
 | 
|---|
| 6 |         &author.jht;
 | 
|---|
| 7 |         &author.jelmer;
 | 
|---|
| 8 |         &author.tridge;
 | 
|---|
| 9 |         <pubdate> 27 June 1997 </pubdate>
 | 
|---|
| 10 | </chapterinfo>
 | 
|---|
| 11 | 
 | 
|---|
| 12 | <title>Reporting Bugs</title>
 | 
|---|
| 13 | 
 | 
|---|
| 14 | <sect1>
 | 
|---|
| 15 | <title>Introduction</title>
 | 
|---|
| 16 | 
 | 
|---|
| 17 | <para>
 | 
|---|
| 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.
 | 
|---|
| 23 | </para>
 | 
|---|
| 24 | 
 | 
|---|
| 25 | <para>
 | 
|---|
| 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
 | 
|---|
| 31 | us fix it fast. 
 | 
|---|
| 32 | </para>
 | 
|---|
| 33 | 
 | 
|---|
| 34 | <para>
 | 
|---|
| 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.
 | 
|---|
| 40 | </para>
 | 
|---|
| 41 | 
 | 
|---|
| 42 | <para>
 | 
|---|
| 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>.
 | 
|---|
| 46 | </para>
 | 
|---|
| 47 | 
 | 
|---|
| 48 | </sect1>
 | 
|---|
| 49 | 
 | 
|---|
| 50 | <sect1>
 | 
|---|
| 51 | <title>General Information</title>
 | 
|---|
| 52 | 
 | 
|---|
| 53 | <para>
 | 
|---|
| 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.
 | 
|---|
| 58 | </para>
 | 
|---|
| 59 | 
 | 
|---|
| 60 | <para>
 | 
|---|
| 61 | Have you looked through <link linkend="diagnosis">The Samba Checklist</link>? This is extremely important.
 | 
|---|
| 62 | </para>
 | 
|---|
| 63 | 
 | 
|---|
| 64 | <para>
 | 
|---|
| 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.
 | 
|---|
| 68 | </para>
 | 
|---|
| 69 | 
 | 
|---|
| 70 | </sect1>
 | 
|---|
| 71 | 
 | 
|---|
| 72 | <sect1 id="dbglvl">
 | 
|---|
| 73 | <title>Debug Levels</title>
 | 
|---|
| 74 | 
 | 
|---|
| 75 | <para>
 | 
|---|
| 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.
 | 
|---|
| 81 | </para>
 | 
|---|
| 82 | 
 | 
|---|
| 83 | <para>
 | 
|---|
| 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:
 | 
|---|
| 90 | </para>
 | 
|---|
| 91 | 
 | 
|---|
| 92 | <smbconfblock>
 | 
|---|
| 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>
 | 
|---|
| 96 | </smbconfblock>
 | 
|---|
| 97 | 
 | 
|---|
| 98 | <para>
 | 
|---|
| 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.
 | 
|---|
| 103 | </para>
 | 
|---|
| 104 | 
 | 
|---|
| 105 | <para>
 | 
|---|
| 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.
 | 
|---|
| 109 | </para>
 | 
|---|
| 110 | 
 | 
|---|
| 111 | <para>
 | 
|---|
| 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.
 | 
|---|
| 116 | </para>
 | 
|---|
| 117 | 
 | 
|---|
| 118 |         <sect2>
 | 
|---|
| 119 |         <title>Debugging-Specific Operations</title>
 | 
|---|
| 120 | 
 | 
|---|
| 121 |         <para>
 | 
|---|
| 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:
 | 
|---|
| 129 |         </para>
 | 
|---|
| 130 | 
 | 
|---|
| 131 | <para>
 | 
|---|
| 132 | <smbconfblock>
 | 
|---|
| 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>
 | 
|---|
| 136 | </smbconfblock>
 | 
|---|
| 137 | </para>
 | 
|---|
| 138 | 
 | 
|---|
| 139 |         <para>
 | 
|---|
| 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.
 | 
|---|
| 145 |         </para>
 | 
|---|
| 146 | 
 | 
|---|
| 147 |         <table frame="all" id="dbgclass">
 | 
|---|
| 148 |                 <title>Debuggable Functions</title>
 | 
|---|
| 149 |         <tgroup cols="2" align="center">
 | 
|---|
| 150 |                 <thead>
 | 
|---|
| 151 |                 <row><entry>Function Name</entry><entry>Function Name</entry></row>
 | 
|---|
| 152 |                 </thead>
 | 
|---|
| 153 |                 <tbody>
 | 
|---|
| 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>
 | 
|---|
| 162 |                 </tbody>
 | 
|---|
| 163 |         </tgroup>
 | 
|---|
| 164 |         </table>
 | 
|---|
| 165 | 
 | 
|---|
| 166 |         </sect2>
 | 
|---|
| 167 | 
 | 
|---|
| 168 | </sect1>
 | 
|---|
| 169 | 
 | 
|---|
| 170 | <sect1>
 | 
|---|
| 171 | <title>Internal Errors</title>
 | 
|---|
| 172 | 
 | 
|---|
| 173 | <para>
 | 
|---|
| 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).
 | 
|---|
| 178 | </para>
 | 
|---|
| 179 | 
 | 
|---|
| 180 | <para>
 | 
|---|
| 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.
 | 
|---|
| 185 | </para>
 | 
|---|
| 186 | 
 | 
|---|
| 187 | <para>
 | 
|---|
| 188 | You should also detail how to reproduce the problem, if
 | 
|---|
| 189 | possible. Please make this reasonably detailed.
 | 
|---|
| 190 | </para>
 | 
|---|
| 191 | 
 | 
|---|
| 192 | 
 | 
|---|
| 193 | <para>
 | 
|---|
| 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
 | 
|---|
| 198 | use it, you do this:
 | 
|---|
| 199 | <indexterm><primary>gdb</primary></indexterm>
 | 
|---|
| 200 | <indexterm><primary>debug</primary></indexterm>
 | 
|---|
| 201 | <screen>
 | 
|---|
| 202 | &prompt;<userinput>gdb smbd core</userinput>
 | 
|---|
| 203 | </screen>
 | 
|---|
| 204 | </para>
 | 
|---|
| 205 | 
 | 
|---|
| 206 | <para>
 | 
|---|
| 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.
 | 
|---|
| 213 | </para>
 | 
|---|
| 214 | 
 | 
|---|
| 215 | <para>
 | 
|---|
| 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
 | 
|---|
| 222 | useful. 
 | 
|---|
| 223 | </para>
 | 
|---|
| 224 | </sect1>
 | 
|---|
| 225 | 
 | 
|---|
| 226 | <sect1>
 | 
|---|
| 227 | <title>Attaching to a Running Process</title>
 | 
|---|
| 228 | 
 | 
|---|
| 229 | <para>
 | 
|---|
| 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
 | 
|---|
| 241 | where it occurred.
 | 
|---|
| 242 | </para>
 | 
|---|
| 243 | 
 | 
|---|
| 244 | <para>
 | 
|---|
| 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.
 | 
|---|
| 248 | </para>
 | 
|---|
| 249 | 
 | 
|---|
| 250 | <para>
 | 
|---|
| 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:
 | 
|---|
| 253 | <screen>
 | 
|---|
| 254 | panic action = "/bin/sleep 90000"
 | 
|---|
| 255 | </screen>
 | 
|---|
| 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:
 | 
|---|
| 259 | <screen>
 | 
|---|
| 260 | &rootprompt; gdb -p PID
 | 
|---|
| 261 | </screen>
 | 
|---|
| 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.
 | 
|---|
| 265 | </para>
 | 
|---|
| 266 | 
 | 
|---|
| 267 | </sect1>
 | 
|---|
| 268 | 
 | 
|---|
| 269 | <sect1>
 | 
|---|
| 270 | <title>Patches</title>
 | 
|---|
| 271 | 
 | 
|---|
| 272 | 
 | 
|---|
| 273 | <para>
 | 
|---|
| 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. 
 | 
|---|
| 281 | </para>
 | 
|---|
| 282 | 
 | 
|---|
| 283 | </sect1>
 | 
|---|
| 284 | </chapter>
 | 
|---|