Storing sound settings for the secondary audio device?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Storing sound settings for the secondary audio device? (SuSE 9.1)
I have this extremely irritating problem with my sound setup; I suppose it's the traditional problem with ALSA not restoring the settings from the previous session, but with a little twist. So please read on before you dismiss my post!
I'm running SuSE 9.1 Personal on an Athlon machine. Sound card "0" is the on-board VIA sound system. It's working as it should, and volume settings are not being re-set all the time. No problems there then.
My problem is the second audio device (device "1"), one that's vital to me: it's a USB phone handset which must I use for Skype calls.
It's been detected and configured properly by the system, and it's working perfectly. HOWEVER, every time I start my system its volume settings (master and PCM I suppose) are set to maximum (99). You can imagine what that does to my eardrum when I answer a call. So, every time I load linux I have to set the volume back to a comfortable level (11).
If I start the terminal as su/root and type 'alsactl restore 1', the settings go back to the level I'd set the last time I used linux (11). This much I know.
What I'd like to know is, is there a way to make this an automatic procedure during start-up? Which script should I edit by adding the line 'alsactl restore 1' in order to achieve this? Should I include 'alsactl store 1' to some "logout" script too? How?
A few notes:
1. I've read all about kmix and KAMix and stuff like that; I DO NOT have kmix (it's simply not there, it won't turn up in a YaST search, so don't even bother to mention it). I use KAMix to set the volume EVERY TIME that KDE is launched - so it obviously won't store the volume levels for the next session.
2. Please DON'T reply with a "oh, just write a script with the command line you need and link it" type of answer. Please. I don't know the first thing about linux (it was a while before I could figure the alsactl thing). I don't know HOW TO make a script. I don't know how to link it. I've tried adding 'alsactl restore 1' to the "alsasound" script in /etc/init.d (by adding this line to the end of the script) and it didn't work. I'm a real, clueless linux newbie.
3. Again, please keep in mind that I don't know anything about linux. Anything at all. I've opened some script files using "Edit" in the terminal window and have yet to find a way out of "edit" without having to close the terminal and launching it back again. I'm that hopeless.
Many thanks in advance for any insights and/or help!
Thanks Peacedog! But I found no such file (rc.local) in /etc/rc.d/ .
Also, I found this text in the README file included within /etc/rc.d/ :
INIT.D(7) The SuSE boot concept INIT.D(7)
INIT.D - The SuSE boot concept
The scripts for controlling the system are placed in
/etc/init.d/ (they have been moved accordingly to the
Linux Standard Base (LSB) specification). These scripts
are executed directly or indirectly by /sbin/init, the
father of all processes. The configuration of /sbin/init
is given by the file /etc/inittab (see inittab(5)).
At boot time, the boot level master script
/etc/init.d/boot is called to initialise the system (e.g.
file system check, ...). It also executes some hardware
init scripts linked into /etc/init.d/boot.d/. Then it
calls /etc/init.d/boot.local, which executes the local
After system startup, /sbin/init will normally switch on
the default run level given in /etc/inittab. It calls the
run level master script /etc/init.d/rc to start or stop
services provided by the other scripts under /etc/init.d/.
To control the services of a run level, the corresponding
scripts are linked into run level directories
/etc/init.d/rc<X>.d/, where <X>=0,1,2,3,4,5,6,S is the run
There are two kinds of symbolic link: start links, which
are called when entering a run level, and stop links,
which are called when leaving a run level. Note that each
service in the run levels 2, 3, 4, and 5 consists of a
start and a stop link. Within SuSE boot concept a differ
ential link scheme is used to be able to change a runlevel
in comparision with the former level.
To avoid redundant starts when changing run levels only
those services are started, which have no start link in
the previous run level. And to avoid redundant stops when
changing run levels, only those services are stopped which
have no start link in the current level. To control this
behaviour, the names of the scripts are added on the names
of the start and stop links.
To control the order of service starts and stops, the
start and stop links include a number in their link name.
The system configuration files in /etc/sysconfig contain
most of the variables used to configure the installed ser
vices. These variables can easily be changed by YaST or
by using an editor. After using an editor, the script
/sbin/SuSEconfig must be called to distribute the settings
into the system.
The script /etc/init.d/lpd starts or stops the line
printer daemon for the printing service, according to the
To do this automatically in run level 3, this script is
linked into /etc/init.d/rc3.d/ with these two symbolic
/etc/init.d/rc3.d/S20lpd -> ../lpd
/etc/init.d/rc3.d/K20lpd -> ../lpd
The corresponding link with the letter S is used to start
a service. For the printing service the number between the
letter S and the name should be greater than the number of
the start link of the network service. The corresponding
link with the letter K is used to stop a service. The num
ber of the stop link for the printing service should be
less than that of the stop link for the network service so
that the printer daemon is stopped before shutting down
the network service.
Run levels and their services
0 This level is used for halting the system. The only
valid service for this level is the script halt,
which is linked into /etc/init.d/rc0.d/. The
script halt executes /etc/init.d/halt.local. Spe
cials system issues for halt or reboot should be
6 This level is used for rebooting the system. The
only valid service for this level is the script
reboot, which is linked into /etc/init.d/rc6.d/.
The script reboot executes /etc/init.d/halt.local.
Specials system issues for halt or reboot should be
S This mode is used to switch from boot phase into
single user mode. The last valid service for this
mode is the script single, which is linked into
/etc/init.d/rcS.d/. In this mode you have only one
1 Accordingly to the Linux Standard Base (LSB) speci
fication this runlevel is used to switch from nor
mal runlevel into single user mode. This is dif
ferent from former SuSE Linux versions!
2 The run level 2 is without remote networking. Note
that on some other systems this is identical with
the single user mode. This run level can have more
than one virtual console.
3 The run level 3 is with network. This run level is
for server stations not automatically running X.
5 The level 5 is with network and xdm(1). You should
have a configured and perfectly running X Window
System for this work station run level.
4 The run level 4 is not (yet) used.
This script is a model for writing your own. You
can use insserv(8) to include your own script into
a run level.
# Copyright (c) 2002 SuSE Linux AG Nuernberg, Germany. All rights reserved.
# Author: Werner Fink <email@example.com>, 1996
# Burchard Steinbild, 1996
# script with local commands to be executed from init on system startup
# Here you should add things, that should happen directly after booting
# before we're going to the first run level.
During startup I get a failure message and "No such device was found" or something.
I guess alsactl restore 1 should be one of the very last, if not the very last, command to be run before X and KDE kick in...
It always works from terminal. I think it's a matter of including it as the last command or script to be run. Then again, I don't know anything about linux.
Thanks for the replies so far, Peacedog! Any other suggestions are very welcome!
From what I've read if boot.local didn't work, you may be looking at your own script from the /etc/init.d/skeleton.
If that turns out to be the case, I'll have to do some research to help you, and your initial request for " Please DON'T reply with a "oh, just write a script with the command line you need and link it" type of answer. " may have have to be the answer, but, I feel like we'll be able to get you through it.
I checked 'skeleton' out. To be totally honest I don't have a clue as to what it was all about.
Before I hit this forum I did some and saw a page where somebody mentioned the creation of a script with a single line, to be called 'alsasoundrestoremixer'. The single line - you guessed it - would be 'alsactl restore' or, in my case, (...) restore 1.
I would then link this script using a ln -s command.
This didn't work because the script could not be created (linux replied with a message meaning "could not find file" - 'file' meaning the original script to be linked.
As for creating scripts, I know I can turn a KATE text file into one by ending the filename with .sh. That's all.
This is all very strange really. Right now I'm writing this from Windows because I was so furious at linux. Much in the same way I used to feel about Windows in fact.
>On Wed, 2003-12-10 at 10:14, Joe Polk wrote:
>> Is there an equivalent to rc.local in SuSE9? If not, where/what should I do
>> with a manual script at startup?
>I think this is what you are looking for.
Probably not, as boot.local is run too early for many things! boot.local is
run after the boot.* scripts, i.e. before network and other services are
The probably best way would be to create an init script using
/etc/init.d/skeleton as template and setting required-start to $ALL,
i.e. having it run after all other services. For additional info see
'man insserv' the all the comments in /etc/init.d/skeleton.
boot.local does run a bit too early. What's with this $ALL then? Should I type this right at the beginning of this particular script I should write? And should I type exactly that, "$ALL", or just "ALL" or whatever. As you can see I'm pretty clueless about this whole thing.
Once I write this script (if it's absolutely needed), what name should I give it? Where do I place it? How do I make it run during startup?
Just to verify, there is no rc.local in /etc/init.d? try looking in /etc/rc.d or /etc/init.d/rc.d or /etc/rc.d/init.d it's got to be in one of those directories. If not, how big is that skeleton file? You don't really need a big script to get this working, all it needs is 2 lines:
alsactl restore 1
or if you copy that skeleton file to /etc/init.d/ and give it a name like rc.setalsa or something else that identifies it then you can put the alsactl command in the ...start() section. It may be a good idea to use it's full path though: (whereis alsactl to check on your system, I'm running Slackware too so mine may be different) /usr/bin/alsactl restore 1
Then to link it so it runs, you shoul be able to use that insserv command to get it to started. It should just be called whatever you named the rc. file but without the rc. so 'setalsa' in my example above. You want it started in runlevels 3, 4 and 5 and if it asks for a priority just pick a number between 90 and 99. Try either man insserv or insserv --help to get the details on that command.
after steps 1, 2 and 3 described above I entered the following command:
insserv -v /etc/init.d/rc.alsaset
Output from -v showed that the script was installed somewhere. So I rebooted the machine and... My main audio volume settings are being re-set to "0" level and muted. And the USB device remains at "99".
Distribution: Slackware, Windows, FreeBSD, OpenBSD, Mac OS X
What happens if you run aslactrl restore after a boot, rather than alsactl restore 1? Do you get the same results? Do you have more than one asound.state file e.g. asound.state0, asound.state1, etc.?