Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 110246

Summary: init-script "/etc/init.d/serial" runs to late (should be runned prior to "/etc/init.d/modules"...)
Product: Gentoo Linux Reporter: Daniel <deepee>
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: VERIFIED WORKSFORME    
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Daniel 2005-10-23 10:47:02 UTC
I'm using lirc (with driver serial)

"modprobe lirc_serial" (executed at bootup by
/etc/modules.autoload.d/kernel-2.6) fails because irq and io-port are already in
use.

Running "setserial /deb/ttyS2 uart none" to release the ttyS2 prior to modprobe
execution allows above modprobe to complete without any error.

echo "/dev/ttyS2 uart none" >> /etc/serial.conf
rc-update add serial default

Perhabs this is not a bug of "setserial" ebuild (but of course related!). It can
also be a bug of "/etc/init.d/modules", too.

Perhabs an earlier run of /etc/init.d/serial will caus problems too, in case the
kernel serial drivers are compiled as modules and thus are not loaded prior
/etc/init.d/serial (=> typical henn&egg problem!?)

Reproducible: Always
Steps to Reproduce:
1. execute /etc/init.d/modules (load lirc_dev and lirc_serial)
2. execute /etc/init.d/serial
3.

Actual Results:  
step 1 fails because lirc_serial can not be loaded. syslog-output:

Oct 23 18:28:30 [kernel] lirc_serial: port d800 already in use


Expected Results:  
1. execute /etc/init.d/serial prior to:
2. execute /etc/init.d/modules (load lirc_dev and lirc_serial)

Gentoo Base System version 1.6.13
Portage 2.0.51.22-r3 (default-linux/x86/2005.1, gcc-3.3.6, glibc-2.3.5-r2,
2.6.13-gentoo-r3 i686)
=================================================================
System uname: 2.6.13-gentoo-r3 i686 Pentium III (Coppermine)
dev-lang/python:     2.3.5-r2, 2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.20
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium3 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/lib/fax /usr/share/config /var/bind /var/qmail/control
/var/spool/fax/etc"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=pentium3 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="ftp://ftp.tu-clausthal.de/pub/linux/gentoo/
ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo
http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/
ftp://linux.rz.ruhr-uni-bochum.de/gentoo-mirror/
http://ftp.uni-erlangen.de/pub/mirrors/gentoo
ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo
ftp://ftp.join.uni-muenster.de/pub/linux/distributions/gentoo
ftp://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo
ftp://ftp.join.uni-muenster.de/pub/linux/distributions/gentoo
ftp://ftp6.uni-muenster.de/pub/linux/distributions/gentoo
http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/
http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/
ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage"
USE="x86 X a52 aac aalib acpi alsa apache2 apm arts audiofile avi
bash-completion bcmath berkdb bitmap-fonts bzlib cdb cdparanoia cdr cpdflib
crypt ctype cups curl curlwrappers directfb dvd dvdr eds emboss encode ethereal
exif fam fbcon flash foomaticdb fortran freetype ftp gd gif gpm gps gstreamer
gtk2 iconv icq ieee1394 imagemagick imlib ipv6 jabber java javascript jpeg kde
ldap libg++ libwww lirc lm_sensors mad mhash mikmod milter mime mng motif mp3
mpeg mysql ncurses nls offensive ogg oggvorbis opengl oss pam pcntl pcre pdflib
perl png posix python qt quicktime readline ruby sasl sdl sharedext slang slp
snmp sockets socks5 spell ssl svg svgalib symlink tcltk tcpd threads tidy tiff
truetype truetype-fonts type1-fonts udev unicode usb vorbis wmf xml xml2 xmlrpc
xmms xpm xsl xv zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, MAKEOPTS, PORTDIR_OVERLAY
Comment 1 SpanKY gentoo-dev 2005-10-23 16:50:37 UTC
setserial should maybe say it needs modules ... really though, you shouldnt be
putting setserial into the boot runlevel thus avoiding the whole issue ...
Comment 2 Daniel 2005-10-24 01:09:55 UTC
(In reply to comment #1)

It's exactly the opposit, I ment:
To resolve my problem /etc/init.d/serial has to be run *prior* 
to /etc/init.d/modules.

this init script order works:
1.) serial: set "uart none" for my ttyS2
2.) modules: modprobe lirc_serial irq=11 io=0x800

this init script order failes to load the lirc_serial module:
1.) modules: load lirc_serial (<<-- FAIL! syslog: /dev/ttyS2 is already in use)
2.) serial: set's the ttyS2-port to "uart none" correctly, but has no effect, 
because "module" has already been run (modprobe lirc_serial failed already!)

------8<----cut here----8<----
$ cat /etc/serial.conf
/dev/ttyS2 uart none
------8<----cut here----8<----

------8<----cut here----8<----
$ cat /etc/modules.autoload.d/kernel-2.6
#QuadPort-Ethernet:
sundance
#LVM2:
dm-mod
#Internal NT-mode ISDN HFC Card:
zaphfc modes=1
# lirc specific modules
lirc_dev
# following module cannot be loaded because serial port is occupied by
# kernel. Workaround: run setserial (via /etc/init.d/serial) prior!
# put "/dev/ttyS2 uart none" into "/etc/serial.conf"
lirc_serial irq=11 io=0xd800 debug=1
------8<----cut here----8<----

Here are my serial-ports (ttyS0/1 onboard and ttyS2/3 on a PCI-Card (irq11)):
------8<----cut here----8<----
$ dmesg | grep ttyS
Kernel command line: root=/dev/ram0 init=/linuxrc ramdisk=8192 
real_root=/dev/hda3 udev console=ttyS0 splash=verbose,theme:emergence 
video=vesafb:mtrr,ywrap,1024x768-32@85
ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
ttyS2 at I/O 0xd800 (irq = 11) is a 16550A
ttyS3 at I/O 0xd808 (irq = 11) is a 16550A
------8<----cut here----8<----


> setserial should maybe say it needs modules ...
No. Specifying "need serial" within modules (and additionally adding serial to 
runlevel boot) is in my opinion a possible solution - but I'm also aware that 
this will perhabs cause some other problems regarding serial kernel module 
loading (needed by setserial?!)

> really though, you shouldnt be
> putting setserial into the boot runlevel thus avoiding the whole issue ...
I do not had added /etc/init.d/serial to "boot" runlevel (while I filled the 
above bug). I also tried adding serial to "boot" after I filled the above 
bugzilla request, but this doesn't work either... ( I'm not really a gentoo-
init-script-dependency-expert ;-( )

As a workaround I added the "setserial /dev/ttyS2 uart none" command and 
the "modprobe lirc_serial..." command into lirc init-script. But I would be 
more happy to use the gentoo-mechanism by adding lirc_serial 
to /etc/modules.autoload.d/kernel-2.6 to load all modules.

Many thanks for your help!
Comment 3 SpanKY gentoo-dev 2005-10-24 06:37:28 UTC
in that case i dont think changing either script is appropriate

you should add this to a local file (say /etc/modules.d/serial):
pre-install lirc_serial /bin/setserial -b /dev/ttyS2 uart none

then remove the setserial init.d script: `rc-update del setserial`

just add lirc_serial to your modules autoload and next time you boot,
everything should fall into place
Comment 4 Daniel 2005-10-24 07:42:59 UTC
just in case someone will have the same problem some days and perhab's get 
directed to this entrie. Here are some more details:

(In reply to comment #3)
> you should add this to a local file (say /etc/modules.d/serial):
> pre-install lirc_serial /bin/setserial -b /dev/ttyS2 uart none
that's a great hint! Thx a lot! But only adding does not work. ;-) 
Run "modules-update" to rebuild the modprobe.conf!

> then remove the setserial init.d script: `rc-update del setserial`
just a typo: "rc-update del serial"

> just add lirc_serial to your modules autoload and next time you boot,
> everything should fall into place
in general yes, but it does not worked out of the box (for me) because I use 
some extra module options for lirc_serial, so I had to add an "options" 
statement into /etc/modules.d/serial
after running modules-update and a reboot everything worked as you prognosed!

content of my "/etc/modules.d/serial" file:
----8<------8<----
options lirc_serial irq=11 io=0xd800
pre-install lirc_serial /bin/setserial -b /dev/ttyS2 uart none
----8<------8<----

finally after running modules-update again, both entries were present 
in /etc/modprobe.conf!

Works like a charm! Thanks a lot!