Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 38024 - ALSA rc-script (/etc/init.d/alsasound) loads some modules multiple times
Summary: ALSA rc-script (/etc/init.d/alsasound) loads some modules multiple times
Status: RESOLVED DUPLICATE of bug 32045
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo Sound Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-12 18:16 UTC by Emil Eifrem
Modified: 2005-07-17 13:06 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
An approach to fix the problem by grepping lsmod before invoking modprobe (alsasound-module-dependency.patch,1.77 KB, patch)
2004-01-12 18:24 UTC, Emil Eifrem
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Emil Eifrem 2004-01-12 18:16:41 UTC
The alsasound rc-script selects the modules it will attempt to load by examining the user's configuration (mainly via modprobe -c and -l). After gathering a list of modules, these modules are sequentially loaded.

Unfortunately for this approach, many of the ALSA modules depend on each other and therefore the kernel module loader's recursive loading policy may (and often does) result in a module that is loaded before the alsasound script has directly requested it. Once alsasound *does* ask the module to load, modprobe will exit with an error and a "FATAL: MODULE <somesoundmodule> already in kernel." message.

This is currently the case on my box. I use kernel 2.6.1 from gentoo-dev-sources, ALSA compiled as modules (obviously) and alsa-{lib,tools,utils}-1.0.1 from ~x86. I have a SB PCI 128 which uses the ens1371 driver.

Reproducible: Always
Steps to Reproduce:
1. Install alsa-lib version 1.0.1 and kernel 2.6 (possibly applicable to 0.9.8 and 2.4 as well) and a sound setup with multiple modules with many dependencies reported early in modprobe -c and modprobe -l. (I believe the last parameter to be non-deterministic, but I'm not sure. It's been very consistent for me, but I imagine it will vary greatly across installations.)
2. /etc/init.d/alsasound start


Actual Results:  
stderr:

   FATAL: Module snd_ens1371 already in kernel.
   FATAL: Module snd_seq_midi already in kernel.
   FATAL: Module snd_seq_oss already in kernel.

dmesg: same

Expected Results:  
Well, for my particular setup apparently some sound module that had a dependency
on snd_ens1371, snd_seq_midi and snd_seq_oss was loaded early in
/etc/init.d/alsasound. Everything still works, but the script should be able to
detect this and not attempt to load the same module multiple times.

(First paragraph says to create any info longer than a few lines as an
attachment, next paragraph tells me to paste an 'emerge info' here. I'll go with
the second one:)

emil@obiwan emil $ emerge info
Portage 2.0.49-r20 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r3,
2.6.1-d-minor-gentoo)
=================================================================
System uname: 2.6.1-d-minor-gentoo i686 Pentium III (Coppermine)
Gentoo Base System version 1.4.3.10
ccache version 2.3 [enabled]
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=pentium3 -fprefetch-loop-arrays -funroll-loops -pipe
-fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3/share/config /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-O3 -march=pentium3 -fprefetch-loop-arrays -funroll-loops -pipe
-fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs buildpkg ccache sandbox"
GENTOO_MIRRORS="http://gentoo.linux.no/ ftp://mirror.pudas.net/gentoo
http://mirror.pudas.net/gentoo ftp://ftp.uninett.no/pub/linux/Gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X aalib alsa apm avi berkdb crypt encode esd gdbm gif gnome gpm gtk gtk2
imlib java jpeg kde ldap libg++ libwww mad mikmod motif mozilla mpeg ncurses nls
oggvorbis opengl oss pam pda pdflib perl png python qt quicktime readline sdl
slang spell sse ssl svga tcltk tcpd truetype unicode x86 xml2 xmms xv zlib"
Comment 1 Emil Eifrem 2004-01-12 18:24:47 UTC
Created attachment 23712 [details, diff]
An approach to fix the problem by grepping lsmod before invoking modprobe

There are a few approaches one could have to this problem. One is to simply add
the -q switch to modprobe, effectively eliminating the error message. However,
I dislike this as it would hide ALL error messages, including legitimate ones.

I chose to instead make a small function that accepts a list of modules and
loads them all, but respecting dependencies. Ie, if snd-oss-mixer depends on
snd_ens1371 and snd-oss-mixer is loaded first, then this function will not load
the snd_ens1371 module as the kernel module loading system has already taken
care of that.

Don't know anything about the gentoo project's coding standards (and a brief
look around didn't turn up any obvious matches), but I tried to keep it along
the same philosophy as the rest of alsasound (ie I used ugly curly braces
placement :), awk instead of cut, C-like header for the function, etc).

It works for me, maybe it'll work for someone else as well.
Comment 2 Jeremy Huddleston (RETIRED) gentoo-dev 2004-02-06 21:16:02 UTC

*** This bug has been marked as a duplicate of 32045 ***