2009-06-06

Killing the console bell on Jaunty?

Every once in a while, rewrites in ALSA drivers or in desktop audio components (GNOME mixer or Gstreamer) result in an impossibility to completely mute the console bell. Until recently, ALSA offered a separate channel to control this. Since Jaunty (kernel 2.6.28, ALSA 1.0.18r3) came out, not anymore. As such, I was wondering how else could I mute the console bell?

Some people on Ubuntu Forum suggested blacklisting the pc-spkr kernel module, but this is entirely the wrong approach, as it completely kills sound output on this laptop's built-in speakers. I don't wanna completely lose sound support, I just wanna get rid of that annoying console bell!

Others recommended setting set bell-style none in /etc/inputrc but that only works for interactive shells. The console bell still rings e.g. whenever rebooting, probably because bash gets called as a non-interactive shell by init scripts. Actually, since Jaunty, restarting the system makes the bell ring not just once, but twice!

Can anyone think of any more permanent way of disabling the console bell in some global system setting?

3 comments:

Alexander E. Patrakov said...

On reboot, the speaker beeps because the "shutdown" program echoes the 0x07 character to /dev/console. See src/dowall.c in sysvinit source. I.e., this is hardcoded and cannot be changed without recompilation.

Blacklisting the pcspkr module is the right solution. And maybe you want to use snd-pcsp instead - it will present your PC speaker as a second sound card with the separate "mute" switches for console beeps and PCM-based tunes, very handy for ringtones if you use a softphone.

The fact that removing the pcspkr module mutes the laptop speakers for you is a bug in ALSA (most probably, in the snd-hda-intel driver) that has to be reported upstream and not worked around. Or maybe it is already fixed in the latest -rc kernel.

schmichael said...

Why oh why aren't these beeps disabled by default? Has any other OS used the PC speaker in the last 10 years?

Its really embarrassing when showing a fresh install of Linux to friends/family/coworkers and it emits a circa-1990 BEEP.

Vince said...

have you tried "setterm -blength 0"
if that works, just put this in /etc/profile, or something like that