System bell completely silent because PulseAudio sample file undefined by default

Bug #769314 reported by Robert Schroll
214
This bug affects 43 people
Affects Status Importance Assigned to Milestone
Unity
Invalid
Undecided
Unassigned
gnome-media (Ubuntu)
Confirmed
Medium
Unassigned
pulseaudio (Ubuntu)
Fix Released
Medium
Unassigned
unity (Ubuntu)
Invalid
Medium
Unassigned

Bug Description

Binary package hint: unity

This bug is about problems using the system bell in Unity or another Compiz-based environment. For problems using the system bell in Ubuntu Classic/Metacity or another Metacity-based environment, please see bug #486154.

The system bell (that beep when you backspace on an empty line on a terminal, i.e.) is badly broken using the Unity environment in the Natty beta 2. By default, no sound is produced, and several misconfigurations make it difficult to produce sound either from the PC speaker or Pulse Audio's module-x11-bell. Not knowing what the desired behavior is, I can't say exactly what needs to be fixed. But the combination of the following issues makes the system quite obviously broken.

1) pcskpr is blacklisted.
The pcspkr module is necessary for the PC speaker to produce sound. It is blacklisted, so regular users cannot turn the bell on. It would be nice for this to be fixed, but the attitudes displayed in #77010 suggest that it won't be. Nonetheless, I note it here because it interacts with some of the following.

2) The X bell volume is set to 0. (no more true in xenial)
As reported by `xset q`, the bell volume is 0 when Unity is started. Both the PC speaker and module-x11-bell respect this setting, so the volume must be turned up (with `xset b on` or `xset b 100`) for either to work. Since both the PC speaker and module-x11-bell are disabled by default, this setting only serves to frustrate attempts to turn them on; it never prevents unwanted sound.

3) module-x11-bell is loaded by /usr/bin/start-pulseaudio-x11
This is a system file, not a user file, so users cannot decide whether they want this module loaded or not. They could write a script to unload the module at login (and hope the module number doesn't vary between boots), but it would be much cleaner to have the modules loaded from a user file, possibly with defaults if the user file doesn't exist.

4) Sample bell.ogg is not loaded.
When module-x11-bell is loaded, it is told to use the sample bell.ogg. But no sample is loaded into Pulse Audio. Thus, module-x11-bell traps system bell events (keeping them from going to the PC speaker) without producing any sound. If module-x11-bell is loaded, the sample it calls on should be loaded as well. (To fix this, run `pactl upload-sample /usr/share/sounds/ubuntu/stereo/bell.ogg bell.ogg`.)

5) gnome-volume-control doesn't.
The "Sound Effects" tab of gnome-volume-control offers to set the volume and sound for system bell events, but these have no effect. This is because gnome-volume-control is trying to control system bells through metacity. Ideally, it should be rewritten to control module-x11-bell instead, but a temporary fix could be to simply disable this tab.

6) System bell settings don't transfer to the Ubuntu Classic environment.
Because that is using metacity, which has it's own set of problems. See bug #486154.

This has been from testing in a VM (virtualbox), but all of these behaviors have also been seen in Compiz in various previous versions of Ubuntu running on various hardware.

I have reported this bug against several components, as it is really an integration issue. The eventual fix may not involve your component, but please do not mark this bug as invalid until we have at least a roadmap for fixing it. Otherwise, I fear responsibility will be passed from component to component without anything being fixed. Rationales:
Unity - As the overarching environment, Unity should be responsible for getting everything integrated. Additionally, some of the problems relate to session startup settings.
Pulse Audio - module-x11-bell is not loaded intelligently or correctly.
Gnome Media - Own gnome-volume-control.

Versions (but note the same behavior has been seen in many earlier versions):
unity: 3.8.10-0ubuntu2
pulseaudio: 1:0.9.22+stable-queue-24-g67d18-0ubuntu3
gnome-media: 2.32.0-0ubuntu7

Tags: patch xenial

Related branches

Revision history for this message
pablomme (pablomme) wrote :

I believe this is an amalgamation of bug #486154 (bad pcspkr beep integration with pulseaudio, roughly) and bug #537703 (pulseaudio bell not triggered from compiz). I'm not sure if you add anything else - you may want to flag this as a duplicate of one of the others, or to specify more clearly what it is exactly that you want fixed.

Revision history for this message
Robert Schroll (rschroll) wrote :

Thanks for the fast reply. As I note in this bug and in bug #486154, that bug is primarily focused on the system bell in Metacity. We did uncover problems under Compiz, but I thought it would be better to split them out into their own bug. This is that bug. Hopefully, unlike #486154, this one is solvable.

Thanks for bringing #537703 to my attention. I remain firmly of the position that Compiz is behaving exactly correctly - window managers should not be mucking about with audio. This is why I specifically did not file this bug against Compiz. I will let #537703 know about this bug, and if they believe a solution to this one is a solution to both, then we can mark one as a duplicate. But if they're looking for a fix to Compiz, then these need to remain separate.

> specify more clearly what it is exactly that you want fixed.

I would like a sensible default for handling the system bell that is easy to customize. We need to decide what that default is before we can figure out what needs to be fixed. This is my attempt to get the relevant parties together to make that decision.

Revision history for this message
Bilal Akhtar (bilalakhtar) wrote :

Doesn't seem to be a Unity bug. Can be reproduced in a Classic Desktop environment as well.

Changed in unity (Ubuntu):
status: New → Invalid
Changed in unity:
status: New → Invalid
Revision history for this message
Robert Schroll (rschroll) wrote :

The same problem does exist in Ubuntu Classic/Compiz, though not in Ubuntu Classic/Metacity. (I had been unaware of the Compiz variant until you pointed it out.) As this is an integration problem, I thought the desktop environment would be a good umbrella organization to organize the response. Is there some "desktop experience" project that would be a better fit?

description: updated
Revision history for this message
Dimitris Kogias (dimitris-k) wrote :

Symptoms look identical to bug 301174. Also, FWIW, the sound preferences tab fails to control volume, but does control muting, of the alert sound after the manual xset and pactl steps from the description are followed.

up to date Natty on Thinkpad, default Ubuntu sound theme.

Revision history for this message
Luke Yelavich (themuso) wrote :

The problem is that compiz does not have anything that talks to libcanberra to play a sound event. The solution here is to write a compiz plugin that listens for the system bell event, and calls libcanberra. I intend to try to put a plugin together in the near future, but if someone beats me to it, I won't be bothered.

Revision history for this message
Robert Schroll (rschroll) wrote :

I'm afraid I still fail to see why the correct solution here is to produce duplicate code in each window manager instead of letting the sound system handle it. But if we must add this functionality to Compiz, please please please give it an off switch.

Thanks.

Revision history for this message
Thomas Hood (jdthood) wrote :

> 5) gnome-volume-control doesn't.
> The "Sound Effects" tab of gnome-volume-control
> offers to set the volume and sound for system bell
> events, but these have no effect. This is because
> gnome-volume-control is trying to control system
> bells through metacity. Ideally, it should be rewritten
> to control module-x11-bell instead, but a temporary
> fix could be to simply disable this tab.

In natty, on the Sound Effects tab there is no control for system bell events. So this part of the report seems fixed.

FYI, on a fresh natty install, as a workaround, to enable beeps (e.g., terminal bells) permanently I created a ~/.xprofile file with:

pactl upload-sample /usr/share/sounds/gnome/default/alerts/glass.ogg bell.ogg
xset b 100

Revision history for this message
Robert Schroll (rschroll) wrote :

> In natty, on the Sound Effects tab there is no control for system bell
> events. So this part of the report seems fixed.

I just updated my Natty VM, and the Sound Preferences dialog still has a "Sound Effects" tab that offers to set the alert sound and volume. I just created a new user, and he has it too, so it's not some hold-over from a previous configuration. Could you have changed some settings to hide this?

Revision history for this message
Thomas Hood (jdthood) wrote :

Yes, there is an "Alert volume" slider with "Mute" button. I didn't realize that you were referring to this when you said "system bell" --- I didn't know that they were the same thing. My apologies. It's true that this slider has no effect on the volume of the sound that gets played when the workaround ("pactl upload-sample..." and "xset b 100") is applied.

Regarding the workaround, I have since discovered that "pactl upload-sample /usr/share/sounds/gnome/default/alerts/glass.ogg bell.ogg" has to go in ~/.xprofile and "xset b 100" has to go in ~/.bashrc.

Revision history for this message
Maxim Samoilenko (maxim-samoilenko) wrote :

On my laptop the bell is also getting muted upon resume.I had to make following /etc/pm/sleep.d script to override that:
case "$1" in
  resume|thaw) { sleep 5; DISPLAY=:0 xset b 100; } & ;;
esac

Is there any more elegant solution for that?

Revision history for this message
Thomas Hood (jdthood) wrote :

"gconf-editor | desktop | gnome | peripherals | keyboard | bell_mode := on" seems to have the same effect as "xset b 50" and is presumably a more general solution.

Revision history for this message
Maxim Samoilenko (maxim-samoilenko) wrote :

Thanks! That's what I was looking for. Works both for startup and resume. Sample upload is still required.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gnome-media (Ubuntu):
status: New → Confirmed
Changed in pulseaudio (Ubuntu):
status: New → Confirmed
Revision history for this message
Paddy Launch (paddylaunch-deactivatedaccount) wrote :

I think I'm suffering from this in 12.04. That is to say, I get no sound when I backspace an empty line in a terminal, and I have set "alert sound" to "Glass" and the Alert volume to maximum. I can hear the sound when selecting it, but I never hear it in use.

Revision history for this message
Paddy Launch (paddylaunch-deactivatedaccount) wrote :

Also, FWIW, when I log in using Gnome Shell instead of Unity *then* I can hear the ("Glass") alert sound from the terminal.

Revision history for this message
Jonas G. Drange (jonas-drange) wrote :

Fresh 12.10 install. Error persist and commands:

pactl upload-sample actual-bell.ogg bell.ogg
xset b 100

must be run both on startup and wake. This is a papercut that cuts deeply for users that depend on the bell (like me).

I will be available for testing.

Revision history for this message
Vladimir Pycha (vpycha) wrote :

The following fixed it for me, in Ubuntu 12.04 Precise, using Gnome Classic/Compiz:

1) Add the following 2 lines to file /etc/pulse/default.pa:

load-sample-lazy bell-windowing-system /usr/share/sounds/ubuntu/stereo/bell.ogg
load-module module-x11-bell sample=bell-windowing-system

2) Run "pulseaudio -k" to restart pulseaudio.

That is, I just followed this post: https://bugzilla.redhat.com/show_bug.cgi?id=607393#c15

Revision history for this message
Hontvári József Levente (hontvari) wrote :

There is still no bell in gterm on Ubuntu 14.04. Workaround in #18 does not help.

Revision history for this message
Hontvári József Levente (hontvari) wrote :

Workaround in #10 does work in Ubuntu 14.04. After applying it, there is a bell sound in gterm.

(#18 is also good, but note that in that example "actual-bell.ogg" must be a path to a real ogg file, while "bell.ogg" seems to be a build-in identifier which must not be touched.)

Daniel Hahler (blueyed)
Changed in pulseaudio (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
Daniel Hahler (blueyed) wrote :

Here is a trivial debdiff for pulseaudio, which uploads the bell.ogg sample.

Changed in pulseaudio (Ubuntu):
importance: Undecided → High
tags: added: patch
Revision history for this message
David D Lowe (flimm) wrote :

I just want to say, what a superbly written bug report, and I hope this gets fixed.

Revision history for this message
Alberto Mardegan (mardy) wrote :

This is still broken in 14.04. The workaround from point #4 fixes the issue for me:

pactl upload-sample /usr/share/sounds/ubuntu/stereo/bell.ogg bell.ogg

Revision history for this message
Nicola Larosa (teknico) wrote :

Some additional information.

In the patch to /usr/bin/start-pulseaudio-x11: http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/wily/pulseaudio/wily/view/head:/debian/patches/0006-load-module-x11-bell.patch

line #9 should say "sample=x11-bell", rather than "sample=bell.ogg".

One additional change is needed to /etc/pulse/default.pa: http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/wily/pulseaudio/wily/view/head:/src/daemon/default.pa.in

line #29 should be uncommented, to load an audio file as a sample named "x11-bell".

Note that line #178 in the same file would use the "x11-bell" sample name: however it should NOT be uncommented, as explained in comments right above. module-x11-bell will be loaded by X running the /usr/bin/start-pulseaudio-x11 command, via /etc/xdg/autostart/pulseaudio.desktop .

Nicola Larosa (teknico)
Changed in pulseaudio (Ubuntu):
status: Triaged → In Progress
Revision history for this message
Michael J. Ford (finlstrm) wrote :

This bug is still present in Ubuntu 14.04 "pulseaudio-module-x11" version "1:4.0-0ubuntu11.1"

Worked around by running the following steps as outline here: https://askubuntu.com/questions/96511/getting-the-pc-speaker-to-beep

1. Load the module pcspkr in /etc/modprobe.d/blacklist.conf (comment it out)
2. Remove the package pulseaudio-module-x11 (that seems to absorb all XBell events)
3. Place options snd-hda-intel beep_mode=2 into /etc/modprobe.d/enable-beep.conf
4. reboot

Revision history for this message
Iiro Laiho (iiro) wrote :

Present in 16.04.

Is the silence of the X11 bell intentional behavior? This is a really weird case. I mean, the bug has been open for longer than half a decade and triaged for a couple of years as well. The fix also is very simple and there are proposed patches.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "debdiff for pulseaudio: upload bell.ogg" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

Iiro Laiho (iiro)
summary: - System bell broken in Natty/Unity (despite heroic...)
+ System bell completely silent because PulseAudio sample file undefined
+ by default
Iiro Laiho (iiro)
tags: added: xenial
description: updated
Changed in pulseaudio (Ubuntu):
importance: High → Medium
Changed in gnome-media (Ubuntu):
importance: Undecided → Medium
Changed in unity (Ubuntu):
importance: Undecided → Medium
Changed in pulseaudio (Ubuntu):
status: In Progress → Confirmed
Revision history for this message
Michael Terry (mterry) wrote :

I've uploaded a version of Daniel Hahler's patch in comment #22 to zesty. Worked for me, I was able to hear the bell in gnome-terminal.

I believe that's the last piece of this puzzle? I'll unsubscribe the sponsors team. Please re-subscribe if there's more to do that is ready to be uploaded.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pulseaudio - 1:10.0-1ubuntu2

---------------
pulseaudio (1:10.0-1ubuntu2) zesty; urgency=medium

  * debian/patches/0006-load-module-x11-bell.patch:
    - Upload bell.ogg sample via pactl for module-x11-bell. Original patch
      by Daniel Hahler. (LP: #769314)
  * debian/control:
    - Add ubuntu-sounds to Suggests list, since it ships the sound used by
      default in above patch now.

 -- Michael Terry <email address hidden> Wed, 29 Mar 2017 14:24:19 -0400

Changed in pulseaudio (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.