You are not logged in.

#1 2017-08-17 10:38:51

vixi
Member
Registered: 2017-08-17
Posts: 3

alsa-restore.service won't load properly

Hello, i've the following problem and i can't find a way to fix it: until two days ago i had no problem with the sound but now the system doesn't store and restore the audio settings that i use (namely the audio volume).

After boot if i run systemctl status alsa-restore.service i get:

$ systemctl status alsa-restore.service
● alsa-restore.service - Save/Restore Sound Card State
   Loaded: loaded (/usr/lib/systemd/system/alsa-restore.service; static; vendor preset: disabled)
   Active: inactive (dead)
Condition: start condition failed at Thu 2017-08-17 12:10:31 CEST; 23min ago
           └─ ConditionPathExistsGlob=/dev/snd/control* was not met

What puzzle me is that if i run

$ sudo systemctl start alsa-restore.service

the service has no problem to start up. So far i've tried to:

- add my user to the audio grup

- set in the /usr/lib/systemd/system/alsa-restore.service

User=root Group=root

 

all without success.

Thank you very much for reading so far and for any help you might provvide.

Offline

#2 2017-08-17 11:07:49

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 7,604

Re: alsa-restore.service won't load properly

Reads like the alsa-restore service is ran before the sound cards are up and the relevant device nodes do not exist yet. However afaik the default service files should be accomodating for that? outputs of

systemctl status alsa-restore alsa-state
systemctl cat alsa-restore alsa-state

might give some insight. Are all your cards hooked up during boot? Do you have a USB sound card? Maybe there's some enumeration race.

FWIW your  fixes should be no-ops since the service already runs as root anyway and the restore happens (or well doesn't) long before your user is active.

Offline

#3 2017-08-17 11:15:48

vixi
Member
Registered: 2017-08-17
Posts: 3

Re: alsa-restore.service won't load properly

V1del wrote:

Reads like the alsa-restore service is ran before the sound cards are up and the relevant device nodes do not exist yet. However afaik the default service files should be accomodating for that? outputs of

systemctl status alsa-restore alsa-state
systemctl cat alsa-restore alsa-state

might give some insight. Are all your cards hooked up during boot? Do you have a USB sound card? Maybe there's some enumeration race.

FWIW your  fixes should be no-ops since the service already runs as root anyway and the restore happens (or well doesn't) long before your user is active.

Thank you very much for the reply! I've also tried to reinstall alsa-utils with no success (just to be sure). Here are the outputs that you have requested:

$ systemctl status alsa-restore alsa-state
● alsa-restore.service - Save/Restore Sound Card State
   Loaded: loaded (/usr/lib/systemd/system/alsa-restore.service; static; vendor preset: disabled)
   Active: inactive (dead)
Condition: start condition failed at Thu 2017-08-17 13:08:15 CEST; 2min 51s ago
           └─ ConditionPathExistsGlob=/dev/snd/control* was not met

● alsa-state.service - Manage Sound Card State (restore and store)
   Loaded: loaded (/usr/lib/systemd/system/alsa-state.service; static; vendor preset: disabled)
   Active: inactive (dead)
Condition: start condition failed at Thu 2017-08-17 13:08:15 CEST; 2min 51s ago
           └─ ConditionPathExists=/etc/alsa/state-daemon.conf was not met

--

$ systemctl cat alsa-restore alsa-state
# /usr/lib/systemd/system/alsa-restore.service
#
# Note that two different ALSA card state management schemes exist and they
# can be switched using a file exist check - /etc/alsa/state-daemon.conf .
#

[Unit]
Description=Save/Restore Sound Card State
ConditionPathExists=!/etc/alsa/state-daemon.conf
ConditionPathExistsGlob=/dev/snd/control*
After=alsa-state.service

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=-/usr/bin/alsactl restore
ExecStop=-/usr/bin/alsactl store

# /usr/lib/systemd/system/alsa-state.service
#
# Note that two different ALSA card state management schemes exist and they
# can be switched using a file exist check - /etc/alsa/state-daemon.conf .
#

[Unit]
Description=Manage Sound Card State (restore and store)
ConditionPathExists=/etc/alsa/state-daemon.conf
After=sysinit.target

[Service]
Type=simple
ExecStart=-/usr/bin/alsactl -s -n 19 -c rdaemon
ExecStop=-/usr/bin/alsactl -s kill save_and_quit

i'm using the integrated sound card of the laptop so it should be detected on boot i think....

Offline

#4 2017-08-17 11:57:36

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 7,604

Re: alsa-restore.service won't load properly

Strange, what happens if you add an

After=sound.target

Into the [Unit] section of alsa-restore.service? I thought this was already the case but it doesn't seem that way and I'm not sure of the exact rationale as to why not. (Also hint: Don't edit the /usr/lib/systemd/system file directly, it will get overwritten on the next update. See https://wiki.archlinux.org/index.php/Sy … ided_units for a few more robust options.

Also for the future, please wrap command outputs in [ code ] tags as opposed to [ quote ] tags, will make everything more readable, especially for bigger blocks like that cat output.

Offline

#5 2017-08-17 12:30:52

vixi
Member
Registered: 2017-08-17
Posts: 3

Re: alsa-restore.service won't load properly

V1del wrote:

Strange, what happens if you add an

After=sound.target

Into the [Unit] section of alsa-restore.service? I thought this was already the case but it doesn't seem that way and I'm not sure of the exact rationale as to why not. (Also hint: Don't edit the /usr/lib/systemd/system file directly, it will get overwritten on the next update. See https://wiki.archlinux.org/index.php/Sy … ided_units for a few more robust options.

Also for the future, please wrap command outputs in [ code ] tags as opposed to [ quote ] tags, will make everything more readable, especially for bigger blocks like that cat output.

I've added that line using 'systemctl edit alsa-restore.service' but the result is sadly the same:

$ systemctl cat alsa-restore.service
# /usr/lib/systemd/system/alsa-restore.service
#
# Note that two different ALSA card state management schemes exist and they
# can be switched using a file exist check - /etc/alsa/state-daemon.conf .
#

[Unit]
Description=Save/Restore Sound Card State
ConditionPathExists=!/etc/alsa/state-daemon.conf
ConditionPathExistsGlob=/dev/snd/control*
After=alsa-state.service

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=-/usr/bin/alsactl restore
ExecStop=-/usr/bin/alsactl store

# /etc/systemd/system/alsa-restore.service.d/override.conf
[Unit]
After=
After=sound.target
$ systemctl status alsa-restore.service
● alsa-restore.service - Save/Restore Sound Card State
   Loaded: loaded (/usr/lib/systemd/system/alsa-restore.service; static; vendor preset: disabled)
  Drop-In: /etc/systemd/system/alsa-restore.service.d
           └─override.conf
   Active: inactive (dead)
Condition: start condition failed at Thu 2017-08-17 14:11:41 CEST; 15min ago
           └─ ConditionPathExistsGlob=/dev/snd/control* was not met

i've also tried to remove the line 'After=' to no avail...

if it can help this is the output of lspci:

00:1f.3 Audio device: Intel Corporation Device 9d71 (rev 21)

and this is the output if i start the service manually:

# systemctl start alsa-restore.service
# systemctl status alsa-restore.service
● alsa-restore.service - Save/Restore Sound Card State
   Loaded: loaded (/usr/lib/systemd/system/alsa-restore.service; static; vendor preset: disabled)
  Drop-In: /etc/systemd/system/alsa-restore.service.d
           └─override.conf
   Active: active (exited) since Thu 2017-08-17 14:29:08 CEST; 6s ago
  Process: 5664 ExecStart=/usr/bin/alsactl restore (code=exited, status=0/SUCCESS)
 Main PID: 5664 (code=exited, status=0/SUCCESS)

Aug 17 14:29:08 laptop systemd[1]: Starting Save/Restore Sound Card State...
Aug 17 14:29:08 laptop systemd[1]: Started Save/Restore Sound Card State.

Offline

Board footer

Powered by FluxBB