LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices


Reply
  Search this Thread
Old 11-24-2004, 02:18 PM   #1
Livino
Member
 
Registered: Nov 2004
Location: Belo Horizonte, Brasil
Distribution: Suse Linux 10.0
Posts: 32

Rep: Reputation: 15
Storing sound settings for the secondary audio device? (SuSE 9.1)


Hi everyone,

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!

Last edited by Livino; 11-25-2004 at 08:05 AM.
 
Old 11-24-2004, 05:53 PM   #2
Peacedog
LQ Guru
 
Registered: Sep 2003
Location: Danville, VA
Distribution: Slackware, Windows, FreeBSD, OpenBSD, Mac OS X
Posts: 5,296

Rep: Reputation: 168Reputation: 168
Try adding the command to the end of /etc/rc.d/rc.local.
good luck.
 
Old 11-24-2004, 06:47 PM   #3
Livino
Member
 
Registered: Nov 2004
Location: Belo Horizonte, Brasil
Distribution: Suse Linux 10.0
Posts: 32

Original Poster
Rep: Reputation: 15
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/ :

Quote:
INIT.D(7) The SuSE boot concept INIT.D(7)


NAME
INIT.D - The SuSE boot concept

SYNOPSIS
/etc/init.d/*

/etc/sysconfig

DESCRIPTION
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
commands.

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
level number.

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.

Some details
The script /etc/init.d/lpd starts or stops the line
printer daemon for the printing service, according to the
flag used:

/etc/init.d/lpd start
and

/etc/init.d/lpd stop

To do this automatically in run level 3, this script is
linked into /etc/init.d/rc3.d/ with these two symbolic
links

/etc/init.d/rc3.d/S20lpd -> ../lpd
and

/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
added there.

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
added there.

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
console.

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.

/etc/init.d/skeleton
This script is a model for writing your own. You
can use insserv(8) to include your own script into
a run level.


FILES
/etc/init.d/*
/etc/init.d/boot
/etc/init.d/boot.local
/etc/init.d/halt
/etc/init.d/halt.local
/etc/init.d/rc
/etc/init.d/reboot
/etc/init.d/skeleton
/etc/init.d/single
/etc/init.d/boot.d/S[0-9][0-9]*
/etc/init.d/rc0.d/{K,S}[0-9][0-9]*
/etc/init.d/rc1.d/{K,S}[0-9][0-9]*
/etc/init.d/rc2.d/{K,S}[0-9][0-9]*
/etc/init.d/rc3.d/{K,S}[0-9][0-9]*
/etc/init.d/rc4.d/{K,S}[0-9][0-9]*
/etc/init.d/rc5.d/{K,S}[0-9][0-9]*
/etc/init.d/rc6.d/{K,S}[0-9][0-9]*
/etc/init.d/rcS.d/{K,S}[0-9][0-9]*
/etc/inittab
/etc/sysconfig

SEE ALSO
insserv(8), init(8), inittab(5), and the SuSE Linux hand
book, chapter The SuSE boot concept.

COPYRIGHT
1996-2002 SuSE Linux AG, Nuernberg, Germany.

AUTHORS
Florian La Roche <http://www.suse.de/feedback>, Werner
Fink <werner@suse.de>, Burchard Steinbild
<http://www.suse.de/feedback>.



Version 0.4 Nov 15, 2000 INIT.D(7)
The problem remains...


Cheers.
 
Old 11-24-2004, 07:20 PM   #4
Peacedog
LQ Guru
 
Registered: Sep 2003
Location: Danville, VA
Distribution: Slackware, Windows, FreeBSD, OpenBSD, Mac OS X
Posts: 5,296

Rep: Reputation: 168Reputation: 168
Sorry about that mate, I run slack. It looks as if the correct file to add the command to would be /etc/init.d/boot.local. Try that one, hope it works for you.
good luck.
 
Old 11-24-2004, 07:34 PM   #5
Livino
Member
 
Registered: Nov 2004
Location: Belo Horizonte, Brasil
Distribution: Suse Linux 10.0
Posts: 32

Original Poster
Rep: Reputation: 15
Didn't work.

boot.local runs way too early I guess:

Quote:
#! /bin/sh
#
# Copyright (c) 2002 SuSE Linux AG Nuernberg, Germany. All rights reserved.
#
# Author: Werner Fink <werner@suse.de>, 1996
# Burchard Steinbild, 1996
#
# /etc/init.d/boot.local
#
# 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!

Cheers.
 
Old 11-24-2004, 07:40 PM   #6
Peacedog
LQ Guru
 
Registered: Sep 2003
Location: Danville, VA
Distribution: Slackware, Windows, FreeBSD, OpenBSD, Mac OS X
Posts: 5,296

Rep: Reputation: 168Reputation: 168
I'm not very familiar with suse, and I know all this rebooting and suggestions are frustrating, I apologize for that. With that said, try this one.

/etc/init.d/rc

good luck.
 
Old 11-24-2004, 08:02 PM   #7
Livino
Member
 
Registered: Nov 2004
Location: Belo Horizonte, Brasil
Distribution: Suse Linux 10.0
Posts: 32

Original Poster
Rep: Reputation: 15
@peacedog

Thanks! I don't mind the rebooting and all, I'd just like to get this sorted! And I really appreciate your help, especially knowing that you're a Slackware person and not a SuSE user.

Well, rc didn't do the trick either.

I'm including alsactl restore 1 as the very last line in each of these scripts (in turn, obviously). So far, without success.

My hair is starting to turn grey...

Last edited by Livino; 11-24-2004 at 08:04 PM.
 
Old 11-24-2004, 08:21 PM   #8
Peacedog
LQ Guru
 
Registered: Sep 2003
Location: Danville, VA
Distribution: Slackware, Windows, FreeBSD, OpenBSD, Mac OS X
Posts: 5,296

Rep: Reputation: 168Reputation: 168
The only other one that looks as if it has promise is the /etc/init.d/rc5.d/{K,S}[0-9][0-9]*. I've done a google on " suse rc.local equivalent " you can find it here.

http://www.google.com/search?hl=en&q...=Google+Search

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.
good luck.

Last edited by Peacedog; 11-24-2004 at 08:22 PM.
 
Old 11-24-2004, 08:30 PM   #9
Livino
Member
 
Registered: Nov 2004
Location: Belo Horizonte, Brasil
Distribution: Suse Linux 10.0
Posts: 32

Original Poster
Rep: Reputation: 15
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.

Computers...

Cheers.
 
Old 11-24-2004, 08:38 PM   #10
Livino
Member
 
Registered: Nov 2004
Location: Belo Horizonte, Brasil
Distribution: Suse Linux 10.0
Posts: 32

Original Poster
Rep: Reputation: 15
Hmmm...

Quote:
Kenneth Schneider <e-mail address removed> [Wed, 10 Dec 2003 10:19:46 -0500]:

>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?
>
>/etc/init.d/boot.local
>
>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
started.

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.

Philipp
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?

Loads of questions I'm afraid.
 
Old 11-25-2004, 08:04 AM   #11
Livino
Member
 
Registered: Nov 2004
Location: Belo Horizonte, Brasil
Distribution: Suse Linux 10.0
Posts: 32

Original Poster
Rep: Reputation: 15
Any thoughs?

I've been checking the scripts but I don't know their order during start-up.

Anyway. Perhaps that's not the answer.

Any SuSE people out there?
 
Old 11-25-2004, 09:06 AM   #12
Darin
Senior Member
 
Registered: Jan 2003
Location: Portland, OR USA
Distribution: Slackware, SLAX, Gentoo, RH/Fedora
Posts: 1,024

Rep: Reputation: 45
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:
Code:
#!/bin/sh
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.
 
Old 11-25-2004, 09:46 AM   #13
Livino
Member
 
Registered: Nov 2004
Location: Belo Horizonte, Brasil
Distribution: Suse Linux 10.0
Posts: 32

Original Poster
Rep: Reputation: 15
Thanks!

There's no rc.local anywhere. Within /etc/init.d there are several sub-directories: "boot.d", and "rc0.d" through "rc6.d", and "rcS.d".

So, just to get this right:

1. I've created a script called "rc.setalsa". It consists of only two lines, which I reproduce below:

Quote:
#!/bin/sh
/usr/sbin/alsactl restore 1
2. I've moved this script to /etc/init.d/

3. I've checked insserv (man insserv) but I'm not too sure about the command line. Should I just enter insserv -v setalsa from /etc/init.d ?
 
Old 11-25-2004, 01:10 PM   #14
Livino
Member
 
Registered: Nov 2004
Location: Belo Horizonte, Brasil
Distribution: Suse Linux 10.0
Posts: 32

Original Poster
Rep: Reputation: 15
Here's what I did:

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".

So I did insserv -r /etc/init.d/rc.alsaset

No go. Now I have two problems instead of one.

HELP!!!!
 
Old 11-25-2004, 07:47 PM   #15
Peacedog
LQ Guru
 
Registered: Sep 2003
Location: Danville, VA
Distribution: Slackware, Windows, FreeBSD, OpenBSD, Mac OS X
Posts: 5,296

Rep: Reputation: 168Reputation: 168
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.?
good luck.
 
  


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
Problem storing ALSA settings on boot shamrock_uk Debian 0 09-10-2005 06:50 AM
Storing sound settings for the secondary audio device? Livino Linux - Hardware 1 11-24-2004 07:07 PM
Storing CFLAGS and other compiler settings in Slackware r_jensen11 Slackware 2 08-12-2004 02:41 PM
no sound from cd player, good sound from audio device test fmickel Linux - Hardware 5 06-04-2004 01:46 PM
Storing xvidtune settings? r_jensen11 Slackware 2 02-17-2004 08:01 AM


All times are GMT -5. The time now is 04:54 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