You are not logged in.

#1 2015-05-04 18:35:02

Suncatcher
Banned
Registered: 2015-03-30
Posts: 36

ALSA levels always reset

Hello everybody!
A am trying to execute script stored in /etc/profile.d.
I created alsa.sh script:

alsactl --file /etc/profile.d/asound.state restore

and put it in /etc/profile.d directory. But nothing happens.
If I add any other line to this script this line executes perfectly. If I execute this script in bash

sh alsa.sh

it runs just fine.
What could be the reason?

Last edited by Suncatcher (2015-06-04 12:15:01)

Offline

#2 2015-05-04 19:33:10

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: ALSA levels always reset

If you add any other line or

#!/bin/sh

at the top?


What exactly are you trying to do with that script?

Offline

#3 2015-05-04 20:05:35

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,645

Re: ALSA levels always reset

What problem are you trying to solve? Why are the default systemd alsa store and restore services not working for you?

https://wiki.archlinux.org/index.php/Ad … nd_Systemd

Offline

#4 2015-05-05 18:50:01

Suncatcher
Banned
Registered: 2015-03-30
Posts: 36

Re: ALSA levels always reset

karol wrote:

If you add any other line or

Nope. Nothing happens if I add #!/bin/sh at the top.
But if I add any executable line (like chromium or any other app) it is executed before Enlightenment load.

karol wrote:

What exactly are you trying to do with that script?

To restore ALSA levels on system startup.

Last edited by Suncatcher (2015-05-05 19:06:32)

Offline

#5 2015-05-05 19:01:29

Suncatcher
Banned
Registered: 2015-03-30
Posts: 36

Re: ALSA levels always reset

2ManyDogs wrote:

Why are the default systemd alsa store and restore services not working for you?

This is extremely interesting question.
I tried to edit alsa-restore.service manually (to make it restore from file) but didn't succeeded.
But if a restore in bash (either from file or from initial asound.state) it works perfectly.
I've tried many ways of autostarting from https://wiki.archlinux.org/index.php/Autostarting

  • .xinitrc

  • ~/.config/autostart

  • /etc/profile

but they don't work.

Last edited by Suncatcher (2015-05-05 19:02:48)

Offline

#6 2015-05-05 19:09:44

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,645

Re: ALSA levels always reset

"but didn't succeed" and "but they don't work" tells us nothing we can use to try to help you. If you can tell us more about exactly how these attempts fail (and specifically how you edited alsa-restore.service) we might be able to help.

Offline

#7 2015-05-05 19:10:37

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: ALSA levels always reset

Look in your journal to determine why the service is not working, don't attempt kludgy fixes to mask the problem.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#8 2015-05-05 19:17:14

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: ALSA levels always reset

Post the output of:

systemctl status alsa-restore.service alsa-state.service alsa-store.service

Offline

#9 2015-05-05 20:15:15

Suncatcher
Banned
Registered: 2015-03-30
Posts: 36

Re: ALSA levels always reset

2ManyDogs wrote:

If you can tell us more about exactly how these attempts fail

It simply didn't start (ALSA levels left unchanged). What other details do you need?

2ManyDogs wrote:

and specifically how you edited alsa-restore.service

Original file was

#
# 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=Restore Sound Card State
ConditionPathExists=!/etc/alsa/state-daemon.conf
DefaultDependencies=no
After=alsa-state.service
Before=shutdown.target
Conflicts=shutdown.target

[Service]
Type=oneshot
ExecStart=-/usr/bin/alsactl restore
StandardOutput=syslog

And I replaced Exec line with

ExecStart=-/usr/bin/alsactl --file /etc/profile.d/asound.state restore

Offline

#10 2015-05-05 20:23:42

Suncatcher
Banned
Registered: 2015-03-30
Posts: 36

Re: ALSA levels always reset

Head_on_a_Stick wrote:

Post the output of:

systemctl status alsa-restore.service alsa-state.service alsa-store.service
● alsa-restore.service - Restore Sound Card State
   Loaded: loaded (/usr/lib/systemd/system/alsa-restore.service; static; vendor preset: disabled)
   Active: inactive (dead) since Tue 2015-05-05 21:46:50 MSK; 1h 36min ago
  Process: 177 ExecStart=/usr/bin/alsactl restore (code=exited, status=0/SUCCESS)
 Main PID: 177 (code=exited, status=0/SUCCESS)

May 05 21:46:50 localhost systemd[1]: Starting Restore Sound Card State...
May 05 21:46:50 localhost systemd[1]: Started Restore Sound Card State.

● alsa-store.service - Store Sound Card State
   Loaded: loaded (/usr/lib/systemd/system/alsa-store.service; static; vendor preset: disabled)
   Active: inactive (dead)

Offline

#11 2015-05-05 20:28:36

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: ALSA levels always reset

Suncatcher wrote:

And I replaced Exec line with

ExecStart=-/usr/bin/alsactl --file /etc/profile.d/asound.state restore

Did you also change alsa-store.service accordingly (or somehow manually create this state file) and then reboot? Related to this: the status output you just posted, is that with the modified service file?

Why do you even want to use such an inappropriate location for the state file? You think the service doesn't restore levels because of the default location?

Last edited by Raynman (2015-05-05 20:30:25)

Offline

#12 2015-05-05 20:41:05

Suncatcher
Banned
Registered: 2015-03-30
Posts: 36

Re: ALSA levels always reset

jasonwryan wrote:

Look in your journal to determine why the service is not working, don't attempt kludgy fixes to mask the problem.

journalctl | grep -i alsa

gives this output

May 04 17:51:45 localhost alsactl[190]: /usr/bin/alsactl: load_state:1683: Cannot open /var/lib/alsa/asound.state for reading: No such file or directory
May 04 17:51:45 localhost alsactl[190]: /usr/bin/alsactl: sysfs_init:48: sysfs path '/sys' is invalid
May 04 17:51:45 localhost alsactl[190]: Found hardware: "ICH" "SigmaTel STAC9700,83,84" "AC97a:83847600" "0x8086" "0x0000"
May 04 17:51:45 localhost alsactl[190]: Hardware is initialized using a generic method
May 04 20:10:14 localhost alsactl[178]: /usr/bin/alsactl: load_state:1735: No soundcards found...
May 04 20:58:08 localhost alsactl[179]: /usr/bin/alsactl: load_state:1735: No soundcards found...
May 04 21:12:42 localhost alsactl[178]: /usr/bin/alsactl: load_state:1735: No soundcards found...
May 04 21:18:29 localhost sudo[313]: suncatcher : TTY=unknown ; PWD=/home/suncatcher ; USER=root ; COMMAND=/usr/bin/alsactl --file /etc/profile.d/asound.state restore

Offline

#13 2015-05-05 20:53:42

Suncatcher
Banned
Registered: 2015-03-30
Posts: 36

Re: ALSA levels always reset

Raynman wrote:

Did you also change alsa-store.service accordingly?

No. I wanted to restore from my modified levels' configuration, not from generic one.

Raynman wrote:

Related to this: the status output you just posted, is that with the modified service file?

No, posted output is from the original alsa-restore.service. As my attempts were unsuccessfull I reverted to original one.

Raynman wrote:

Why do you even want to use such an inappropriate location for the state file? You think the service doesn't restore levels because of the default location?

No, I didn't think the reason was in default location. I simply tried all possible ways to solve the problem. I thought (and now I think so too) the location of asound.state file is nonessential because manual restoring via my alsa.sh script works just fine.

Offline

#14 2015-05-05 21:08:58

Suncatcher
Banned
Registered: 2015-03-30
Posts: 36

Re: ALSA levels always reset

Suncatcher wrote:
jasonwryan wrote:

Look in your journal to determine why the service is not working, don't attempt kludgy fixes to mask the problem.

journalctl | grep -i alsa

gives this output

May 04 17:51:45 localhost alsactl[190]: /usr/bin/alsactl: load_state:1683: Cannot open /var/lib/alsa/asound.state for reading: No such file or directory
May 04 17:51:45 localhost alsactl[190]: /usr/bin/alsactl: sysfs_init:48: sysfs path '/sys' is invalid
May 04 17:51:45 localhost alsactl[190]: Found hardware: "ICH" "SigmaTel STAC9700,83,84" "AC97a:83847600" "0x8086" "0x0000"
May 04 17:51:45 localhost alsactl[190]: Hardware is initialized using a generic method
May 04 20:10:14 localhost alsactl[178]: /usr/bin/alsactl: load_state:1735: No soundcards found...
May 04 20:58:08 localhost alsactl[179]: /usr/bin/alsactl: load_state:1735: No soundcards found...
May 04 21:12:42 localhost alsactl[178]: /usr/bin/alsactl: load_state:1735: No soundcards found...
May 04 21:18:29 localhost sudo[313]: suncatcher : TTY=unknown ; PWD=/home/suncatcher ; USER=root ; COMMAND=/usr/bin/alsactl --file /etc/profile.d/asound.state restore

BTW, when I execute

alsactl restore

I also get journal-like error:

alsactl: state_lock:125: file /var/lib/alsa/asound.state lock error: File exists
alsactl: load_state:1683: Cannot open /var/lib/alsa/asound.state for reading: File exists
alsactl: sysfs_init:48: sysfs path '/sys' is invalid

Found hardware: "ICH" "SigmaTel STAC9700,83,84" "AC97a:83847600" "0x8086" "0x0000"
Hardware is initialized using a generic method

Offline

#15 2015-05-11 18:19:54

Suncatcher
Banned
Registered: 2015-03-30
Posts: 36

Re: ALSA levels always reset

system.d analysis didn't highlight any failed services:

systemctl --failed

gives output

0 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

Last edited by Suncatcher (2015-05-24 20:30:17)

Offline

#16 2015-05-24 19:25:05

Suncatcher
Banned
Registered: 2015-03-30
Posts: 36

Re: ALSA levels always reset

systemd alsa services' check is also fine and gives following outputs:
systemctl status alsa-restore

● alsa-restore.service - Restore Sound Card State
   Loaded: loaded (/usr/lib/systemd/system/alsa-restore.service; static; vendor preset: disabled)
   Active: inactive (dead) since Sun 2015-05-24 23:14:01 MSK; 17min ago
  Process: 195 ExecStart=/usr/bin/alsactl restore (code=exited, status=0/SUCCESS)
 Main PID: 195 (code=exited, status=0/SUCCESS)

May 24 23:14:01 localhost systemd[1]: Starting Restore Sound Card State...
May 24 23:14:01 localhost systemd[1]: Started Restore Sound Card State.

systemctl status alsa-store

● alsa-store.service - Store Sound Card State
   Loaded: loaded (/usr/lib/systemd/system/alsa-store.service; static; vendor preset: disabled)
   Active: inactive (dead)

systemctl status alsa-state

● 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 Sun 2015-05-24 23:14:01 MSK; 20min ago
           ConditionPathExists=/etc/alsa/state-daemon.conf was not met

May 24 23:14:01 localhost systemd[1]: Started Manage Sound Card State (restore and store).

Last edited by Suncatcher (2015-05-24 20:37:19)

Offline

#17 2015-05-24 20:22:50

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,645

Offline

#18 2015-06-04 12:13:04

Suncatcher
Banned
Registered: 2015-03-30
Posts: 36

Re: ALSA levels always reset

Why does it initialize the device in a generic way

Found hardware: "ICH" "SigmaTel STAC9700,83,84" "AC97a:83847600" "0x8086" "0x0000"
Hardware is initialized using a generic method

?
I think the reason is here.

Last edited by Suncatcher (2015-06-04 12:13:44)

Offline

Board footer

Powered by FluxBB