Eliminate the annoying console beep on GNU/Linux

The console beep is generally unwanted, epsecially if you happen to be wearing headphones when it is emitted

This technical note suggests ways of getting rid of the annoying console beep that is often enabled by default on GNU/Linux systems (for reasons I cannot fathom, since a “bell” ceased to be a useful feature of a console sometime back in the 1970s.

Content revision history:
Article first written, 16th November 2018.

Background information

On openSUSE 42.3 the console “bell” or beep still exists. Whether you ever hear the beep it will depend on how you use the console and what hardware you have. If you happen to hear it through headphones while playing music a bit loudly you probably won't like the experience. Various solutions are proposed around the Internet but often they don't work. This article is an attempt to fill in the gaps, although there are so many variations of computers that you might yet find this article inadequate.

The beep exists as a lingering technological relic. Long-long ago in the 1980s and 1990s personal computers came with a tiny loudspeaker built into the case. This speaker wasn't capable of playing high-quality sounds but it is more than adequate for beep noises and that, really, is all it was ever intended to do. The loudspeaker and the beep performed the role that was performed by the bell on the teletype machines that existed in the 1970s and 1960s.

On contemporary computers (this article was written in 2018) the beep is known to be emitted by two possible routes: Some computers still have a small built-in loudspeaker because this can be useful for power-on self-test notifications. Other computers emit the beep via the general audio system. To be rid of the beep, both emission routes must be disabled or silenced somehow.

Silencing the built-in speaker

There are lots of articles on the Internet regarding this part of the task. Basically their is a kernel module that controls the built-in speaker and the objective is to prevent that module from beuing loaded into the kernel, thereby ensuring that the built-in speaker is never operated by GNU/Linux. Here is a fairly comprehensive article on the ArchLinux web-site: https://wiki.archlinux.org/index.php/PC_speaker

The gist of the matter is that the module can be removed with the following command. There are also various ways of 'blacklisting' the module thereby ensuring that the module is never loaded in the first place.

rmmod  pcspkr

Silencing the beep via the general sound system

If you can hear the beep in your headphones or through the speakers that you use for music, videos and games and whatnot, then the beep is being emitted through the general sound-system, somehow. The trick, therefore, is to tell the general sound-system to ignore any 'beep' signals that it is given.

These instructions apply to GNU/Linux systems on which the sound system is controlled by 'ALSA'; if your computer is using something different than these instructions likely won't work. Feel free to let me know what does work so that this article can be revised.

Note that not all computers that have ALSA do route the beep through ALSA. Some don't, and in that case the following won't be necessary. First, therefore, try to find-out if the beep is being routed through ALSA. To do this use the amixer command as follows:

amixer  scontrols
amixer  controls
                  

The aforegoing two commands will each yield a list of sound devices that ALSA is aware of. Somewhere in those lists you might find references to a beep. On my present computer, the 'scontrols' list includes something called 'Beep' and the 'controls' list includes 'Beep Playback Switch' and 'Beep Playback Volume'. Having identified the labels used for the beep we can now issue some instructions about them. I have a script containing the following lines:

#  Set the beep volume to zero. In practice the beep will still
#  be heard, but quietly.
amixer sset 'Beep' 0%,0%

#  Disable the beep. This line effectively silences the Alsa beep.
amixer cset name='Beep Playback Switch' Off
                  

Attention! The ALSA labels are case-sensitive, so you must use the exact same upper-case and lower-case characters that ALSA reported to you; e.g. 'Beep' not 'beep'. The following also seems to work, and reduces the instructions to a single line:

amixer  sset  'Beep'  0%  mute
                  
Navigation: (site map) learn linux home pagetechnical articles