[snap] Firefox Narrator stopped working after upgrade from 20.04 to 22.04

Bug #1987979 reported by Benjamin Tegge
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mozilla Firefox
Fix Released
Unknown
firefox (Ubuntu)
In Progress
High
Unassigned

Bug Description

I just noticed that the narrator feature, which reads articles out load with TTS in Firefox reading view stopped working after upgrading to 22.04. Another user reported the same problem on ask Ubuntu:

https://askubuntu.com/questions/1418391/no-tts-voices-on-firefox-v102-0-after-upgrading-to-ubuntu-22-04-lts

Also, if you have no clue what this is about: https://askubuntu.com/questions/953509/how-can-i-change-the-voice-used-by-firefox-reader-view-narrator-in-ubuntu

---

1)

$ lsb_release -rd
Description: Ubuntu 22.04.1 LTS
Release: 22.04

2) Firefox is a snap now, but I guess for the feature to work it needs to detect TTS which is packaged as deb.

$ snap list firefox
Name Version Rev Tracking Publisher Notes
firefox 104.0-3 1749 latest/stable mozilla✓ -

$ apt-cache policy espeak speech-dispatcher-espeak-ng firefox
espeak:
  Installed: 1.48.15+dfsg-3
  Candidate: 1.48.15+dfsg-3
  Version table:
 *** 1.48.15+dfsg-3 500
        500 http://de.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
        100 /var/lib/dpkg/status
speech-dispatcher-espeak-ng:
  Installed: 0.11.1-1ubuntu1
  Candidate: 0.11.1-1ubuntu1
  Version table:
 *** 0.11.1-1ubuntu1 500
        500 http://de.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     0.11.1-1 500
        500 http://de.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
firefox:
  Installed: (none)
  Candidate: 1:1snap1-0ubuntu2
  Version table:
     1:1snap1-0ubuntu2 500
        500 http://de.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
        100 /var/lib/dpkg/status

3) open a website, enter reader mode, click the icon with sound waves and hear the text being read with TTS

4) the icon is missing

---

Edit: I tested Firefox Flatpak and it is also affected, my best guess is that Firefox is not at fault.

Tags: jammy snap
Revision history for this message
In , Olivier Tilloy (osomon) wrote :

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:92.0) Gecko/20100101 Firefox/92.0

Steps to reproduce:

Using the firefox snap, open the devtools console, and enter:

    speechSynthesis.speak(new SpeechSynthesisUtterance("Testing 1 2 3"));

Actual results:

Nothing (no text is being spoken).

Expected results:

speech-dispatcher should be speaking "Testing 1 2 3".

This is a snap-specific issue, speech synthesis works well with an unconfined build of firefox. More details at https://forum.snapcraft.io/t/firefox-snap-speech-dispatcher/6165.

Revision history for this message
In , Release-mgmt-account-bot (release-mgmt-account-bot) wrote :

The [Bugbug](https://github.com/mozilla/bugbug/) bot thinks this bug should belong to the 'Core::Web Speech' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Revision history for this message
In , Lonnen (chris-lonnen) wrote :

original poster notes that this is a snap-specific issue not a speech issue

Revision history for this message
In , Release-mgmt-account-bot (release-mgmt-account-bot) wrote :

The severity field is not set for this bug.
:gerard-majax, could you have a look please?

For more information, please visit [auto_nag documentation](https://wiki.mozilla.org/Release_Management/autonag#workflow.2Fno_severity.py).

Revision history for this message
In , Lissyx+mozillians (lissyx+mozillians) wrote :

I was not even able to get speech synthesis to work in non snap firefox either :)

Revision history for this message
In , Olivier Tilloy (osomon) wrote :

I can confirm it doesn't work for me, neither in the snap nor in the upstream tarball.

Revision history for this message
In , Olivier Tilloy (osomon) wrote :
Revision history for this message
In , Olivier Tilloy (osomon) wrote :

And [a similar issue](https://bugs.launchpad.net/ubuntu/+source/chromium-browser/+bug/1792300) affecting the chromium snap.

Revision history for this message
In , Lissyx+mozillians (lissyx+mozillians) wrote :

After bug 1666703 is fixed, there are still a few roadblocks:
 - we need to add `libspeechd2` as a `stage-packages` component in the firefox snap
 - we need to `prime` `usr/lib/*/libspeechd.so.*`

That is still not enough. By default, communication is done over a socket `$XDG_RUNTIME_DIR/speech-dispatcher/speechd.sock`, granting this would need some snapd interface change.

Experimenting further by forcing `SPEECHD_ADDRESS=inet_socket` (as well as in the configuration file `/etc/speech-dispatcher/speechd.conf`, one still cannot get `speechSynthesis.getVoices()` to return more than an empty array. It looks like `libspeechd2` somehow handles some auto spawning of the daemon, and I assume this is getting blocked by the Snap-level sandboxing.

This can be bypassed by issuing `spd-say -L` aside of a running Firefox, and once you have a process spawn quickly isssuing a `speechSynthesis.getVoices()` to connect to it. Once that is done, Speech Synthesis can work.

Revision history for this message
In , Lissyx+mozillians (lissyx+mozillians) wrote :

Auto spawning seems to simply require the executable to be within the Snap. Ubuntu people suggested we rather rely on socket activation as reported on https://github.com/brailcom/speechd/issues/448. That, in combination with bug 1787245 should be enough.

Paul White (paulw2u)
affects: ubuntu → firefox (Ubuntu)
tags: added: jammy snap
description: updated
Revision history for this message
Olivier Tilloy (osomon) wrote :

This is a known issue, which is being tracked in the upstream bug tracker: https://bugzilla.mozilla.org/show_bug.cgi?id=1729750

summary: - Firefox Narrator stopped working after upgrade from 20.04 to 22.04
+ [snap] Firefox Narrator stopped working after upgrade from 20.04 to
+ 22.04
Changed in firefox (Ubuntu):
importance: Undecided → High
status: New → In Progress
Revision history for this message
Sebastien Bacher (seb128) wrote :

It's being worked on

- https://tracker.debian.org/news/1357468/accepted-speech-dispatcher-0112-1-source-into-unstable/ fixes the service listing no voice by default

- https://github.com/snapcore/snapd/pull/12081 updates the snap permission to be able to talk to the service

- we need to fix the service activation not working from the snap (which can be workarounded by starting speech-dispatcher manually)

Changed in firefox:
status: Unknown → New
Revision history for this message
In , Lissyx+mozillians (lissyx+mozillians) wrote :

According to upstream, some of the problems with socket activation are now fixed. Let's give a new try to this feature.

Revision history for this message
In , Lissyx+mozillians (lissyx+mozillians) wrote :

Nathan or Amin, looks like there has not yet been a release including https://github.com/brailcom/speechd/commit/e7e188f4f118f59f0daa3d53ceece5b3aefcf0d1. Also, we would need this release to be available in `core22` and `core20` ?

Revision history for this message
In , Nathan Teodosio (nteodosio) wrote :

> According to upstream, some of the problems with socket activation are now fixed. Let's give a new try to this feature.

Alexander, even with e7e188 in, I couldn't get the socket activation to actually work[1].

[1] https://github.com/brailcom/speechd/issues/809

Revision history for this message
In , Lissyx+mozillians (lissyx+mozillians) wrote :

Well I was told that it was fixed and pointed to the previous link

Revision history for this message
In , Amin Bandali (bandali) wrote :

Unfortunately I don't have any more information/context around this than what Nathan already provided.

Revision history for this message
In , Nathan Teodosio (nteodosio) wrote :

I tried https://github.com/brailcom/speechd/commit/4fc86d73a87c9e120489b89b43d4e9423b68df4f and that seems to have solved the problem here!

Revision history for this message
In , Nathan Teodosio (nteodosio) wrote :

For your information, if trying this in a snap, make sure to supply a correct XDG_RUNTIME_DIR as that seems to be modified by snapcraft or snapd.

Namely, in a `snap run --shell {snap-name-with-spd}`, this fails:

```
$ spd-say bye
Failed to connect to Speech Dispatcher:
Error: Can't connect to unix socket /run/user/1000/snap.geheim/speech-dispatcher/speechd.sock: No such file or directory. Autospawn: Autospawn failed. Spawn error 8: Failed to execute child process “/usr/bin/speech-dispatcher” (No such file or directory)
```

but this works:

```
$ XDG_RUNTIME_DIR=/run/user/1000 spd-say bye
```

Revision history for this message
In , Lissyx+mozillians (lissyx+mozillians) wrote :

So I had a look and I'm a bit lost on the packaging differences and how it interacts with snap to hack that. Do you have some PPA or something else with an uptodate deb of `speech-dispatcher` to build a snap?

Revision history for this message
In , Nathan Teodosio (nteodosio) wrote :

I built the patched speech-dispatcher in a PPA[1] and then a snap[2] with spd-say to test

After installing them,

systemctl start --user speech-dispatcher.socket
snap run --shell geheim
$ XDG_RUNTIME_DIR=/run/user/1000 spd-say hi

[1] https://launchpad.net/~nteodosio/+archive/ubuntu/rebuilds/+build/26035882
[2] https://launchpad.net/~nteodosio/+snap/test-speechd/+build/2103550

Revision history for this message
In , Lissyx+mozillians (lissyx+mozillians) wrote :

(In reply to Nathan Teodosio :nteodosio from comment #18)
> I built the patched speech-dispatcher in a PPA[1] and then a snap[2] with spd-say to test
>
> After installing them,
>
> systemctl start --user speech-dispatcher.socket
> snap run --shell geheim
> $ XDG_RUNTIME_DIR=/run/user/1000 spd-say hi
>
> [1] https://launchpad.net/~nteodosio/+archive/ubuntu/rebuilds/+build/26035882
> [2] https://launchpad.net/~nteodosio/+snap/test-speechd/+build/2103550

Thanks but this is not working for me. I dont see in https://git.launchpad.net/~nteodosio/+git/geheim/tree/snapcraft.yaml where you added your PPA reference.
```
package-repositories:
  - type: apt
    ppa: nteodosio/rebuilds
```

When I do I hit this error `E: The repository 'http://ppa.launchpad.net/nteodosio/rebuilds/ubuntu focal Release' does not have a Release file.` which makes sense since the `rebuilds` PPA targets `mantic` serie.

Revision history for this message
In , Nathan Teodosio (nteodosio) wrote :

(In reply to Alexandre LISSY :gerard-majax from comment #19)
> (In reply to Nathan Teodosio :nteodosio from comment #18)
> > I built the patched speech-dispatcher in a PPA[1] and then a snap[2] with spd-say to test
> >
> > After installing them,
> >
> > systemctl start --user speech-dispatcher.socket
> > snap run --shell geheim
> > $ XDG_RUNTIME_DIR=/run/user/1000 spd-say hi
> >
> > [1] https://launchpad.net/~nteodosio/+archive/ubuntu/rebuilds/+build/26035882
> > [2] https://launchpad.net/~nteodosio/+snap/test-speechd/+build/2103550
>
> Thanks but this is not working for me. I dont see in https://git.launchpad.net/~nteodosio/+git/geheim/tree/snapcraft.yaml where you added your PPA reference.
> ```
> package-repositories:
> - type: apt
> ppa: nteodosio/rebuilds
> ```
>
> When I do I hit this error `E: The repository 'http://ppa.launchpad.net/nteodosio/rebuilds/ubuntu focal Release' does not have a Release file.` which makes sense since the `rebuilds` PPA targets `mantic` serie.

When you say "it's not working", do you mean that the recipe I proposed is not working, or that you did not attempt it as proposed since you couldn't find the PPA reference in the snapcraft.yaml of the snap?

The PPA doesn't need to be in the snap, only in the host, as in the latter is the socket and the service to be activated via that socket.

Revision history for this message
In , Lissyx+mozillians (lissyx+mozillians) wrote :

I say it's not working because I was assuming I need to use the PPA within the snap build itself, and as stated there's only a `mantic` release. I will probably have to rebuild from your ppa anyway because my test VM is running `22.04`.

dont we risk having different versions of speech-dispatcher between host and snap and potential weird bugs? And when you say `host` you do refer to the one where we install the snap, not the host used for building, right?

Revision history for this message
In , Nathan Teodosio (nteodosio) wrote :

> dont we risk having different versions of speech-dispatcher between host and snap and potential weird bugs?

Since the patch would have to be backported to Jammy first so that Firefox could pick it up (I assume we wouldn't want it's snapcraft.yaml to pick up stuff from a PPA), I thought that a positive result with that proposed test case would be OK, but you do have a fair point.

> And when you say host you do refer to the one where we install the snap, not the host used for building, right?

Yes, sorry for the lack of clarity there.

Revision history for this message
In , Lissyx+mozillians (lissyx+mozillians) wrote :

So this will require `0.11.4-2ubuntu1` package (currently in `mantic-proposed`, I did rebuild myself for `jammy`) to be backported, but I am happy to say it seems to work. Requires a reboot for the systemd socket activation to be active by default, otherwise user needs to `systemctl start --user speech-dispatcher.socket` as mentionned earlier.

Revision history for this message
In , Lissyx+mozillians (lissyx+mozillians) wrote :

Created attachment 9334560
GitHub Pull Request

Revision history for this message
In , Lissyx+mozillians (lissyx+mozillians) wrote :

Created attachment 9335252
GitHub Pull Request (core22)

Revision history for this message
In , Lissyx+mozillians (lissyx+mozillians) wrote :

SRU is under review, PR was merged, we can close this. Reopen if there's a problem and the SRU does not make it ?

Changed in firefox:
status: New → Fix Released
Revision history for this message
Tarek Loubani (tareko) wrote :

Could you give more details on where this was fixed? I have an up to date 23.04 and this is not working as of right now. Both ubuntu apt and snap are fully up to date.

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.