# Loud 'crack'-noise on shutdown/reboot (alsa)[solved]

## 118947

Hi!

Just a small problem, but annoying none the less.

When I shutdown/reboot my system, I hear a very loud 'cracking' sound coming from my speakers.

Now this 'feedback-cracking' generally is normal,  I can hear my speakers 'cracking' when windows shuts down too, just not as loudly.

As I have an external amplifier connected to my soundcard (old sblive), my mixer settings are set at similar levels in both windows and gentoo(yes, I dual boot)  for normal use. 

So I'm guessing, that for some reason the mixer levels are maxedout just before reboot.

I've used gentoo before (ages ago though still the same hardware...) and other linux distributions, and have never experienced this 'problem'.

I'm using alsa, just pure and simple, no esd, no pulseaudio, no arts. Its all in the kernel (I have no other sound related issues) and oss has been flung out.

Now I seem to remember that alsa has a setting somewhere to 'restore mixer settings on bootup' (which it does...) so it seems feasible that something maybe messing with the mixer level during shutdown... any ideas??Last edited by 118947 on Wed Nov 19, 2008 2:10 am; edited 1 time in total

----------

## avieth

I have that issue on my laptop but it doesn't bother me. Anyways, try muting the PCM control, then shutting down. If the cracking stops, which I suspect it might, then you can create an init script that runs this command:

```

amixer -c 0 set PCM off

```

On shutdown, and add this:

```

amixer -c 0 set PCM on

```

To /etc/conf.d/local.start.

Just a thought.

----------

## 118947

No, does not do the trick.   :Sad: 

I also tried adding 

```
amixer -c 0 set Master off 
```

 with no effect. So it seems its not the mixer levels.

I looked in /var/log/messages, and I found this:

```
Jun 18 20:51:42 ViciousVincent /etc/init.d/xdm[3017]: start-stop-daemon: 1 process refused to stop

Jun 18 20:51:42 ViciousVincent /etc/init.d/xdm[3003]: ERROR: xdm failed to stop

Jun 18 20:51:45 ViciousVincent syslog-ng[1814]: Termination requested via signal, terminating;
```

Which brings me to another (as I thought unrelated issue).

When I log out of xfce, my display manager, slim, pops back up just fine. However, when I restart X with 'ctrl-alt-backspace', slim fails to come back, I'm just jumped back to the first getty or left on getty07 with a blinking cursor.

After adding those commands to /etc/init.d/local.stop, for some reason, when shutting down or restarting I can briefly  see slim, then the system 'blacks out' after about 5secs.

Without the commands in /etc/init.d/local.stop ,  I just get a black screen, and the 'cracking noise' which 'informs' me that my system has in fact gone down/rebooted....

I'm used to getting some kind of feedback when I shutdown my system (messages on the first getty, or something) from other linux distributions, and I can recall gentoo also behaving well in this respect,  but I just get nothing , just that loud crack, which incedently sounds very much like it does when I have to forcefully restart my box under winxp when the system goes out to lunch...

So, maybe I'm getting this cracking, because my box isn't shutting down correctly, not unmounting my disks etc??? Could this be, how can I check?

Is it normal for current gentoo boxes not to display shutdown messages?

----------

## avieth

 *hungrigerhaifisch wrote:*   

> However, when I restart X with 'ctrl-alt-backspace', slim fails to come back, I'm just jumped back to the first getty or left on getty07 with a blinking cursor.

 

This happened to me when I used slim. It's the main reason why I stopped using it in favour of KDM. As far as I know this is a bug.

 *Quote:*   

> I'm used to getting some kind of feedback when I shutdown my system (messages on the first getty, or something) from other linux distributions, and I can recall gentoo also behaving well in this respect,  but I just get nothing , just that loud crack, which incedently sounds very much like it does when I have to forcefully restart my box under winxp when the system goes out to lunch...
> 
> So, maybe I'm getting this cracking, because my box isn't shutting down correctly, not unmounting my disks etc??? Could this be, how can I check?
> 
> Is it normal for current gentoo boxes not to display shutdown messages?

 

Normally Gentoo shows you the shutdown messages. Slim is refusing to die until the system is ready to shut down and the messages have passed, and your monitor is still in X (getty07). Why it won't shut down I can't say. Perhaps another bug? What are the commands that you said you added to local.stop?

----------

## 118947

/etc/init.d/local.stop:

```
amixer -c 0 set Master off 

amixer -c 0 set PCM off
```

There are no other entries. Strange that slim comes back up when there are commands present, but seemingly dies when there are not.

However when I say, 'comes back up', it actuall is defunk (I think) keyboard input does not work... not eben numlock...

EDIT1:

O.k, I checked slim, and yes its a (or maybe more) bug(s)...

http://developer.berlios.de/bugs/?group_id=2663

Which is sad, as I want to use xfce, not gnome (and no kde/kdm)

Installing gdm, without gnome is pretty stupid I think, as it does much more, than I need it to do, and slim (apart from the bugs) fits pretty well...

Are there any other display-managers that are lightweight like slim?

EDIT2:

Ok, for now I've decided to ditch the graphical-login-managers, and I'm now using qingy. Which is rather nice, though it does just crash when I move the mouse around...   :Rolling Eyes: 

The 'cracking Problem' is still present though, but through my experimentation with qingy I've noticed that even when just logged on at a plain simple text console, without X running, I get the 'crack' on shutdown.

So I still haven't found a solution, just a few new problems...but I guess thats the fun part  :Wink: 

----------

## avieth

You could try making XDM look good. You can't ge more desktop-agnostic than XDM itself.

Anyways, back to the issue. You are using the snd-emu10k1 driver, correct? The old sblive cards are great, I'm using one myself and do not experience this pop. I'm using the drivers built in to the 2.6.23-r8 kernel. It's definitely not your speakers or your sound card that are causing the problem, so let's compare settings.

I only have 8 faders active in alsamixer. Master is at 100, Bass at 50, treble at 50, PCM at 71, Center at 100, LFE at 100, Synth at 100 and Wave at 100. Mic select is mic1, and external amplifier is enabled. Everything else is mute.

```

$ cat /etc/conf.d/alsasound

# ENABLE_OSS_EMUL:

# Do you want to enable in-kernel oss emulation?

# no - Do not load oss emul drivers

# yes - Load oss emul drivers if they're found

ENABLE_OSS_EMUL="yes"

# RESTORE_ON_START:

# Do you want to restore your mixer settings?  If not, your cards will be

# muted.

# no - Do not restore state

# yes - Restore state

RESTORE_ON_START="yes"

# SAVE_ON_STOP:

# Do you want to save changes made to your mixer volumes when alsasound

# stops?

# no - Do not save state

# yes - Save state

SAVE_ON_STOP="yes"

# LOAD_ON_START:

# Do you want to load sound modules when alsasound starts?

# no - Do not load modules

# yes - Load modules

LOAD_ON_START="yes"

# UNLOAD_ON_STOP:

# Do you want to unload sound modules when alsasound stops?

# no - Do not unload modules

# yes - Unload modules

UNLOAD_ON_STOP="yes"

```

----------

## 118947

```
cat /etc/conf.d/alsasound 

# ENABLE_OSS_EMUL:

# Do you want to enable in-kernel oss emulation?

# no - Do not load oss emul drivers

# yes - Load oss emul drivers if they're found

ENABLE_OSS_EMUL="yes"

# RESTORE_ON_START:

# Do you want to restore your mixer settings?  If not, your cards will be

# muted.

# no - Do not restore state

# yes - Restore state

RESTORE_ON_START="yes"

# SAVE_ON_STOP:

# Do you want to save changes made to your mixer volumes when alsasound

# stops? 

# no - Do not save state

# yes - Save state

SAVE_ON_STOP="yes"

# LOAD_ON_START:

# Do you want to load sound modules when alsasound starts?

# no - Do not load modules

# yes - Load modules

LOAD_ON_START="yes"

# UNLOAD_ON_STOP:

# Do you want to unload sound modules when alsasound stops?

# no - Do not unload modules

# yes - Unload modules

UNLOAD_ON_STOP="yes"

# KILLPROC_ON_STOP

# Do you want to kill any processes using ALSA when alsasound stops?

# If you are using ALSA modules, leave as yes.

# no - Do not terminate ALSA processes

# yes - Kill running processes using ALSA

KILLPROC_ON_STOP="yes"
```

Did you just omit  that last entry, KILLPROC ?? Apart from that, the config is identical...

I agree, its definatly not my hardware, using ubunt just a few weeks ago (and gentoo a few years ago...) never gave me any 'cracks'...

Jup, I'm using the snd-emu10k1 driver, however I am using it built with the 2.6.25-gentoo-r4 kernel.

My mixer settings are similar, exactly the same fades enabled , just not maxed out, but set at around 74.

----------

## 118947

I'm still having this problem people!?

I want to add here, that I do NOT get this 'cracking noise' when my kernel dies/panics.   :Confused: 

I was playing around with my xorg.conf and provoked a kernel panic resulting in my system having to forcefully restart.

Once via the reset-button.

Once the kernel did restarted my system for me.  :Cool: 

Both times there was no cracking-noise!!

So I think I'm closing in on something...

So far I know this problem to be:

- Not X related, it happens even when just logged in at a text-console (and no X running) and then shutting down.

- Not /etc/conf.d/alsasound related. Playing around there changed nothing.

- Not mixerlevels related (so it seems): I tried muting them during shutdown, without success. This is strange, especially when a forced restart fails to produce this loud cracking(with mixerlevels at whatever they were when it happened), when a 'proper restart' does do so(even with all mixers muted via /etc/conf.d/local.stop)

So, any brilliant ideas anyone   :Question: 

----------

## avieth

Does stopping the alsasound process result in a crack?

/etc/init.d/alsasound stop

----------

## 118947

Yes, but only a very quiet one  :Smile: 

Pretty acceptable...

For some strange reason, it also reset my gtk-theme and icon-theme whilest running xfce   :Shocked: 

But

```
/etc/init.d/alsasound start
```

results in a very loud crack, just like when shutting down the system...

This is the output:

```
$ sudo /etc/init.d/alsasound stop

 * WARNING: you are stopping a boot service

 * Storing ALSA Mixer Levels ...                                         [ ok ]

 * Killing processes using ALSA ...                                      [ ok ]

 * Unloading ALSA modules ...                                            [ ok ]
```

and

```
$ sudo /etc/init.d/alsasound start

 * Loading ALSA modules ...

 *   Could not detect custom ALSA settings.  Loading all detected alsa drivers.

 *   Loading: snd_bt87x ...                                              [ ok ]

 *   Loading: snd_emu10k1 ...                                            [ ok ]

 *   Loading: snd_intel8x0 ...                                           [ ok ]

 *   Loading: snd_intel8x0m ...                                          [ ok ]

 *   Loading: snd-mixer-oss ...                                          [ ok ]

 *   Loading: snd-pcm-oss ...                                            [ ok ]

 *   Loading: snd-seq-oss ...                                            [ ok ]

 *   Loading: snd-emu10k1-synth ...                                      [ ok ]

 *   Loading: snd-seq-midi ...                                           [ ok ]

 * Restoring Mixer Levels ...                                            [ ok ]
```

In case you're wondering, the bt87x is from my tv-card, which I've had for ages...

----------

## avieth

So, in theory, if you remove alsasound from all runlevels, restart your machine, then shut it down, you should hear no crack. Is this the case?

----------

## 118947

Yes, you're right. The cracks gone.

So now we know, somewhere, alsa-userland is on 'crack'...   :Confused: 

----------

## avieth

You probably specified already, but do you use the kernel drivers for ALSA? Or the alsa-driver package?

Perhaps you should try the latest driver. Using alsa-driver is much easier, since it doesn't require a kernel upgrade.

----------

## 118947

I use the kernel modules.

They remain loaded even without loading alsasound during boot, and the crack was gone.

Only when alsasound gets loaded do I get the 'crack'.

I've always prefered the kernel-modules over the driver-package, and never had such 'troubles'...

----------

## 118947

The problem went away with the passing of the 2.6.26 kernel.

The 2.6.27 doesn't suffer this problem any longer..so I guess it lay somewhere with the alsa kernel driver, oh well...

 :Rolling Eyes: 

----------

