IV.3 Trouble under Linux
The most popular problems under Linux are permission conflicts and wrong
(or no) configuration. Problems may even change with the version number
of the Linux kernel!
Note that some changes suggested here will lower your systems security
against attackers who have login access to your machine. Direct access
to hardware ports and security do not mix well.
On some distributions changes in the /dev directory might be detected
by periodically run jobs and automatically reverted to the old state.
- The boot script aborts with the error message
./upload: /dev/ttyS1: Permission denied
(or something like that).
You don't have read/write access to the serial port in use (ttyS1).
If you are the only user of this computer, you can log in as root,
and simply allow read/write operations for all users:
chmod a+rw /dev/ttyS1
If there are more users who have access to the system, better define
a new group called “embedded” (or something) in /etc/group
and add all users who need access to this port. Finally do
chgrp embedded /dev/ttyS1
chmod o-rw,ug+rw /dev/ttyS1
- The boot script hangs on any attempt to output an Intel-HEX file to
a particular serial port.
There may be an I/O address or interrupt conflict, or the serial ports
are not configured correctly, or not at all.
Make sure that every serial port uses a base I/O address and an IRQ
that does not conflict with any other hardware installed in your system.
(For example, port ttyS3 at 0x2e8 conflicts with an 8514 graphics card!)
Check the BIOS setup menu for on-board peripherals, as well as the jumper
settings of all the legacy (ISA) boards.
Watch the console output when Linux is booting.
There are messages like
ttyS00 at 0x03f8 (irq = 4) is a 16550A
A log file is usually kept in /var/log. The file name depends on the
Linux distribution and version. Look for boot.msg,
bootlog, or something.
Linux doesn't really auto-probe the serial ports. It assumes standard
port addresses and IRQ numbers. If your hardware doesn't match this
default configuration, it will not work. In this case you have to
configure your serial ports manually with the setserial command,
e.g.
setserial -v /dev/ttyS0 port 0x3f8 irq 4 autoconfig
setserial -v /dev/ttyS1 port 0x2f8 irq 3 autoconfig
setserial -v /dev/ttyS2 port 0x3e8 irq 9 autoconfig
setserial -v /dev/ttyS3 port 0x2e8 irq 10 autoconfig
Unfortunately the best place where to put these commands, in order to
execute them during system boot, depends on the Linux distribution.
For most Linux distributions, /etc/init.d/serial
is a good choice!
SuSE distributions kept it in /sbin/init.d/serial
until version 7.0.
For detailed information on serial port configuration refer to the
setserial man-pages and the Serial-HOWTO.
- The boot script aborts with an error message like
resetting target system ...
@@@@@ access denied: /dev/lp0 @@@@@
on a system with a 2.2.x (or later) kernel, or with
resetting target system ...
@@@@@ no root privilege @@@@@
on a system with a 2.0.x (or earlier) kernel.
The reset51 program needs root privileges for direct access
to I/O ports!
If you are the only user of this computer, you can log in as root,
and simply allow to run reset51 as root for all users:
chown root reset51
chmod a+x,u+s reset51
Once again a warning: don't do this, if your system should have a higher
level of security! If there are more users who have access to the system,
better define a special group “embedded” (or something) in
/etc/group and add all users who need to run
reset51. Then disable execution for all other users:
chown root reset51
chgrp embedded reset51
chmod o-x,ug+x,u+s reset51
This may considerably improve your system security.
- The boot script aborts with the error message
resetting target system ...
@@@@@ hardware failure: lp0 @@@@@
although there are two perfectly working printer ports in your PC.
The reason may be that you run a 2.0.x (or earlier) Linux
kernel, which assigns fixed I/O base addresses to the printer port devices:
there is no printer port with base address 0x3bc in your system!
Try /dev/lp1 (0x378) and /dev/lp2
(0x278) as reset devices, and change your boot script accordingly.
- The boot script aborts with the error message
resetting target system ...
@@@@@ port not found: /dev/lp2 @@@@@
on a PC with two printer ports and a 2.2.x (or later) kernel.
There is no entry for /dev/lp2 in
/proc/parport/2!
From version 2.2.0 the Linux kernel provides the parport
layer for dynamic printer port assignment, as known from the PC-BIOS.
If you have recently updated from a 2.0.x (or earlier)
kernel, your previous printer port /dev/lp2 may now
simply be called /dev/lp1 in a 2.2.x
(or later) system.
Try /dev/lp1 as reset device, and change your
boot script accordingly.
If this doesn't apply, make sure that
- the /proc file system is configured and mounted
- the kernel contains the kernel module loader kmod
- the kernel is configured for parport support
- the kernel modules lp, parport, and parport_pc are loaded
- all printer ports are configured in /etc/modules.conf, e.g.
options parport_pc io=0x378,0x278 irq=7,none
Configure and recompile your kernel respectively, if necessary.
For further information refer to the documentation files
parport.txt, modules.txt,
kmod.txt and README provided with recent
kernel sources, or ask a real Linux expert!
(See also chapter
III.4 Shell Script Operation under Linux.)
- The boot script aborts with the error message
resetting target system ...
./upload: /dev/ttyS4: Device or resource busy
The interrupt of the serial interface may already be used by another
driver (i.e. printer port, USB).
Try to find and solve the interrupt conflict. (See items 2 and 5.)