I have been playing around with some "new" stuff on my laptop. I am running kernel 2.6.2-rc2-mm3 and I have disabled devfs. udev is running in its place. hotplug is also running. ALSA is compiled into the kernel as modules and I am running version -1.0.1 of userspace alsa-utils alsa-tools alsa-lib etc. hotplug and alsasound are both in the boot runlevel. After upgrading to this new configuration, I get the following error on bootup, when loading the alsasound script: * Loading ALSA drivers... * Using ALSA OSS emulation * Loading: snd-mixer-oss * Loading: snd-pcm-oss * Loading: snd-seq-oss * Loading: snd_maestro3 FATAL: Module snd_maestro3 already in kernel. * Loading: snd-seq-oss FATAL: Module snd_seq_oss already in kernel. * Running card-dependent scripts * Restoring Mixer Levels /usr/sbin/alsactl: set_controls:986: snd_ctl_open error: No such file or directory [ ok ] after that stage, the sound channels are muted, but if I run alsamixer and unmute them it is fine. I have investigated the problem and I dont know if its the right way to fix it, but sleeping for 2 seconds before restoring mixer levels does the trick. I will post a diff. Reproducible: Always Steps to Reproduce: 1.boot up, or use /etc/init.d/alsasound restart Actual Results: * Restoring Mixer Levels /usr/sbin/alsactl: set_controls:986: snd_ctl_open error: No such file or directory [ ok ] (then no sound output from any software) dsdlaptop root # emerge info Portage 2.0.49-r20 (default-x86-1.4, gcc-3.3.2, glibc-2.3.2-r1, 2.6.2-rc1) ================================================================= System uname: 2.6.2-rc1 i686 Celeron (Coppermine) Gentoo Base System version 1.4.3.12 distcc 2.11.1 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled] ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-march=pentium3 -O2 -pipe -fomit-frame-pointer -mmmx -msse -w" 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 /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" CXXFLAGS="-O2 -mcpu=i686 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache sandbox" GENTOO_MIRRORS="http://192.168.0.1/gentoo http://gentoo.oregonstate.edu http://www.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="-j4" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://192.168.0.1/gentoo-portage" USE="alsa apm arts avi berkdb crypt cups encode foomaticdb gdbm ggi gif gpm gtk2 imlib java jpeg libg++ libwww mad mikmod mmx motif mpeg mysql ncurses nls oggvorbis opengl oss pam pdflib perl png prelink python qt quicktime readline sdl slang spell sse ssl svga tcpd tetex truetype x86 xml2 xmms xv zlib"
Created attachment 24382 [details, diff] Proposed fix, if is the right way of doing it Solves the problem I describe.
glad to see that udev is working at least somewhat. The sleep seems like a sane idea, maybe just before the loop instead of within the loop.
Hmm. I have upgraded to the same setup on my main PC and I do not get this problem (no need for my fix). Have you had any other feedback along these lines?
I have the part of the this problem with 2.6.1-r1 (after upgrading from 2.4.x). However my mixer works most of the cases. I still get the messages about modules being already loaded in the kernel and occasionally the entire kernel blocks on loading snd_ali5451 for a long time (and sometimes ultimately hangs). However mixer loads properly 90% of cases. Only sometimes I have to unmute. In my case devfs is used (no udev), so this seems unrelated. Also I am not using maestro, so this is unrelated either.
Andrzej, do you have the 'alsasound' init script in your boot runlevel? 'rc-update add alsasound boot'? Do you have the latest version of it (from /usr/portage/media-sound/alsa-utils/files/alsasound)? If not, can you try updating to that one (you don't need to do a complete re-emerge of alsa-utils, just grab that script...
Jeremy, I just grabbed the script as you said and it seems to work. I mean: no error messages at startup of alsa. The script I have right now is CVS revision 1.9 dated 2004/02/12 12:20:01). No system lockup and no mixer anomalies. As for system lock ups at loading I need to use the fix for several days/weeks before I say anything meaningful. (PS. My alsasound is in the boot runlevel)
Ok, I'm going to set this fixed... if either problem crops up again, please reopen.
I have this error using the 1.11 2004/02/21 version of alsasound on 2 machines.
Chris, what error? Please give the exact text and info on your alsa-* versions...
/usr/sbin/alsactl: set_controls:986: snd_ctl_open error: No such file or directory [ebuild R ] media-libs/alsa-lib-1.0.3 -jack 0 kB [ebuild R ] media-libs/alsa-oss-1.0.3a 0 kB [ebuild R ] media-sound/alsa-utils-1.0.3 0 kB I am using kernel ALSA drivers. # emerge info Portage 2.0.50-r1 (default-x86-1.4, gcc-3.3.3, glibc-2.3.3_pre20040207-r0, 2.6.3-gentoo-r2) ================================================================= System uname: 2.6.3-gentoo-r2 i686 AMD Opteron(tm) Processor 242 Gentoo Base System version 1.4.3.13p1 distcc 2.13 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled] ccache version 2.3 [enabled] Autoconf: sys-devel/autoconf-2.59-r3 Automake: sys-devel/automake-1.8.2 ACCEPT_KEYWORDS="x86 ~x86" AUTOCLEAN="yes" CFLAGS="-march=athlon-mp -O2 -pipe -fomit-frame-pointer -fprefetch-loop-arrays -foptimize-register-move -frename-registers -mfpmath=sse,387" 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/terminfo /etc/env.d" CXXFLAGS="-march=athlon-mp -O2 -pipe -fomit-frame-pointer -fprefetch-loop-arrays -foptimize-register-move -frename-registers -mfpmath=sse,387" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache cvs digest distcc notitles sandbox" GENTOO_MIRRORS="ftp://ftp.gtlib.cc.gatech.edu/pub/gentoo http://www.gtlib.cc.gatech.edu/pub/gentoo http://gentoo.mirrors.pair.com/ ftp://gentoo.mirrors.pair.com/ ftp://ftp.ussg.iu.edu/pub/linux/gentoo" MAKEOPTS="-j4" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.us.gentoo.org/gentoo-portage" USE="3dnow X acpi alsa avi cdr crypt dvd dvdr encode esd gif gnome gphoto2 gtk gtk2 ipv6 java jpeg ldap mmx mpeg oggvorbis opengl pam pdflib perl pic png quicktime readline sdl spell sse ssl tiff truetype x86 xml xml2 xmms xv zlib" Both machines are running the same kernel and alsa-* versions.
In what context does that message appear? I need to know what's arround it so i can begin to find out where the problem is... Also, what version of alsa-drivers are you using in the kernel (look in /usr/src/linux/include/linux/version.h I believe... if not it's close to that) what happens when you match your alsa-lib version to the -driver version?
Well, it does it during boot... * Restoring Mixer Levels /usr/sbin/alsactl: set_controls:986: snd_ctl_open error: No such file or directory [ ok ] Just like it did for Daniel. This occurred with both 1.0.2 and 1.0.3... my -drivers in kernel are 1.0.2. Matching the versions makes no difference.
Chris, did it EVER work? Like with 2.4.x? Other versions of -driver? Or are you having this problem from the start? What sound card do you have? Did you setup /etc/modules.d/alsa (please attatch) and un modules-update? Are your drivers compiled as modules or into the kernel? (please attatch .config) --Jeremy
This is from the start on both machines. I never tried a kernel before 2.6.3, so no other versions of -driver. I am using an on-board Intel from a laptop on one, and the on-board from a K8T800 chipset on the other. Both use the snd_intel8x0 driver. My drivers are all modules.
Created attachment 27212 [details] Kernel Config
Created attachment 27214 [details] /etc/modules.d/alsa
in modules.d/alsa... should that be 'snd-intel8x0'? I thought it was named something else... but i might be brain farting... I have a i8x0 sound card in my laptop, but I'm running out the door now...
Actually... it is supposed to be snd_intel8x0. I will let you know if this solves the problem on next reboot, which on my laptop shouldn't be too far away... ;]
Still the same problem on my amd64 box... I haven't had the chance to reboot my x86 box, but I'm betting it'll be the same... btw... amd64 box was already using correct driver name
could you try out a 2.6.2 kernel? There was a huge version jump in alsa between 2.6.2 and 2.6.3... Are your sound modules ever loaded? Does adding in the 'sleep 2' (from the earlier attatchment) correct your problem?
I'll test the sleep 2 first and let you know.
I have been experiencing the same error as Chris Gianelloni with pretty much the same config. 2.6.4-ck1, udev-021, no devfs, alsa-utils-1.0.3,alsa-lib-1.0.3b-r1. I tried the "sleep" fix in /etc/init.d/alsasound before the loop instead of within the loop as Nick suggested in additional commment #2, and as found in the gentoo user forum: http://forums.gentoo.org/viewtopic.php?t=149562. sleep 2 still gave the error, but sleep 3 works.
I'll test on my 2 platforms and report in later tonight... =]
I had to set my sleep to 5 for it to work without an error.
Chris, are you running udev or devfs? What about hotplug? Travis, I'm assuming you are using hotplug as you are running udev. Do/did you have the problem with devfs? I'm thinking this is possibly a hotplug race of some sort
I'm using udev and hotplug. I've not used devfs and alsa together with 2.6.x, so I can't comment on that.
how could it be a hotplug race? alsasound should be in your boot runlevel... additionally it will always run before hotplug as it is 'before modules' and hotplug has 'need modules'... or does this need to be altered for udev to work?
There's no alteration needed for udev... and yes, alsasound is in boot runlevel.
I am using udev (was udev-021, now udev-021-r1) and hotplug-20040311. alsasound is in boot runlevel. I only used devfs with 2.4 kernels and oss drivers. This is my first foray into ALSA. So far, sound is working with this sleep hack, even on apm suspend/resume (occasionally, I find that sound is konked out on resume, but just calling up alsamixer, playing with the PCM level and exiting cures it). I am liking kernel 2.6 -- even my orinoco card survives suspend/resume.
Travis, now that I've got the out-of-kernel drivers working with 2.6, could you try out media-sound/alsa-driver-1.0.3 instead of the in-kernel modules to see if the problem is fixed in the alsa tree... otherwise we should probably forward this bug upstream to them...
I tried alsa-driver-1.0.3 with no alsa stuff in the kernel, only sound support as a module. I removed the sleep hack from the alsasound init script too. The original "snd_ctl_open" error returned. I reinstated the "sleep 3" in alsasound, and the error was gone. On rebooting, all alsa modules are loaded correctly, the mixer levels are restored, but no sound. If I then call up alsamixer and play with _both_ the master and pcm levels, sound will work. If I go back to having the in-kernel alsa modules, at least sound will work on boot, and most often after resume from suspend-to-ram.
I might add that, like Chris, I am using the intel8x0 driver. The machine is a PIV Dell Inspiron 4150. On the gentoo user forums, it seems some people are having no alsa problems. Maybe it is the specific driver? Also, I just tried a _pure_ udev (now udev-023-r1) system --> no device tarball. No difference. The only thing that seems to work is some brief delay before the mixer settings are restored at boot.
Ok, well this is definitely a udev problem, so I'm reassigning...
If its any use, the problem as detailed in original post still applies, with newer versions: udev 023 alsa-{lib,util,tools,oss} 1.0.3 Linux 2.6.5-rc3-mm1 The only difference is that I now need to sleep for 3 seconds minimum.
No, it's NOT a udev issue. Yes, this problem shows up when running udev, but it would also show up running devfs on a SMP machine. It's a alsa userspace issue. And if you still think it is a udev issue, how would you propose udev solve it? The patch in this bug shows one way of solving the problem. The correct way would be to sit and spin waiting for the /dev node to show up before continuing on.
greg, it doesn't exhibit itself on anything except udev...
I am using a pure udev system. I had to set the sleep to 5 in the /etc/init.d/alsasound to stop this error. I have ck-sources-2.6.4-r1, alsa-lib-1.0.3b-r2, udev-023-r1, hotplug-20040329.
With devfs and no alsa modules loaded, I can do: modprobe snd && alsactl restore 0 modprobe shouldn't return until the module is loaded, right? So this looks more and more like a udev problem as the above causes an error by allowing alsactl to execue before the module is fully loaded.
I added the sleep in the init script, so I'll set this fixed, but I still think it's a udev bug.
How long of a sleep? I need "sleep 5" on my amd64.
up to 8 I believe... in incrememnts of 2... if it's too short, let me know, and I'll add in another couple... hopefully the [ -e ___ ] line is right. That /dev file gets created by the snd.o module on my system, and that seems to be the problem, so please test it out (no need to re-emerge... just grab it from portage/media-sound/alsa-utils/files/alsasound)
I have been following the udev thread on the gentoo forums: http://forums.gentoo.org/viewtopic.php?p=1002669#1002669 I have gone now to using the /sbin/udevstart command in place of the sleep N in /etc/init.d/alsasound. It brings down the delay from N seconds to less than half a second, and all mixer settings get restored perfectly on boot. Maybe this is a better way to approach the problem for udev users?
I am still having problems with this... I had stopped it at one time with sleep commands, but now even that isn't working?! Now I have no sound at all!
do an lsmod and let me know if your drivers are there... if they are, try doing an 'alsacttl restore 0'... then check alsamixer...
"sleep hack" doesn't seem to work after upgrading to udev 024, I'll try putting "/sbin/udevstart" in alsasound as in comment http://bugs.gentoo.org/show_bug.cgi?id=39345#c42
I've added /sbin/udevstart sleep 1 before einfo "Restoring Mixer Levels" and everything works again with udev 024-r1.
Ok... how does /sbin/udevstart normally get called? Is there a /etc/init.d/udev?
I don't know that udevstart ever really gets called. If it did, it would be in one of the "boot" runlevel scripts, if not before. In fact, udev starts from the same script as devfs. The script detects which one to use at boot. My drivers are loaded. Forcing a reload after boot works, just as before.
I don't think udevstart gets called automatically. I have been trying new versions: udev-024-r1 and alsa-lib-1.0.4. I have neither sleep N or udevstart in /etc/init.d/alsasound. The new alsasound does have four of these lines in the alsactl restore loop: [ -e /dev/snd/controlC0 ] || sleep 2 . I have mixed results with this setup. The sleep 2's create a 5~6 second delay. The mixer levels are only restored correctly about 50% of the time. On a side note, something has borked my pcmcia. Most of the time cardmgr only sees one of the two sockets. I don't know if it is hotplug or udev.
*** Bug 47405 has been marked as a duplicate of this bug. ***
I have no problems with this using 2.6 with devfsd, and the "fix" is clearly udev related... I have no experience dealing with udev, so greg can you please look into getting this fixed.
I don't see how udev can work around this situation. Take a look at this post, it looks like a good solution: http://marc.theaimsgroup.com/?l=linux-hotplug-devel&m=108145716004177&w=2
If you want, I can add that file (from #52) into the udev release. Does that solve the problem for you?
that would probably fit best in alsa-utils, but I'm not sure how to set it up because I don't use udev. Could you make the neccessary changes to alsa-utils for the udev script? Also, why are the waits not working?
The upgrade to alsa-utils-1.0.4 and alsa-lib-1.0.4 was not the problem for me after all. It was the upgrade to hotplug-20040401 from 20040329. I was getting depcache and softlevel errors on boot like here: http://forums.gentoo.org/viewtopic.php?p=1037781 I downgraded back to hotplug-20040329 and everything works ok and alsa mixer levels get restored just fine. So waiting for the nodes to show up works for me. My pcmcia works ok now too. I have been able to reproduce the boot-time /var/lib/init.d/depcache errors by upgrading hotplug. Then alsa works no more.
I can add the udev dev.d alsa sound restore script to the udev package, but it really should be in the alsa package, as that's what needs it. Just install it in the location that the email message says to, it should solve the problem.
ok, I modularized the alsasound init script a little while ago, so it should work fine now... can someone with udev check this
no response from users for quite some time. Please reopen if this is still an issue.
I'm now getting this error on machines both with and without udev. FYI.
you could try a dynamic busy loop like this so that the script is dynamic to handle this stupid race condition: cnt=0 while [ ! -c /dev/snd/seq ] && [ ${cnt} -lt 20 ] ; then sleep 1 cnt=$((cnt + 1)) done