Q: Linux hangs during the boot process, usually when starting sendmail or smb/nmb daemons. If I wait long enough (5 minutes) the system will sometimes continue to boot. What is wrong and how can I fix it?

A: Sendmail and some other daemons try to do a DNS (Domain Name Service) lookup when they are started at boot time. If your system cannot do a DNS lookup (if, for example, you cannot reach your DNS server because of a networking configuration error), sendmail will hang for a long time (several minutes) before timing out. Some other daemons seem to continue to try the DNS lookup indefinitely.

You have at least 3 options for fixing this:

1. Configure your system so DNS works.

2. Turn off DNS.

3. Modify the startup scripts to start the offending daemons in background, so the boot process can proceed. (This is an error in the design of the boot scripts in Red Hat Linux.)

Choice 3 is probably the best long-term solution.

In order to make the changes, you have to boot your machine and edit the files involved. The easiest way to do this is boot using single-user mode. This skips the majority of the daemon startup process. Enter "linux single" At the lilo boot prompt:

boot: linux single

Choice 1 above probably requires you to edit /etc/resolv.conf and the networking configuration files (/etc/sysconfig/network and /etc/sysconfig/network-scripts/ifcfg-eth0). You`ll have to track down any errors in those files until you can reach your DNS server.

For choice 2, edit /etc/resolv.conf and comment-out all the lines in that file. This will disable all DNS lookups. Don't delete the resolv.conf file since some daemons need the file to exist, even if it is empty.

For choice 3, edit the files in /etc/rc.d/init.d to start all daemons in background. Look for all files that run the "daemon" script. For example, in /etc/rc.d/init.d/sendmail on Red Hat 4.2 we have:

daemon sendmail -bd -q1h ; echo ; touch /var/lock/subsys/sendmail

Change this line to:

(daemon sendmail -bd -q1h; echo ; touch /var/lock/subsys/sendmail) &

Repeat this change for all the scripts in init.d that start daemons. This will start the daemons in background allowing the boot process to continue even if the daemon hangs.