LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-17-2015, 11:18 PM   #1
G-Known
LQ Newbie
 
Registered: Jul 2013
Location: Penn
Distribution: Debian
Posts: 24

Rep: Reputation: Disabled
Unable to run alsactl restore during startup


Alsa won't save my audio settings whenever I reboot the LXDE computer on my Slackware 14.1 i686 build. This is the rc.alsa file:

Code:
#!/bin/sh
# Load the mixer settings and OSS compatibility (if enabled) for ALSA.
# (the Advanced Linux Sound Architecture)

# A function to load the ALSA mixer settings:
load_alsa_mixer() {
  if [ -r /var/lib/alsa/asound.state ]; then
    echo "Loading ALSA mixer settings:  /usr/sbin/alsactl restore"
    /usr/sbin/alsactl restore
  else
    # It's possible a user might not want to set a default sound state.
    # In that case, do this:  touch /var/lib/alsa/no.asound.state
    if [ ! -r /var/lib/alsa/no.asound.state ]; then
      echo "Setting default ALSA mixer settings."
      # set default mixer volumes for ALSA
      # Taken from the alsaconf script.
      amixer -s -q <<EOF
set Master 75% unmute
set Master -12dB
set 'Master Mono' 75% unmute
set 'Master Mono' -12dB
set Front 75% unmute
set Front -12dB
set PCM 90% unmute
set PCM 0dB
mixer Synth 90% unmute
mixer Synth 0dB
mixer CD 90% unmute
mixer CD 0dB
# mute mic
set Mic 0% mute
# ESS 1969 chipset has 2 PCM channels
set PCM,1 90% unmute
set PCM,1 0dB
# Trident/YMFPCI/emu10k1
set Wave 100% unmute
set Music 100% unmute
set AC97 100% unmute
# CS4237B chipset:
set 'Master Digital' 75% unmute
# Envy24 chips with analog outs
set DAC 90% unmute
set DAC -12dB
set DAC,0 90% unmute
set DAC,0 -12dB
set DAC,1 90% unmute
set DAC,1 -12dB
# some notebooks use headphone instead of master
set Headphone 75% unmute
set Headphone -12dB
set Playback 100% unmute
# turn off digital switches
set "SB Live Analog/Digital Output Jack" off
                set "Audigy Analog/Digital Output Jack" off
EOF
      echo "Storing default ALSA mixer settings:  /usr/sbin/alsactl store"
      /usr/sbin/alsactl store
    fi
  fi
}

# If udev or something else has loaded the ALSA modules, then
# simply load the mixer settings and make sure the OSS compat
# modules are loaded (if enabled):
if [ -d /proc/asound ]; then
  if [ -x /etc/rc.d/rc.alsa-oss ]; then
    sh /etc/rc.d/rc.alsa-oss
  fi
  load_alsa_mixer
else
# If there are ALSA modules defined in /etc/modprobe.d/*, but
  # ALSA is not yet loaded, then load the modules now:
  DRIVERS=$(modprobe -c | grep -E "^[[:space:]]*alias[[:space:]]+snd-card-[[:di$
  if [ ! "$DRIVERS" = "" ]; then
    echo "Loading ALSA kernel modules."
    for module in $DRIVERS; do
      modprobe $module
    done
  fi
  # If ALSA is now up, then load the mixer settings and OSS modules (if enabled$
  if [ -d /proc/asound ]; then
    if [ -x /etc/rc.d/rc.alsa-oss ]; then
      sh /etc/rc.d/rc.alsa-oss
    fi
    load_alsa_mixer
  fi
fi
What doesn't work:
1. inserting the command to the rc.local file
2. adding the line to xinitrc file
3. creating an .lxde directory with a bash script
4. reinstalling alsa
5. adding /usr/bin/alsactl store to 'Path' line in rc.0 file
6. changed file permission of asound.state
7. changed permission of the directory /dev/snd
8. alsaconf doesn't run with system not recognizing this command
9. created an xprofile, won't run either.

What does work:
1. running alsactl restore manually
2. alsactl store saves
3. checked rc.local and bash script is executable
4. I'm in the audio group

Any suggestions? If I can't seem to resolve this, I may classify this as a bug and switch to pulseaudio.

Last edited by G-Known; 11-23-2015 at 12:03 AM.
 
Old 11-17-2015, 11:35 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, and whatever VMs I happen to be playing with
Posts: 12,979
Blog Entries: 18

Rep: Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383
When you configure your ALSA settings, do you do so as user or as root?

In my experience, if you want the settings to be persistent, it's best to run alsamixer as root to configure your settings, then while still root run alsactl store to save your settings.

The settings should then persist through a reboot, at least, again, in my experience.

Last edited by frankbell; 11-17-2015 at 11:44 PM.
 
1 members found this post helpful.
Old 11-18-2015, 06:14 PM   #3
G-Known
LQ Newbie
 
Registered: Jul 2013
Location: Penn
Distribution: Debian
Posts: 24

Original Poster
Rep: Reputation: Disabled
If it were that simple, then I shouldn't be posing this question. Anyway, I did as you've asked and run both command in root. But as expected, nothing changed.

Last edited by G-Known; 11-18-2015 at 06:50 PM.
 
Old 11-18-2015, 06:39 PM   #4
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 266

Rep: Reputation: 128Reputation: 128
As an alternative you can try something like this in rc.local,
you may need to experiment to get to what you desire.

Code:
amixer cset iface=MIXER,name="Master Playback Volume" 100
amixer cset iface=MIXER,name="Front Playback Volume" 100
I have the above in a script I manually execute after a reboot, which is infrequent for me.

John
 
Old 11-18-2015, 06:48 PM   #5
G-Known
LQ Newbie
 
Registered: Jul 2013
Location: Penn
Distribution: Debian
Posts: 24

Original Poster
Rep: Reputation: Disabled
That too didn't work out. It looked like it's in a locked state.
 
Old 11-18-2015, 09:02 PM   #6
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, and whatever VMs I happen to be playing with
Posts: 12,979
Blog Entries: 18

Rep: Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383
Quote:
If it were that simple, then I shouldn't be posing this question.
It is helpful, when posting a question, to let others know what you have tried already. You might want to take a look at this, if you haven't yet done so.

Last edited by frankbell; 11-18-2015 at 09:07 PM. Reason: clarity
 
1 members found this post helpful.
Old 11-23-2015, 12:03 AM   #7
G-Known
LQ Newbie
 
Registered: Jul 2013
Location: Penn
Distribution: Debian
Posts: 24

Original Poster
Rep: Reputation: Disabled
Alright,

I've done it. Thanks for your inputs.

Thread Solved.
 
Old 11-23-2015, 07:58 AM   #8
bassmadrigal
Senior Member
 
Registered: Nov 2003
Location: Newport News, VA
Distribution: Slackware
Posts: 4,745

Rep: Reputation: 2634Reputation: 2634Reputation: 2634Reputation: 2634Reputation: 2634Reputation: 2634Reputation: 2634Reputation: 2634Reputation: 2634Reputation: 2634Reputation: 2634
What did you do to fix it? It may be beneficial for others who may come across this thread from a Google search.
 
Old 11-23-2015, 06:25 PM   #9
G-Known
LQ Newbie
 
Registered: Jul 2013
Location: Penn
Distribution: Debian
Posts: 24

Original Poster
Rep: Reputation: Disabled
Oh right. Whenever alsa runs at startup it would initialize (not exactly what but I'm guessing it has to do with a file --not hardware--), but whenever it fails, it would set its default value. Basically you have to look for the file that contains these values so you can modify them and it'll remember them.

What most likely happen was alsactl did run but failed to 'initialize' so the command gets ignored.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
starting of x fails because of alsactl restore rangalo Slackware 9 04-30-2007 05:21 AM
Alsactl restore fails on boot up marsh58 Debian 1 09-12-2006 09:23 AM
alsactl restore not working at boot rgiggs Slackware 4 07-14-2004 04:57 PM
alsactl restore problem Guste Debian 1 02-08-2004 02:53 AM
Doing alsactl to restore mixer setings Maurice Arthur Linux - Software 0 11-11-2003 01:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration