Hardware manual
Boot-time Configuration
While setserial may run via an initialization script, something akin to setserial also runs earlier
when the serial module is loaded (or when the kernel starts the built-in serial driver if it was compiled into the
kernel). Thus when you watch the start-up messages on the screen it may look like it ran twice, and in fact it
has.
If the first message is for a legacy port, the IRQs shown may be wrong since it didn't probe for IRQs. If there
is a second report of serial ports, it may the result of a script such as /etc/init.d/setserial. It usually does no
probing and thus could be wrong about how the hardware is actually set. It only shows configuration data that
got saved in a configuration files. The old method, prior to setserial 2.15, was to manually write such data
directly into the script.
When the kernel loads the serial module (or if the "module equivalent" is built into the kernel) then all
supported PnP ports are detected. For legacy (non-PnP) ports, only ttyS{0-3} are auto-detected and the
driver is set to use only IRQs 4 and 3 (regardless of what IRQs are actually set in the hardware). No probing is
done for IRQs but it's possible to do this manually. You see this as a boot-time message just as if
setserial had been run.
To correct possible errors in IRQs (or for other reasons) there may be a script file somewhere that runs
setserial. Unfortunately, if this file has some IRQs wrong, the kernel will still have incorrect info about
the IRQs. This file is usually part of the initialization done at boot-time. Whether it runs or not depends on
how you (and/or your distribution) have set things up. It may also depends on the runlevel.
Before modifying a configuration file, you can test out a "proposed" setserial command by just typing it
on the command line. In some cases the results of this use of setserial will automatically get saved
somewhere such as /etc/serial.conf (or autoserial.conf or serial) when you shutdown. So if it worked OK (and
solved your problem) then there's no need to modify any configuration file. See Configuration method using
/etc/serial.conf, etc..
Edit a script (required prior to version 2.15)
This is how it was done prior to setserial 2.15 (1999) The objective was to modify (or create) a script file
in the /etc tree that runs setserial at boot-time. Most distributions provided such a file (but it may not have
initially resided in the /etc tree).
So prior to version 2.15 (1999) it was simpler. All you did was edit a script. There was no /etc/serial.conf file
(or the like) to configure setserial. Thus you needed to find the file that runs "setserial" at boot time and edit it.
If it didn't exist, you needed to create one (or place the commands in a file that ran early at boot-time). If such
a file was currently being used it's likely was somewhere in the /etc directory-tree. But Redhat <6.0 has
supplied it in /usr/doc/setserial/ but you need to move it to the /etc tree before using it.
The script /etc/rc.d/rc.serial was commonly used in the past. The Debian distribution used
/etc/rc.boot/0setserial. Another file once used was /etc/rc.d/rc.local but it's may not
have run early enough. It was reported that other processes may try to open the serial port before rc.local ran
resulting in serial communication failure. Later on it most likely was found in /etc/init.d/ but wasn't normally
intended to be edited.
If such a file was supplied, it likely contained a number of commented-out examples. By uncommenting some
of these and/or modifying them, you could set things up correctly. It was important use a valid path for
Serial HOWTO
Boot-time Configuration 45