Thursday 11 January 2007

how to disable the pcspkr in Etch?

The new laptop I just bought had the bad habit of using the pc speaker at a loud level. It was deranging the coleagues at work when autocompletion yelded more than one result or none (it also scared me a few times during the last nights when I was configuring and testing the laptop).

So I unloaded the module (pcspkr) by hand and wanted to make the system not load it anymore.

So I thought that blacklisting it would do the trick. Probably some people know already that adding al line like:

blacklist pcspkr

in /etc/modprobe.d/blacklist doesn't work. The rest of you find out now. I found out at the next reboot, when I heard again the beep.

Ok, I googled a bit and found some info about restricting ipv6 modules being loaded so I though I could do the same for pcspkr. So I tried:

to change the line from /etc/modprobe.d/pnp-hotplug:

alias pnp:dPNP0800 pcspkr

into

alias pnp:dPNP0800 off

That didn't work either.

So, at this point I googled more and found some outdated information about update-modules.

That brought me to modprobe.conf(5) which pointed to the "right" solution.Write the following in some file in /etc/modprobe.d/ (I added it in blacklist, since it seemed the right place)

install pcspkr true

Which seems to do what I want.



Still something tells me that either:

1) there is a cleaner solution I am not thinking about

or

2) I could have told udev not to load the module... And I feel this solution should have to do something with these lines and "ACTION":

eddy@bounty /etc/udev $ grep -r pcspkr *
persistent-input.rules:DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr"
rules.d/z20_persistent-input.rules:DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr"



A clean solution would be appreciated.

15 comments:

Anonymous said...

If the beep is bothering you during autocompletion put this in your .inputrc file

set bell-style none

it doesn't disable the pcspeaker but it keeps mine quiet 90% of the time

Anonymous said...

Is there are reason why in 2007 the annoying beep is still enabled. I am not asking for removing the feature, it is just disabling it by default. I wonder how many people do really enjoy the beep.

Also, everybody has its own trick to disable it, most of them work half of the time.

Is there no bug for this in Debian?

eddyp said...

If the beep is bothering you during autocompletion

No, is bothering me all the time, GDM, gnome-terminal, whereever it appears is annoying.

Anonymous said...

try /etc/hotplug/blacklist.d/
add any file there including your unwanted modules.
it really works in etch, though you might think this directory may be obsolete, as i thought...

Anonymous said...

Hi, sometime ago i disabled pcspkr by blacklisting it in /etc/modprobe.d with the blacklist command and then running update-initramfs. But since a recent update this doesn not work anymore but i don't know why.

Anonymous said...

someone mentioned it on the plaet recently:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=405523

Anonymous said...

Here's a hardware solution: get the cheapest pair of headphones you can find (usually free), cut off all but the plug, and put it in the headphone jack.

Anonymous said...

My question is: why aren't alias, blacklist and install ALWAYS observed?

We can have: alias ipv6 off, or blacklist ipv6, or install ipv6 /bin/true.

Why aren't the following EQUIVALENT?! alias pcspkr off, or blacklist pcspkr , or install pcspkr /bin/true.

Gee. I'm too old for this $h1t. Rants.

Justin A said...

deleting pcspkr.ko "works" :-)

eddyp said...

deleting pcspkr.ko "works" :-)

Yes, I was thinking to dpkg-divert the module so is named otherwise. The problem is that the pcspkr.ko file will be part of a different package with every linux-image -2.6.x-y package and I have to redo this operation for every kernel version bump. Same goes for deleting.

Also, the dpkg-divert method has the advantage of being kept over new releases of the same linux-image-2.6.x-y. The delete method needs to be hammered at every upgrade.

OTOH, I am not sure if dpkg-divert is fit for this kind of use.

Anonymous said...

Thanks for the nice post!

Anonymous said...

Remove beep = Applications > Debian > Apps > System > Gnome > Gnome Control Centre > Sound > System beep tab

Anonymous said...

easy way, unplug pcspeaker from mobo

Anonymous said...

Had to fight with the same issue in a larger office, and the way I came up with was to simply do
rmmod pcspkr
in /etc/rc.local .
I do have snd-pcsp on 2.6.26.2 (which would be able to disable beep via mixer), however it seems pcspkr takes precedence on boot, via direct in-kernel pnp probing.


IMHO things should be done similar to this on a kernel level:

- a hardware which has a driver available should have it loaded, always
(after all applications / services which do need emergency access to speaker _should_ be able to enable it and access it without having to resort to crude I/O hacks)
- there should be some kind of "disable beep" module option for _both_ pcspkr and snd-pcsp (equally-named!), for clean, easy disabling of beep on boot
(or in fact perhaps do it the other way around, default-disable and provide enable option)
- pcspkr should get a sys or proc file for changing beep configuration dynamically (for those users or services which need to enable it for emergency situations etc.)
- maybe even add a separate special ioctl to those drivers to do beeping _despite_ it being user-disabled (for emergency purposes)

Andreas Mohr

Anonymous said...

Thank you for this solution!
This beep was driving me crazy, but "install pcspkr true" in /etc/modprobe.d/anything solved it.