Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 245879 - udev hotplugging soundcards results in soundcards loaded in wrong order at boot (not respecting /etc/modules.d/alsa)
Summary: udev hotplugging soundcards results in soundcards loaded in wrong order at bo...
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: udev maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-06 18:51 UTC by Federico Ferri (RETIRED)
Modified: 2012-03-22 01:08 UTC (History)
3 users (show)

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


Attachments
/etc/modules.d/alsa (alsa,1.19 KB, text/plain)
2008-11-06 18:53 UTC, Federico Ferri (RETIRED)
Details
/etc/modprobe.d/alsa (alsa,1.19 KB, text/plain)
2009-05-18 05:34 UTC, Federico Ferri (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Federico Ferri (RETIRED) gentoo-dev 2008-11-06 18:51:40 UTC
I've set up the order of cards in /etc/modules.d/alsa, like described in http://www.gentoo.org/proj/en/desktop/sound/alsa.xml#doc_chap2_sect5

However, this order gets ignored on boot (or fail somewhat)

Gina24 should be the first cards, but here's what I get just after boot:

# cat /proc/asound/cards
 0 [Intel          ]: HDA-Intel - HDA Intel
                      HDA Intel at 0xf9ff8000 irq 22
 1 [Gina24         ]: Echo_Gina24 - Gina24
                      Gina24 rev.1 (DSP56361) at 0xfeb00000 irq 18
 2 [UM1            ]: USB-Audio - UM-1
                      EDIROL UM-1 at usb-0000:00:1a.1-1, full speed
 3 [VirMIDI        ]: VirMIDI - VirMIDI
                      Virtual MIDI Card 1

but after a restart of alsasound:

# /etc/init.d/alsasound restart
 * Caching service dependencies ...     [ ok ]
 * Storing ALSA Mixer Levels ...        [ ok ]
 * Killing processes using ALSA ...     [ ok ]
 * Unloading ALSA modules ...           [ ok ]
 * Loading ALSA modules ...
 *   Loading: snd-card-0 ...            [ ok ]
 *   Loading: snd-card-1 ...            [ ok ]
 *   Loading: snd-card-2 ...            [ ok ]
 *   Loading: snd-card-3 ...            [ ok ]
 *   Loading: snd-mixer-oss ...         [ ok ]
 *   Loading: snd-pcm-oss ...           [ ok ]
 *   Loading: snd-seq-oss ...           [ ok ]
 *   Loading: snd-seq-midi ...          [ ok ]
 * Restoring Mixer Levels ...           [ ok ]
# cat /proc/asound/cards
 0 [Gina24         ]: Echo_Gina24 - Gina24
                      Gina24 rev.1 (DSP56361) at 0xfeb00000 irq 18
 1 [Intel          ]: HDA-Intel - HDA Intel
                      HDA Intel at 0xf9ff8000 irq 22
 2 [UM1            ]: USB-Audio - UM-1
                      EDIROL UM-1 at usb-0000:00:1a.1-1, full speed
 3 [VirMIDI        ]: VirMIDI - VirMIDI
                      Virtual MIDI Card 1
# 

some other useful infos:

packages:
[I] sys-kernel/gentoo-sources (2.6.25-r7(2.6.25-r7)@10/22/08)
[I] sys-fs/udev (124-r1@10/23/08)
[I] sys-apps/hal (0.5.11-r1@10/23/08)
[I] media-libs/alsa-lib (1.0.16@10/23/08)
[I] media-sound/alsa-firmware (1.0.16@10/24/08)
[I] media-sound/alsa-headers (1.0.16@10/22/08)
[I] media-sound/alsa-tools (1.0.16(0.9)@10/24/08)
[I] media-sound/alsa-utils (1.0.16(0.9)@10/24/08)

# rc-update -s | grep -e '\(alsa\|hal\)'
           alsasound |      default                  
                hald |      default 
# rc-status 
Runlevel: default
 alsasound      [ started  ]
 hald           [ started  ]
[...]

my suspect is that something before alsasound loads the modules before, messing up the order, cause only a restart of alsasound would explicitly unload modules.

but I'm not so skilled to track it down.
Comment 1 Federico Ferri (RETIRED) gentoo-dev 2008-11-06 18:53:31 UTC
Created attachment 170929 [details]
/etc/modules.d/alsa

my /etc/modules.d/alsa contains the desired order of cards.
yes I've ran update-modules after changing that, so modprobe.conf is in sync with it.
Comment 2 Federico Ferri (RETIRED) gentoo-dev 2008-11-06 18:59:30 UTC
I forgot: I'm using drivers from kernel, compiled as modules, NOT the Gentoo alsa-driver package
Comment 3 Federico Ferri (RETIRED) gentoo-dev 2008-11-06 19:20:56 UTC
I added the following lines to /etc/modprobe.d/blacklist:

blacklist snd_seq_midi
blacklist snd_seq_oss
blacklist snd_pcm_oss
blacklist snd_mixer_oss
blacklist snd_virmidi
blacklist snd_seq_virmidi
blacklist snd_seq_midi_event
blacklist snd_seq
blacklist snd_usb_audio
blacklist snd_usb_lib
blacklist snd_rawmidi
blacklist snd_seq_device
blacklist snd_hda_intel
blacklist snd_hwdep
blacklist snd_gina24
blacklist snd_pcm
blacklist snd_timer
blacklist snd
blacklist snd_page_alloc


The soundcards order is now OK! (except that I have to remove snd_virmidi from that list, otherwise won't load anymore)

wouldn't be a good idea to blacklist soundcard drivers by default, as alsasound takes care of loading them after?
Comment 4 Federico Ferri (RETIRED) gentoo-dev 2008-11-09 14:36:52 UTC
ERR... it worked on first reboot, but after the second reboot I get no alsa drivers loaded by default.

so it's still an open issue, with blacklist not being a solution
Comment 5 Federico Ferri (RETIRED) gentoo-dev 2008-11-20 18:55:13 UTC
the problem is really udev

when at boot says: "Waiting for udev to process events" the soundcard driver is loaded (I hear the click of the soundcard being initialized).

this conflicts with the alsasound initscript coming later, which doesn't unloads alsa modules, so is unable to change the order of soundcards autodetected by udev.

if I blacklist soundcard drivers, udev doesn't load them anymore, but also alsasound initscript is unable to load them.

at this point I would find a way to allow to blacklist some devices by udev side, so that they can later be loaded by the alsasound initscript.
Comment 6 Matthias Schwarzott gentoo-dev 2008-11-27 08:17:34 UTC
(In reply to comment #5)
> the problem is really udev
> 
> when at boot says: "Waiting for udev to process events" the soundcard driver is
> loaded (I hear the click of the soundcard being initialized).
> 
> this conflicts with the alsasound initscript coming later, which doesn't
> unloads alsa modules, so is unable to change the order of soundcards
> autodetected by udev.

You could use the index parameter to the sound modules to assign a fixed order to them.

I have no idea how one can blacklist stuff for udev, but allow alsasound init-script to load them.
Comment 7 Federico Ferri (RETIRED) gentoo-dev 2008-11-28 13:25:05 UTC
I already use index parameter.
please have a look at the attachment
Comment 8 Ziga Boehm 2009-01-24 11:24:33 UTC
Your problem is most probably related to bug 251081, bug 223885 and indirectly also to bug 215626 - bottom line being that ALSA configuration file (alsa) should be moved from /etc/modprobe.d to /etc/modules.d directory.
Comment 9 Ziga Boehm 2009-01-24 11:28:38 UTC
Sorry for the reverse order: alsa should be moved from /etc/modules.d to /etc/modprobe.d - not the other way around.

I changed the sentence from "... ALSA configuration file (alsa)
should be put in /etc/modprobe.d not to /etc/modules.d directory..." and didn't realize soon enough that its meaning also changed... ;-)
Comment 10 Federico Ferri (RETIRED) gentoo-dev 2009-01-24 12:49:07 UTC
it is already in the right place as you say. (I'm not sure if I initially reported a wrong path, or some etc-update changed the path of alsa file - most probably the first)

$ ls /etc/modules.d
aliases  i386
$ ls /etc/modprobe.d 
alsa  blacklist  nvidia  pnp-aliases  ppp
Comment 11 Federico Ferri (RETIRED) gentoo-dev 2009-01-24 12:55:17 UTC
hmm... I removed '/etc/init.d/alsasound restart' from my /etc/conf.d/local.start (that was the temporary fix for getting the cards in right order!) and rebooted, and the cards are now in correct order.

in the meanwhile I updated to udev-135-r3 due to various issues.
I'll wait some time (reboots) before confirming that this issue is finally resolved.

thank you
Comment 12 Matthias Schwarzott gentoo-dev 2009-02-25 13:44:46 UTC
Is this issue still considered fixed?
Comment 13 Federico Ferri (RETIRED) gentoo-dev 2009-03-04 06:48:24 UTC
guess so... (sys-fs/udev-135-r3)
Comment 14 Federico Ferri (RETIRED) gentoo-dev 2009-05-17 20:06:46 UTC
reopening.
issue still present with udev-141

moreover, the options in /etc/conf.d/alsasound (KILLPROC_ON_STOP and UNLOAD_ON_STOP) are being deprecated, so a workaround is not going to be available in the future -- raising severity.

also (this for the alsa-bugs) when I run the alsasound init script, I see each card loaded twice. is it normal?

# /etc/init.d/alsasound restart
 * Storing ALSA Mixer Levels ...                                          [ ok ]
 * Loading ALSA modules ...
 *   Loading: snd-card-0 ...                                              [ ok ]
 *   Loading: snd-card-1 ...                                              [ ok ]
 *   Loading: snd-card-2 ...                                              [ ok ]
 *   Loading: snd-card-3 ...                                              [ ok ]
 *   Loading: snd-card-0 ...                                              [ ok ]
 *   Loading: snd-card-1 ...                                              [ ok ]
 *   Loading: snd-card-2 ...                                              [ ok ]
 *   Loading: snd-card-3 ...                                              [ ok ]
 *   Loading: snd-mixer-oss ...                                           [ ok ]
 *   Loading: snd-pcm-oss ...                                             [ ok ]
 *   Loading: snd-seq-oss ...                                             [ ok ]
 *   Loading: snd-seq-midi ...                                            [ ok ]
 * Restoring Mixer Levels ... 
Comment 15 Matthias Schwarzott gentoo-dev 2009-05-17 20:19:39 UTC
Please attach your /etc/modprobe.d/alsa file.
Comment 16 Federico Ferri (RETIRED) gentoo-dev 2009-05-18 05:34:37 UTC
Created attachment 191617 [details]
/etc/modprobe.d/alsa

it is not changed since initial report. however now I am giving it the correct name (modprobe.d/alsa)
Comment 17 Steve Dibb (RETIRED) gentoo-dev 2009-08-25 16:58:55 UTC
Federico,

Thanks for the detailed report.

One thing that may work for you if you want to try it is, compile one of the drivers in the kernel statically, and the 2nd one as a module.  That will force the in-kernel one to always load first.

Of course, that depends on whether or not you have to use them as modules.
Comment 18 Doktor Notor 2010-02-27 17:59:47 UTC
Well, /lib/udev/rules.d/60-persistent-alsa.rules should work for you; you need recent (optimally, latest :P) udev with USE=extras to get this one, iirc. Should basically do the same thing like udev does for NICs. 
Comment 19 William Hubbs gentoo-dev 2012-03-22 01:08:16 UTC
This bug has had no activity in 2 years.
Please re-open if it is still an issue.