Page 1 of 2

[Donion] [1.1.62] update broke audio on linux

Posted: Tue Jul 26, 2022 5:48 pm
by Fiorra
Hello,

after updating to 1.1.62, I was greeted with "Audio Error" - "Couldn't initialize audio. Audio is disabled." It worked fine right before the upgrade.

tl;dr: it looks like the switch to sdl_mixer changed the default audio backend from pulseaudio to alsa, which broke on my system due to a missing configuration file.

Though I managed to solve it for me, I'm posting this anyway because
  • this is an undocumented change, and a regression for some. Whether that's an acceptable side effect or not, the devs should be aware that it's happening.
  • documenting it may help the next person running into this issue.
  • as always, the error messages could be improved.
  • Twinsen asked us to
The logs confirm the error, but have no further insights:
0.178 Warning SoundInterfaceSDL.cpp:37: Installing audio failed (backend:sdl, depth:16, freq:44100) retrying...
0.679 Warning SoundInterfaceSDL.cpp:37: Installing audio failed (backend:sdl, depth:16, freq:44100) retrying...
1.181 Warning SoundInterfaceSDL.cpp:37: Installing audio failed (backend:sdl, depth:16, freq:44100) retrying...
1.683 Warning SoundInterfaceSDL.cpp:37: Installing audio failed (backend:sdl, depth:16, freq:44100) retrying...
2.185 Warning SoundInterfaceSDL.cpp:37: Installing audio failed (backend:sdl, depth:16, freq:44100)
When I change the audio backend to allegro in the hidden settings it works. default, allegro-via-sdl and sdl do not.

Reading the changelog, I tried installing the packages sdl_mixer and sdl2_mixer (arch linux), but those didn't help.

More or less by accident, I managed to find some additional output on stderr (which didn't appear in the log files):
ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave
While it doesn't give a reason for the failure (device busy? device not found?), this looked suspicious - is it trying to connect to a hardware pcm instead of pulseaudio? It looks like it does - installing the pulseaudio-alsa package would configure the default alsa device to use pulseaudio. Now audio works again with all backends.

Not sure if this is PEBKAC for my broken alsa configuration or a legitimate regression for changing the default backend. You decide.

Re: [1.1.62] update broke audio on linux

Posted: Tue Jul 26, 2022 6:05 pm
by Donion
Fair point about not stating which driver is used on Linux.
Me being a Linux noob, after testing three different Linux setups that worked out of the box with pulseaudio-alsa and pipewire-alsa configurations, I thought it won't be such an issue.
I'll post the driver info in the Release news post at least.

And thank you for your report.

Re: [1.1.62] update broke audio on linux

Posted: Tue Jul 26, 2022 7:57 pm
by Nosferatu
Just wanted to report that not all is broken
It did work out of the box on fedora 36
Here it's using PipeWire ALSA

Installed version: pipewire-alsa.i686 0.3.53-4.fc36

Re: [1.1.62] update broke audio on linux

Posted: Wed Jul 27, 2022 4:51 pm
by Syloeh
It doesn't work on windows either.

https://www.reddit.com/r/factorio/comme ... g_to_1162/
https://youtube.com/watch?v=zG30fbNDCws

So,... HELP. I don't understand.

Re: [1.1.62] update broke audio on linux

Posted: Wed Jul 27, 2022 5:51 pm
by johnLate
As already mentioned in the other thread: If you're using pipewire but have used pulseaudio in the past, try uninstalling pulseaudio-alsa if that is still lying around (and maybe install pipewire-alsa).

Re: [1.1.62] update broke audio on linux

Posted: Fri Aug 05, 2022 8:34 am
by Donion
With 1.1.63 going forward, there is a PulseAudio driver for the SDL audio backend. This should make the audio work for more configurations out of the box.

Re: [Donion] [1.1.62] update broke audio on linux

Posted: Fri Aug 05, 2022 5:24 pm
by Merssedes
After update from 1.1.61 to 1.1.65 got two issues: missing audio and hanging on exit.
Log attached.
ALSA, pulseaudio, pipewire packages in the system:

Code: Select all

$ dpkg -l | grep 'alsa'
ii  alsa-base                                                   1.0.25+dfsg-0ubuntu5                  all          ALSA driver configuration files
ii  alsa-topology-conf                                          1.2.2-1                               all          ALSA topology configuration files
ii  alsa-ucm-conf                                               1.2.2-1ubuntu0.13                     all          ALSA Use Case Manager configuration files
ii  alsa-utils                                                  1.2.2-1ubuntu2.1                      amd64        Utilities for configuring and using ALSA
ii  gstreamer1.0-alsa:amd64                                     1.16.2-4ubuntu0.1                     amd64        GStreamer plugin for ALSA
$ dpkg -l | grep 'pulseaudio'
ii  gir1.2-cvc-1.0                                              5.2.1+una                             amd64        Introspection data for Cinnamon pulseaudio abstraction
ii  gstreamer1.0-pulseaudio:amd64                               1.16.2-1ubuntu2.1                     amd64        GStreamer plugin for PulseAudio
ii  libcvc-dbg:amd64                                            5.2.1+una                             amd64        Cinnamon pulseaudio abstraction library - debug symbols
ii  libcvc0:amd64                                               5.2.1+una                             amd64        Cinnamon pulseaudio abstraction library
ii  pulseaudio                                                  1:13.99.1-1ubuntu3.13                 amd64        PulseAudio sound server
ii  pulseaudio-module-bluetooth                                 1:13.99.1-1ubuntu3.13                 amd64        Bluetooth module for PulseAudio sound server
ii  pulseaudio-utils                                            1:13.99.1-1ubuntu3.13                 amd64        Command line tools for the PulseAudio sound server
$ dpkg -l | grep 'pipewire'
$
Factorio does appear in list of applications in sound settings.

Can post as separate bug if required.

UPD: switching audio backend to "allegro" solves the issue.

Re: [Donion] [1.1.62] update broke audio on linux

Posted: Sat Aug 06, 2022 12:29 pm
by SnelleSjonnie
Similar problem, on linux, updated today from 1.1.61 to 1.1.65.
Nothing suspicious in log file, no popup, just no sound and hanging on exit.

(Am I glad I can do `git revert` :D . )

Re: [Donion] [1.1.62] update broke audio on linux

Posted: Fri Aug 19, 2022 6:02 pm
by Merssedes
As of 1.1.67 "default" sound setting started working correctly (sound present, exit works correctly).

P.S. Is it possible to add to log what actual sound backend loaded?

Re: [Donion] [1.1.62] update broke audio on linux

Posted: Fri Aug 19, 2022 6:22 pm
by Donion
Merssedes wrote:
Fri Aug 19, 2022 6:02 pm
As of 1.1.67 "default" sound setting started working correctly (sound present, exit works correctly).

P.S. Is it possible to add to log what actual sound backend loaded?
Nothing changed on our end regarding audio initialization so I wonder why would it start working now.

Yes, I should do that. In the meantime, if the line with "[Audio]" says "MixerQuality:<something>" at the end, it's Allegro. If there's no quality it's SDL.

Re: [Donion] [1.1.62] update broke audio on linux

Posted: Fri Aug 19, 2022 10:05 pm
by Merssedes

Code: Select all

   0.478 [Audio] Backend:default; Depth:16, Channels:2, Frequency:44100
So It's SDL. No new or updated packages found compared to last time. The only thing changed that I know of is my PC restarted since last post.
I can only guess what caused change... There were bugfixes in 1.1.67 related to audio. It may be updated version of SDL.

Re: [Donion] [1.1.62] update broke audio on linux

Posted: Sun Aug 21, 2022 7:02 am
by SnelleSjonnie
Tried version 1.1.67, issue remains.
The workaround works fine: put the following line in config.ini.

Code: Select all

audio-backend=allegro

This solves both my issues (no sound + hanging menu quit).

[1.1.68] audio problem on linux

Posted: Mon Aug 29, 2022 4:02 pm
by Grifonice99
After update factorio from 1.161 to 1.1.68 (steam automatic update) it does not play any sound.

Re: [1.1.68] audio problem on linux

Posted: Mon Aug 29, 2022 5:48 pm
by hi117
Same issue, I'll play around with it and see if I can fix it. What I found so far is that pulseaudio recognizes the factorio source, but factorio doesn't push any audio to the source (determned by the sound level bar in pavucontrol).

Re: [1.1.68] audio problem on linux

Posted: Mon Aug 29, 2022 5:57 pm
by hi117
I found a temporary fix. Switching the audio sink to another sink and back fixes audio, but it has to be done on every restart of the game.

Re: [1.1.68] audio problem on linux

Posted: Mon Aug 29, 2022 7:04 pm
by mrvn
I don't get any jingle at start but sound in game works for me.

Update: sound is set to allegro so that explains it working. But when did the jingle on the splash screen disappear?

Re: [1.1.68] audio problem on linux

Posted: Mon Aug 29, 2022 9:38 pm
by Donion
Grifonice99 wrote:
Mon Aug 29, 2022 4:02 pm
After update factorio from 1.161 to 1.1.68 (steam automatic update) it does not play any sound.
Hi, can you post a recent log?
hi117 wrote:
Mon Aug 29, 2022 5:57 pm
I found a temporary fix. Switching the audio sink to another sink and back fixes audio, but it has to be done on every restart of the game.
Interesting, you're the first to find a workaround like this. What happens if you disable one or the other sink? What audio interfaces are you using? Can you post a recent log?
mrvn wrote:
Mon Aug 29, 2022 7:04 pm
I don't get any jingle at start but sound in game works for me.
Can you post a log as well? Does music play in-game? What is the music volume setting?


As a workaround you can try switching back to Allegro audio backend:
  • Hidden setting: Ctrl + Alt + Click the Settings button => The rest => audio-backend => set to "allegro" and then restart the game.
  • Edit the config.ini: search for audio-backend and change that line to "audio-backend=allegro" (no semicolon at the beginning)
  • Command line option: --audio-driver allegro

Re: [1.1.68] audio problem on linux

Posted: Fri Sep 02, 2022 8:04 pm
by hi117
Donion wrote:
Mon Aug 29, 2022 9:38 pm
hi117 wrote:
Mon Aug 29, 2022 5:57 pm
I found a temporary fix. Switching the audio sink to another sink and back fixes audio, but it has to be done on every restart of the game.
Interesting, you're the first to find a workaround like this. What happens if you disable one or the other sink? What audio interfaces are you using? Can you post a recent log?
I have 5 sinks, so disabling them might be difficult. How should I post logs? Its kinda long, but in case this helps I looked through and there's nothing interesting in there, here's the only audio related line:

Code: Select all

0.132 [Audio] Backend:default; Depth:16, Channels:2, Frequency:44100
I did find some more interesting info though about this issue. When I change the sink when its silent, the audio level jumps really high, as if its playing all the buffered sounds at once. Also if I try to close the game while the issue is happening, it hangs. If I fix it by switching sinks, then the game closes normally immediately after. This points quite heavily to an aduio buffer issue.

Re: [Donion] [1.1.62] update broke audio on linux

Posted: Thu Sep 15, 2022 11:44 pm
by Intangir_V
I just fell into this trap myself

also on linux, i have a pulseaudio setup
never had any issues with factorio before now, never had to find a config or command line option..

but ya my audio died and it froze on exit

the "Hidden setting: Ctrl + Alt + Click the Settings button => The rest => audio-backend => set to "allegro" and then restart the game." workaround worked, but if it still exists and the new default broke so many setups, why is the new default the default at all?

Re: [Donion] [1.1.62] update broke audio on linux

Posted: Fri Sep 16, 2022 2:20 am
by mrvn
That freeze on exit is a long standing problem with pulse audio. The audio thread in factorio blocks and doesn't terminate when you exit the game so the program never exits.

This also happens with you suspend your laptop with factorio running and then try to exit the game (because sound doesn't come back after resume).

I believe this is a problem with pulse blocking when it can't output sound.