Red Hat Linux 7 Unleashed

Red Hat Linux 7 Unleashed

By William Ball

Samba Troubleshooting Tips

A detailed description of the troubleshooting process used in Samba diagnosis is beyond the scope of this chapter. Suffice it to say that you diagnose Samba problems using a narrowing process similar to other troubleshooting tasks. This section gives a few handy tips for quick diagnosis of Samba problems.

Use testparm Early and Often

The testparm utility tests your smb.conf file for legal syntax, printing out errors and warnings for illegal syntaxes. The 15 seconds it takes is well worth the reduction in troubleshooting time. Many problems revealed by testparm are difficult to pinpoint with other tests.

Another great use for testparm is finding Samba's defaults. Start by creating an empty file called empty.fil. Then, to find the default for the preferred master= parameter, execute the following command:


   $ testparm -s empty.fil | grep -i "preferred master"
        preferred master = No
$

The preceding command reveals the default to be No.

Use DIAGNOSIS.txt

This is a predefined diagnostic written by Andrew Tridgell, the originator of Samba. Following the steps of this file yields a remarkably quick pinpointing of the cause of Samba problems. Better still, it provides a common symptom description tool for everyone, so a simple "it failed on step 7 of DIAGNOSIS.txt" replaces paragraphs of text. On your Red Hat 7 distribution, this file is available at /usr/share/doc/samba-2.0.7/ docs/textdocs/DIAGNOSIS.txt.

Understand the Access Hierarchy

Samba requires a functioning network, meaning you can't Samba if you can't ping. A "Samba problem" is not really a Samba problem if you can't ping—it's a network problem.

Likewise, you can't browse on a Windows client if you can't browse (via smbclient -NL servername) on the Linux server. So if Windows browsing doesn't work, check browsing on the server.

Additionally, you can't browse in Network Neighborhood if you can't browse in the Windows command environment via the net view \\servername command. The bottom line is to be conscious of the following access hierarchy:

Look at the Log Files

Samba writes its activity to its log files. The default location for its log files on a Samba server are contained in directory /var/log/samba. By viewing these logs you can look back in time to see what transpired during the error.

Additionally, most Samba software can be run at higher error levels such that more debugging information is written to the logs. This can greatly aid diagnosis. See the various man pages for methods of increasing error levels.

Use SWAT to Reduce Your smb.conf File

Comments are nice documentation, and so are parameters explicitly set to their default values. But too much of such "readability" makes for an incredibly unwieldy and therefore unreadable smb.conf. Sometimes it's nice to get rid of all the comments and the parameters set explicitly to their default values. SWAT does just that. Simply back up your existing smb.conf (this is a must), and then run SWAT as root, enter the global page, and click the Commit Changes button. All comments and explicitly specified defaults disappear, leaving just the system's distinctive features.

Making a Sure-Fire Browser smb.conf

Sometimes you just can't see the Samba server from your Windows 9x machines. This is especially prevalent when there is no WINS server, domain master, or PDC on the network. If there are no NT or Windows 2000 servers (or clients acting as WINS servers or PDCs), you can guarantee the Samba box becomes a WINS server and browse master by including the following:

os level=65
preferred master=yes
domain master=yes

Also, make sure to set the netbios name= parameter to the hostname of the Samba server, and to set the workgroup= parameter to the workgroup of the client computers.

Keep a Cool Head

Troubleshooting is easy with the right attitude. Simply hunt down the root cause with a "just the facts" attitude. You can see a detailed description of troubleshooting and troubleshooting processes at http://www.troubleshooters.com/tuni.htm.

Share ThisShare This

Informit Network