Bugzilla – Bug 150311
powersave does not restart sound daemon
Last modified: 2007-06-11 19:59:35 UTC
After a suspend to disk, no sound is available (ThinkPad A30). I tried to work around this by adding SUSPEND2DISK_RESTART_SERVICES="alsasound" SUSPEND2RAM_RESTART_SERVICES="alsasound" STANDBY_RESTART_SERVICES="alsasound" in /etc/sysconfig/powersave/sleep. According to the description it should restart alsa. Anyway, after a suspend always a manual 'rcalsasound restart' is required. Noticed this with powersave 0.10.21-0.1 as well as with 0.11.10
best you add a: touch /tmp/alsastarted into /etc/init.d/alsasound short after the start: switch To verify whether it is really not restarted or just does not work because it needs to be restartet later... After resume check with ls -al /tmp/alsastarted whether the date of the file corresponds with your resume...
please provide /var/log/suspend2disk.log and /var/lib/suspend2disk-state.resume before fuzzing around with the alsa start script.
Created attachment 68430 [details] suspend2disk-state.resume
Created attachment 68432 [details] suspend2disk.log looks like alsasound is started again, but as you assumed earlier, maybe too early. Pls let me know if you think whether the change of the alsasound script is required
Anyway, changed the startscript of alsasound (/usr/bin/touch), and the new file shows up at time of wake-up. But still no sound. So you might be right that this is too early.
Ok, but I doubt that we can do much about it. Seife, any idea? Axel, maybe you can try with a beta version of SUSE Linux OSS 10.1 and tell us if it still does not work?
Can't promise this: The HD is quite full, I have to see how I can free up 3G for a test
Axel, I'm closing this bug as WORKSFORME for now, please reopen if you get a SUSE 10.1 Beta8 or newer installed.
Gents, After installing 10.1 I have the same problem. Following the above instructions, it shows 18:12 tp-a30:/home/axel # ls -al /tmp/alsastar* -rw-r--r-- 1 root root 0 2006-07-19 18:14 /tmp/alsastarted 18:15 tp-a30:/home/axel # ps ax |grep alsa 9100 pts/1 R+ 0:00 /bin/grep --color=auto alsa 18:15 tp-a30:/home/axel # rcalsasound restart Starting sound driver: intel8x0 done 18:19 tp-a30:/home/axel # - the file is created, but alsasound is not restarted I'll attach the logs as well
Created attachment 94005 [details] /var/log/suspend2disk.log
Created attachment 94006 [details] suspend2disk-state.resume
Ok, Takashi, i think this is a bug in /etc/init.d/alsasound start. We start it this way: if [ "$SERVICES_TO_RESTART" -a -s "${STATE}.resume" ]; then for X in `tac ${STATE}.resume | awk '/^stopped:/ { if (($2!="hotplug")&&($2!="boot.hotplug")) print $2 }'`; do echo "starting $X:" >> $LSMOD_LOG /etc/init.d/$X start 2>&1 | awk '{print "## "$0}' >> $LSMOD_LOG DEBUG "Service $X started again" DIAG done fi but in the logfile is nothing from "/etc/init.d/alsasound start". It works fine during suspend: |Stopping services: ('alsasound' configured) |stopping alsasound: |## Shutting down sound driver..done but not during resume: |Restarting services: |starting alsasound: | |Remounting filesystems: Maybe there is something going wrong if alsasound start has no controlling terminal? Axel, can you try to change the line 508 in /usr/lib/powersave/scripts/sleep_helper_functions (might be some lines off, maybe i already messed around with the script here :-) from: /etc/init.d/$X start 2>&1 | awk '{print "## "$0}' >> $LSMOD_LOG to: /etc/init.d/$X start </dev/null 2>&1 | awk '{print "## "$0}' >> $LSMOD_LOG which will provide stdin from /dev/null instead of having it probably closed by the daemon. If this does not help, you might even try /etc/init.d/$X start </dev/null >/dev/null 2>&1 This will remove the output from the logfile, but if this works, it might give us some hints on where the error is.
This is because alsasound init script checks $PREVLEVEL for fast boots. If $PREVLEVEL=N, it skips the manual loading of modules because they must be already loaded beforehand. The problem is that powersave daemon keeps this environment variable (and probably $RUNLEVEL, too), and it confuses the restart condition.
ok, so we probably have to fix this in the powersaved start script (there is some option to startproc to unset almost all environment variables that should be used)
Stefan, I changed the line (508 was a good guess), but couldnt see a difference. Reading on, it seems that the change is not really required. Anything I could do for the moment? Ax
Well, the fix is probably to add "unset RUNLEVEL PREVLEVEL" in /etc/init.d/powersaved, before line 263 (the line with "startproc -e $powersaved_BIN ..."). restart powersaved and try again, it should work after that.
Sorry for the late reply, the machine was in repair. I had to set up a new 10.1, change the line as recommended in comment 16, but it did not help. Still no sound.
Check the logfile (/var/log/suspend2disk.log) if there is something from the alsasound init script after resume (check comment #12)
Nothing so far: [...] prepare_sleep finished for suspend2disk ------------------------------------------------------------------------------ preparing boot-loader: selecting entry 0, kernel /boot/2.6.16.21-0.25-default running '/usr/sbin/grubonce 0' time needed for sync: 5.3 seconds, time needed for grub: 0.6 seconds. calculated image_size: 500 ========we are back from suspend, cleaning up.======== == restore_after_sleep: restart and reload everything == Resuming: --------- Reloading modules: uhci_hcd Restarting services: Remounting filesystems: mounted '/dev/hda1' to '/windows/c', options '-o rw,noexec,nosuid,nodev,gid=100,umask=0002,utf8=true' mounted '/dev/hda5' to '/windows/d', options '-o rw,noexec,nosuid,nodev,gid=100,umask=0002,utf8=true' ======================================= restore_after_suspend_to_disk: finished
ok, this looks like it has not even been stopped, so it won't be started either of course. Up in the logfile, is there something like "stopping alsasound"? also the contents of /var/lib/suspend2disk-state.resume would be interesting. Sorry that this is a bit tedious to debug :-)
Sorry, attached the wrong log, but that does not change the results. I will attach the new logs
Created attachment 100955 [details] /var/log/suspend2disk.log
Created attachment 100958 [details] /var/lib/suspend2disk-state.resume
although it claims to have started the driver, it obviously isn't: a30:/home/axel # aplay /opt/kde3/share/sounds/k3b_error1.wav ALSA lib confmisc.c:672:(snd_func_card_driver) cannot find card '0' ALSA lib conf.c:3492:(_snd_config_evaluate) function snd_func_card_driver returned error: Kein passendes Gerät gefunden ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:3492:(_snd_config_evaluate) function snd_func_concat returned error: Kein passendes Gerät gefunden ALSA lib confmisc.c:1072:(snd_func_refer) error evaluating name ALSA lib conf.c:3492:(_snd_config_evaluate) function snd_func_refer returned error: Kein passendes Gerät gefunden ALSA lib conf.c:3961:(snd_config_expand) Evaluate error: Kein passendes Gerät gefunden ALSA lib pcm.c:2111:(snd_pcm_open_noupdate) Unknown PCM default aplay: main:547: audio open error: Kein passendes Gerät gefunden a30:/home/axel # rcalsasound restart Starting sound driver: intel8x0 done
I encountered the same problem and solved it on my computer by a simple substitution in "/usr/lib/powersave/scripts/sleep_helper_functions". I substituted the lines echo "starting $X:" >> $LSMOD_LOG /etc/init.d/$X start 2>&1 | awk '{print "## "$0}' >> $LSMOD_LOG to echo "starting $X:" >> $LSMOD_LOG /etc/init.d/$X restart 2>&1 | awk '{print "## "$0}' >> $LSMOD_LOG ^^ (i.e. changed "start" to "restart").
Works for me as well. Thanks!
I am pretty sure this is working with the pm-utils infrastructure used in 10.2 onwards. Since this is the only bugreport i got for this issue, i'm setting this to "fixed in 10.3" (the two affected customers, have already implemented a workaround :-) Thanks for reporting and helping to debug this.
(In reply to comment #30) > I am pretty sure this is working with the pm-utils infrastructure used in 10.2 > onwards. you lost the bet ;-) 10.2 has the same problem. > Since this is the only bugreport i got for this issue, i'm setting this to > "fixed in 10.3" (the two affected customers, have already implemented a > workaround :-) I intended to install 10.3 beta1 once it is out, I will follow up then. Cheers Axel
So in 10.2, with a hook for pm-utils that does . /etc/pm/functions case $1 in suspend|hibernate) stopservice alsasound ;; resume|thaw) restartservice alsasound ;; esac does not work? (see also http://en.opensuse.org/Pm-utils_10.2) This would be bad and warrant a (separate, since it is a different package) bugreport against pm-utils.
stopservice and startservice seem not to be known commands, but case $1 in suspend|hibernate) /etc/init.d/alsasound stop ;; resume|thaw) /etc/init.d/alsasound start ;; esac does a pretty good job as well. Thanks Axel