WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: alsa settings not persistent  (Read 3421 times)

Offline thane

  • Hero Member
  • *****
  • Posts: 697
alsa settings not persistent
« on: March 01, 2016, 11:28:50 AM »
I probably overlooked something obvious, but since I upgraded to TC 7.0 I keep having to unmute alsa when I reboot. I did the recommended steps of unmuting in alsamixer,  sudo alsactl store, and adding usr/local/etc/alsa/asound.state to the backup, but when I reboot the volume/mute settings are back to default. Alsa works fine once I unmute. Should note I also have alsa-config and audacious loaded, so don't know if that's somehow a factor. This all worked in 6.x though.

I also tried adding /usr/local/etc/init.d/alsasound start to bootlocal.sh, but that froze my mouse and keyboard! Weird.

Thane

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11702
Re: alsa settings not persistent
« Reply #1 on: March 01, 2016, 11:51:36 AM »
Hi thane
Don't you also need to use:
Code: [Select]
alsactl restoreafter you reboot?

Offline nitram

  • Hero Member
  • *****
  • Posts: 1054
Re: alsa settings not persistent
« Reply #2 on: March 01, 2016, 05:00:08 PM »
Placing your desired audio settings into an ~/.X.d file works too:
Code: [Select]
amixer set Master 80% &
amixer set PCM 100% &
amixer set Master unmute &
amixer set PCM unmute &
conky &
xset s 300 &

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: alsa settings not persistent
« Reply #3 on: March 01, 2016, 05:50:02 PM »
.X.d only runs when X is started, and runs every time X is started.
This will not help with console apps.
Use bootlocal.sh.

Offline andyj

  • Hero Member
  • *****
  • Posts: 1036
Re: alsa settings not persistent
« Reply #4 on: March 01, 2016, 06:56:55 PM »
Alsa has been broken as long as I can remember. Look at the scripts, you'll see that you need to add var/lib/alsa to /opt/.filetool.lst.

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: alsa settings not persistent
« Reply #5 on: March 01, 2016, 07:26:04 PM »
Alsa has not been broken for me as long as I can remember, and I do not include var/lib/alsa in .filetool.lst.

Offline andyj

  • Hero Member
  • *****
  • Posts: 1036
Re: alsa settings not persistent
« Reply #6 on: March 01, 2016, 07:44:33 PM »
$ cat /usr/local/tce.installed/alsa
Code: [Select]
#!/bin/sh

[ -e /etc/udev/rules.d/90-alsa-restore.rules ] || sudo ln -s /usr/local/etc/udev/rules.d/90-alsa-restore.rules /etc/udev/rules.d/ > /dev/null 2>&1

udevadm control --reload-rules 2> /dev/null
udevadm trigger 2> /dev/null

[ -d /opt/alsa ] || mkdir /opt/alsa

if [ ! -d /var/lib/alsa ]; then
  mkdir -p /var/lib/alsa
fi

if [ ! -e /usr/local/etc/asound.state ]; then
  amixer set Master on 60
fi

Also:

Usage: alsactl <options> command

global options:
  -h,--help        this help
  -d,--debug       debug mode
  -v,--version     print version of this program

Available state options:
  -f,--file #      configuration file (default /var/lib/alsa/asound.state)
...

Notice where alsa is looking? The load script makes a lot of directories, but only one really matters.

Also see this link from a year ago: http://forum.tinycorelinux.net/index.php/topic,18061.msg109428.html#msg109428

I don't have a problem with it not being a priority to fix because with everything else we have going on it's pretty minor, but don't deny it's a problem.

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: alsa settings not persistent
« Reply #7 on: March 01, 2016, 07:58:43 PM »
Why are you referencing a rpi forum post?
Are you running a raspberry PI?

Offline andyj

  • Hero Member
  • *****
  • Posts: 1036
Re: alsa settings not persistent
« Reply #8 on: March 01, 2016, 10:30:48 PM »
I have some PI's and some x86 boxes. I've had the same problem on both. Having a common code base is helpful in many ways. In this case I hope it means it only needs to be fixed once. I see that the x86 extension is about a year newer than the PI so maybe some things have changed that haven't been migrated over to the PI yet. I also see that alsa version 1.1.0 has updated from 1.0.28 on x86:

$ alsactl --help
Usage: alsactl <options> command
...
Available state options:
  -f,--file #      configuration file (default /usr/local/etc/alsa/asound.state)

Anyway, what I have found is that I can reproduce thane's problem if I put alsa.tcz in onboot.lst. If I don't, and tce-load -i alsa in a terminal window after X starts, then the volumes are properly restored. This is a feature of udev rules versus mydata restore timing. Adding
Code: [Select]
/usr/local/sbin/alsactl restore to /opt/bootlocal.sh worked for me. The previous version didn't require this. Maybe we could document this change too?

Offline thane

  • Hero Member
  • *****
  • Posts: 697
Re: alsa settings not persistent
« Reply #9 on: March 01, 2016, 11:15:30 PM »
Thanks for the replies.

Putting /usr/local/sbin/alsactl restore in /opt/bootlocal.sh (as andyj and Rich suggested) worked.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14851
Re: alsa settings not persistent
« Reply #10 on: March 02, 2016, 08:42:35 AM »
verified

* if alsa is loaded after boot settings are loaded OK
* if alsa is loaded onboot "sudo alsactl restore" is required

comment added to alsa info file