# Getting PulseAudio dependency to work in Ubuntu Docker image

**URL:** <https://qa.fmod.com/t/getting-pulseaudio-dependency-to-work-in-ubuntu-docker-image/21897>\
**Category:** FMOD Engine\
**Tags:** unity\
**Created:** [July 19, 2024, 6:19am UTC](https://qa.fmod.com/t/getting-pulseaudio-dependency-to-work-in-ubuntu-docker-image/21897 "2024-07-19T06:19:13Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![joeanderson](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@joeanderson](https://qa.fmod.com/u/joeanderson)\
**Post date:** [July 19, 2024, 6:19am UTC](https://qa.fmod.com/t/getting-pulseaudio-dependency-to-work-in-ubuntu-docker-image/21897/1 "2024-07-19T06:19:13Z")

</div>

I’m trying to get FMOD to work in my Unity game’s CI playmode tests. These tests run in GitHub Actions using [Ubuntu 22.04 Docker images maintained by GameCI](https://github.com/game-ci/docker/blob/main/images/ubuntu/base/Dockerfile).

Using the Docker image as is, I get:

```auto
[FMOD] FMOD_OS_Library_Load : dlopen failed to open 'libpulse.so.0', dlerror = libpulse.so.0: cannot open shared object file: No such file or directory

```

After running `apt-get install libpulse-dev`, I get:

```auto
[FMOD] FMOD_PulseAudio_CheckOutputSupport : pa_context_connect returned -1.

```

I’m not sure how to get past this second error. Does anyone have any ideas for getting PulseAudio to work in a Ubuntu 22 Docker image on GitHub Actions?

GitHub issue on game-ci/docker: [Missing `libpulse.so.0` causes test failure when using FMOD · Issue #249 · game-ci/docker · GitHub](https://github.com/game-ci/docker/issues/249)

---

<div class="post-metadata">

**Author:** ![joeanderson](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@joeanderson](https://qa.fmod.com/u/joeanderson)\
**Post date:** [July 19, 2024, 10:11am UTC](https://qa.fmod.com/t/getting-pulseaudio-dependency-to-work-in-ubuntu-docker-image/21897/2 "2024-07-19T10:11:24Z")

</div>

I haven’t found a solution to fix PulseAudio support in the Docker image yet.

For anyone else who has this issue, the solution I ended up going with is to prevent FMOD from setting the output type to PulseAudio when running the Unity editor in the test environment.

Fixing the output type proved challening, as the PreInitialize hook runs too late to prevent the error. In the end, I used `sed` to modify `RuntimeManager.cs` as part of the GitHub workflow.

```auto
      # PulseAudio does not work in Docker container
      - name: Patch FMOD to disable sound
        run: |
          sed -i'' \
          's/result = coreSystem.setOutput(outputType);/result = coreSystem.setOutput(FMOD.OUTPUTTYPE.NOSOUND);/' \
          Assets/Plugins/FMOD/src/RuntimeManager.cs

```

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [July 24, 2024, 2:51am UTC](https://qa.fmod.com/t/getting-pulseaudio-dependency-to-work-in-ubuntu-docker-image/21897/3 "2024-07-24T02:51:39Z")

</div>

Hi,

Thank you for the information and providing the workaround.

Would it be possible to view the action on GitHub? What version of the FMOD integration are you using? Another user encountered a similar issue: [Docker Windows “DllNotFoundException: fmodstudioL” - #13 by megaleon](https://qa.fmod.com/t/docker-windows-dllnotfoundexception-fmodstudiol/20491/13) it may provide useful information.

---

<div class="post-metadata">

**Author:** ![joeanderson](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@joeanderson](https://qa.fmod.com/u/joeanderson)\
**Post date:** [July 24, 2024, 8:26am UTC](https://qa.fmod.com/t/getting-pulseaudio-dependency-to-work-in-ubuntu-docker-image/21897/4 "2024-07-24T08:26:25Z")

</div>

Hi Connor,

The version of the FMOD integration I’m using is 2.02.23, the latest version from the Unity package manager.

Here’s a minimal GitHub repo I created to demonstrate the first issue (`dlopen failed to open 'libpulse.so.0'`). There are two workflow runs, one of them with FMOD fully enabled (which fails) and one with the FMOD integration patched to disable sound (which passes).

Repo: [GitHub - 12joan/fmod-game-ci-repro: https://github.com/game-ci/docker/issues/249](https://github.com/12joan/fmod-game-ci-repro)  
Workflow run: [Initial commit · 12joan/fmod-game-ci-repro@f1dc80c · GitHub](https://github.com/12joan/fmod-game-ci-repro/actions/runs/10022725817)  
Workflow file: [Initial commit · 12joan/fmod-game-ci-repro@f1dc80c · GitHub](https://github.com/12joan/fmod-game-ci-repro/actions/runs/10022725817/workflow)  
Results: [playmode-results.xml.log](https://qa.fmod.com/uploads/short-url/3t73w41lpCXTSZBYPguyHTapY8Y.log) (3.8 KB) [playmode.log](https://qa.fmod.com/uploads/short-url/vZifvKoE7ucXPMucbaLoRyOJ6Tu.log) (2.3 MB)

Also, here’s a workflow run from my game’s GitHub repo where I’ve [installed `libpulse-dev`](https://github.com/game-ci/unity-test-runner/compare/05a00ef5aced57c6f2d3b8f2a98d2239a1f24c0f...12joan:ci-unity-test-runner:1d95f441c60d048c6bf06ea395c703c528915153#diff-7281a8eb0d31d7677d0cb266f17ec342d462f1bd4baba01764925f35b1f5c9d6) and got the second error (`pa_context_connect returned -1.`). In all other respects this run is equivalent to the one above from the minimal repo.

Workflow run: [Fix: Pathfinding agents can pass through walls · anderbellstudios/pop-pixie@51cacb4 · GitHub](https://github.com/anderbellstudios/pop-pixie/actions/runs/10004145727/job/27652786167)  
Results: [playmode-results.xml.log](https://qa.fmod.com/uploads/short-url/gECA3cxo31URclI4ZwEXOE5H87G.log) (32.1 KB) [playmode.log](https://qa.fmod.com/uploads/short-url/vu5gxpG6EihcevCZswziXSg5GfG.log) (2.6 MB)

Someone on the [GameCI issue](https://github.com/game-ci/docker/issues/249) suggested that I try installing `libpulse0` and `libpulse-mainloop-glib0` in addition to `libpulse-dev`, but I haven’t had time to try this yet unfortunately.

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [July 25, 2024, 6:43am UTC](https://qa.fmod.com/t/getting-pulseaudio-dependency-to-work-in-ubuntu-docker-image/21897/5 "2024-07-25T06:43:49Z")

</div>

Thank you for setting this all up. It was massively helpful. I believe that setting the output to `NOSOUND` is the best solution. It will allow for FMOD to perform all mixing while discarding the final output. It should still allow you to test the FMOD system successfully. [FMOD Engine | Core API reference - FMOD\_OUTPUTTYPE\_NOSOUND](https://fmod.com/docs/2.02/api/core-api-system.html#fmod_outputtype).

Again, thank you for setting this all up and sharing your workaround. A lot of people will find it greatly useful.

---

<div class="post-metadata">

**Author:** ![joeanderson](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@joeanderson](https://qa.fmod.com/u/joeanderson)\
**Post date:** [July 25, 2024, 7:19am UTC](https://qa.fmod.com/t/getting-pulseaudio-dependency-to-work-in-ubuntu-docker-image/21897/6 "2024-07-25T07:19:16Z")

</div>

No problem! It would be great if the FMOD integration could provide a more idiomatic way to prevent the default output type from being initialized using callbacks, so that we don’t have to modify the integration code using `sed`.

For example, if the `PreSystemCreate` hook was exposed as a callback handler and called prior to getting the output type from the current platform, a custom callback could call a method or set a property on the current platform to override its output type. The user code for that would look something like this:

```cs
// Hypothetical solution, does not currently work
public class MyFMODCallbackHandler : FMODUnity.PlatformCallbackHandler {
  public override void PreSystemCreate(FMODUnity.Platform platform) {
    platform.OutputTypeName = "NOSOUND";
  }
}

```

(I added the comment for the benefit of anyone skimming this)

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [July 26, 2024, 5:54am UTC](https://qa.fmod.com/t/getting-pulseaudio-dependency-to-work-in-ubuntu-docker-image/21897/8 "2024-07-26T05:54:08Z")

</div>

Thank you for the suggestion. In theory, it should work. Using your repository, I was able to identify the issue and will pass it on to our development team for further investigation. I’ll post updates here once we have more information.

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [August 21, 2024, 5:24am UTC](https://qa.fmod.com/t/getting-pulseaudio-dependency-to-work-in-ubuntu-docker-image/21897/9 "2024-08-21T05:24:28Z")

</div>

A solution has been found and will be included in an upcoming release.

---

<div class="post-metadata">

**Author:** ![joeanderson](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@joeanderson](https://qa.fmod.com/u/joeanderson)\
**Post date:** [August 21, 2024, 7:13am UTC](https://qa.fmod.com/t/getting-pulseaudio-dependency-to-work-in-ubuntu-docker-image/21897/10 "2024-08-21T07:13:47Z")

</div>

This is great news!

What is the nature of the solution, and is there any action that needs to be taken on the part of the GameCI Docker image or the Unity game itself to ensure that FMOD works correctly in CI?

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [August 21, 2024, 11:05pm UTC](https://qa.fmod.com/t/getting-pulseaudio-dependency-to-work-in-ubuntu-docker-image/21897/11 "2024-08-21T23:05:48Z")

</div>

No, it is an internal change. Rather than returning an error on failing to open the library, it will just log it as FMOD can still initialize successfully in [NOSOUND](https://fmod.com/docs/2.02/api/core-api-system.html#fmod_outputtype:~:text=System%3A%3AgetOutput%20only.-,FMOD_OUTPUTTYPE_NOSOUND,All%20%2D%20Perform%20all%20mixing%20but%20discard%20the%20final%20output.,-FMOD_OUTPUTTYPE_WAVWRITER) mode. So you will not have to make any changes.

---

<div class="post-metadata">

**Author:** ![joeanderson](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@joeanderson](https://qa.fmod.com/u/joeanderson)\
**Post date:** [August 22, 2024, 7:31am UTC](https://qa.fmod.com/t/getting-pulseaudio-dependency-to-work-in-ubuntu-docker-image/21897/12 "2024-08-22T07:31:05Z")

</div>

That’s a neat solution. Thanks for your help!
