You are not logged in.

#1 2012-08-16 20:03:35

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

systemd/alsa-restore doesn't work

That topic https://bbs.archlinux.org/viewtopic.php?id=146794 is marked as solved, so starting the new one.

I have the same situation: alsa-restore seems to be active but in reality it doesn't work. I have:

~ $ ls -als /usr/lib/systemd/system/basic.target.wants/alsa*
0 lrwxrwxrwx 1 root root 23 Apr 29 08:06 /usr/lib/systemd/system/basic.target.wants/alsa-restore.service -> ../alsa-restore.service
~ $ sudo systemctl | grep basic
basic.target              loaded active active        Basic System
~ $ cat /usr/lib/systemd/system/basic.target.wants/alsa-restore.service 
[Unit]
Description=Restore Sound Card State
DefaultDependencies=no
After=sysinit.target
Before=shutdown.target
Conflicts=shutdown.target

[Service]
Type=oneshot
ExecStart=-/usr/sbin/alsactl restore
StandardOutput=syslog
~ $ which alsactl
/usr/sbin/alsactl

I'm forced to restore sound cards' states manually via 'alsactl restore' (and it does work as expected).
Where to dig in?


"I exist" is the best myth I know..

Offline

#2 2012-08-16 20:14:23

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: systemd/alsa-restore doesn't work

Did alsactl output anything to the log? I had this happen to me a while back and found it to complain that sound cards couldn't be found. It happened that my sound drivers were loaded too slowly when allowing udev toautoload them, so I forced them to be loaded earlier in the boot by listing them in a file under /etc/modules-load.d/ . This fixed it for me.

Offline

#3 2012-08-16 20:58:15

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: systemd/alsa-restore doesn't work

ataraxia wrote:

Did alsactl output anything to the log? I had this happen to me a while back and found it to complain that sound cards couldn't be found. It happened that my sound drivers were loaded too slowly when allowing udev toautoload them, so I forced them to be loaded earlier in the boot by listing them in a file under /etc/modules-load.d/ . This fixed it for me.

I haven't found anything related in logs. And unfortunately the trick with /etc/modprobe.d/ didn't helped me. Probably the reason is there are three sound cards smile


"I exist" is the best myth I know..

Offline

#4 2012-08-17 05:26:16

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: systemd/alsa-restore doesn't work


"I exist" is the best myth I know..

Offline

#5 2012-08-17 08:50:04

domac
Member
Registered: 2012-08-06
Posts: 102

Re: systemd/alsa-restore doesn't work

There are three sound cards? Nevermind… big_smile
Have you tried to remove the symlinks and recreate them by hand?
Maybe your store service doesn't function right. Just try to recreate both symlinks and provide feedback please.


domac [ git ]

Offline

#6 2012-08-17 09:26:39

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: systemd/alsa-restore doesn't work

domac wrote:

There are three sound cards? Nevermind… big_smile

Yes!! smile
- mic built in a video camera - skype
- mother board's intel hda - youtube, skype, ..
- RME/hdsp - digital source for very-very hi end real music listening via big and hot external audio chain smile

domac wrote:

Have you tried to remove the symlinks and recreate them by hand?
Maybe your store service doesn't function right. Just try to recreate both symlinks and provide feedback please.

I don't understand why my symlinks are better smile. but have tried with the same result.

I guess ataraxia has a good suggestion wrt race conditions, and alsa-restore.service needs some After. But I don't understand systemd sufficiently to dig in further.

And, btw, I'm interested in restoring only (storing manually - and it does work).

Last edited by student975 (2012-08-17 09:29:46)


"I exist" is the best myth I know..

Offline

#7 2012-09-05 20:52:29

jnever1
Member
Registered: 2012-07-25
Posts: 3

Re: systemd/alsa-restore doesn't work

If you are using PulseAudio at any point, edit (as root) /etc/pulse/default.pa:

find the following:

### Automatically restore the volume of streams and devices
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore

comment out the first module like so:

### Automatically restore the volume of streams and devices
#load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore

remove all that /usr/sbin/alsactl -f /var/lib/alsa/asound.state nonsense from /etc/rc.local
leave the alsa DAEMON in place (/etc/rc.conf)
reboot.

Note: If you put two and two together, you may notice that alsa is restored (via alsactl) at the terminal level. This can be proven by invoking /usr/bin/aplay /path/to/some/audio/file.wav in /etc/rc.local. PulseAudio resets at the DE level. This PulseAudio, DE level reset screws with alsa levels for whatever reason and is unnecessary.

Offline

#8 2012-09-05 21:18:54

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: systemd/alsa-restore doesn't work

jnever1,

The problem isn't related to pulseaudio absolutely: it happens much much earlier.

//--------

Further problem discussion is here: http://lists.freedesktop.org/archives/s … 06406.html


"I exist" is the best myth I know..

Offline

#9 2012-09-05 23:45:04

jnever1
Member
Registered: 2012-07-25
Posts: 3

Re: systemd/alsa-restore doesn't work

Forgot to mention disabling UDEV detection and forcing alsa sink driver. I also disabled bluetooth module for lack of bluetooth devices. If this doesn't work for you, at least you will have fewer ghosts to chase. Good luck.

For my sys running in VBox this solves the 'mute-on-boot' problem

/etc/pulse/default.pa

### Load audio drivers statically
### (it's probably better to not load these drivers manually, but instead
### use module-udev-detect -- see below -- for doing this automatically)
load-module module-alsa-sink
#load-module module-alsa-source device=hw:1,0
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
#load-module module-null-sink
#load-module module-pipe-sink

### Automatically load driver modules depending on the hardware available
#.ifexists module-udev-detect.so
#load-module module-udev-detect
#.else
### Use the static hardware detection module (for systems that lack udev/hal support)
#load-module module-detect
#.endif

Other items of interest:

/etc/conf.d/alsa

# Arguments for alsactl
# example: ALSA_ARGS="--file /var/lib/alsa/asound.state"
ALSA_ARGS="--file /var/lib/alsa/asound.state"

# Enables powersaving mode for AC97 and hda_intel audio chips.
# Set to 1 to enable powersaving.
# Set to 0 to disable powersaving (default).
POWERSAVE=0

# Whether to save volume levels when stopped ("yes" or "no").
SAVE_VOLUME="yes"

# Whether to mute the master volume when stopped ("yes" or "no").
# Useful for bad audio cards which make a noise on system poweroff.
MUTE_VOLUME="no"

/etc/asound.conf

# Use PulseAudio by default
pcm.pulse {
    type pulse
}

ctl.pulse {
    type pulse
}

ctl.!default {
    type pulse
}

# vim:set ft=alsaconf:

/etc/rc.local

#!/bin/bash
#
# /etc/rc.local: Local multi-user start-up script.
#
#sleep 1
#/usr/sbin/alsactl -f /var/lib/alsa/asound.state restore
mount -t vboxsf LinuxSf /home/$USER/Win7
/usr/bin/aplay /boot/boot.wav &

Offline

Board footer

Powered by FluxBB