Page 1 of 2

[Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Posted: Tue Jul 26, 2022 7:12 pm
by Amarula
Donion wrote: Tue Jul 26, 2022 4:10 pm In the meantime it's possible to switch back to the previous Allegro audio backend.
Ctrl-Alt-Click settings => The rest => audio-backend => set to "allegro" and then restart the game. Or you can edit the config.ini, search for audio-backend and change that line to "audio-backend=allegro" (no semicolon at the beginning).
No sound on updating to the new version. I switched back following these directions - thanks for quickly providing a workaround! When I went to restart, the game froze. The log file attached shows only user quit. Everything fine when I started a fresh instance.

Re: [1.1.62] game freeze reverting audio to allegro on linux

Posted: Tue Jul 26, 2022 9:27 pm
by johnLate
I also had this issue:

When factorio 1.1.62 is launched with default audio backend on Linux (kernel 5.18.14-arch1-1, pipewire 1:0.3.56-1), I have no audio at all and after clicking "Exit" in the main menu, the game freezes while the Exit button is still pressed.

Code: Select all

  32.091 Quitting: user-quit.
^C 205.331 Received SIGINT, shutting down
^C 230.117 Received second SIGINT, terminating immediately
Otherwise no suspicious messages about audio or other issues. Excerpt:

Code: Select all

$ grep -i 'audio\|sound' factorio-current.log
   0.143 [Audio] Backend:default; Depth:16, Channels:2, Frequency:44100
   2.303 Loading sounds...
Running with strace and clicking "Exit": it stops at

Code: Select all

futex(0x7f8f63fff910, FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME, 13046, NULL, FUTEX_BITSET_MATCH_ANY
(launching with audio-backend=allegro fixes both audio output and the freeze)

Re: [1.1.62] game freeze reverting audio to allegro on linux

Posted: Tue Jul 26, 2022 10:11 pm
by Donion
Amarula, are you using pulseaudio or pipewire (or something else)? Do you have pulseaudio-alsa or pipewire-alsa package installed?

johnLate, do you have pipewire-alsa installed?

Re: [1.1.62] game freeze reverting audio to allegro on linux

Posted: Tue Jul 26, 2022 11:23 pm
by johnLate
Donion wrote: Tue Jul 26, 2022 10:11 pm johnLate, do you have pipewire-alsa installed?
When updating to 1.1.62 I didn't have it, but before posting on this thread I installed it (and upgraded all other packages and did a reboot). The behavior was the same for {factorio 1.1.62 with a slightly older pipewire and no pipewire-alsa} and {factorio 1.1.62 with current pipewire and pipewire-alsa}. Playing videos with mpv --audio-device=alsa works.

Wild guess: maybe there is some locking issue completely blocking the(?) audio thread?

Re: [1.1.62] game freeze reverting audio to allegro on linux

Posted: Tue Jul 26, 2022 11:29 pm
by johnLate
Btw. factorio does show up in pavucontrol (still use it as mixer, even though I have moved from pulse to pipewire some time ago) in the playback tab with an alsa-comment, just like mpv --audio-device=alsa, but factorio doesn't output any sound (but mpv does).

Re: [1.1.62] game freeze reverting audio to allegro on linux

Posted: Tue Jul 26, 2022 11:50 pm
by johnLate
I just tried it on the steam deck as well (unmodified steam deck OS): no audio + freeze when trying to exit (have to force close factorio from the steam menu).

Re: [1.1.62] game freeze reverting audio to allegro on linux

Posted: Wed Jul 27, 2022 11:58 am
by johnLate
It just occurred to me: the title of this bug report should probably be changed. The freeze has nothing to do with changing the audio backend using ingame menus, it's the result of having started the game with the new default backend.

Re: [1.1.62] game freeze reverting audio to allegro on linux

Posted: Wed Jul 27, 2022 12:11 pm
by Amarula
Donion wrote: Tue Jul 26, 2022 10:11 pm Amarula, are you using pulseaudio or pipewire (or something else)? Do you have pulseaudio-alsa or pipewire-alsa package installed?
Pulseaudio and pipewire seem to be installed only on Steam; this error occurred when I was playing from direct install so I am guessing something else (sorry not an expert on sound stuff). No alsa for either package found.

Re: [1.1.62] game freeze on quit after starting with new default sound - wasreverting audio to allegro on linux

Posted: Wed Jul 27, 2022 5:47 pm
by johnLate
I fixed it on my desktop system with arch linux! TLDR: If you use pipewire make sure you uninstall any old "pulseaudio-alsa" package (but maybe install pipewire-alsa).

I was using pulseaudio in the past but switched to pipewire some time ago. Package "pulseaudio" was already removed, but I still had "pulseaudio-alsa" installed. After uninstalling "pulseaudio-alsa" (and a reboot) sound and exiting works now in factorio with 3 out of 4 possible settings for audio-backend (default, sdl, allegro) (allegro-via-sdl compains about being unable to initialize audio, but exiting works).

Maybe factorio or SDL got confused by some old config files?

I have no idea if it's the same / a similar cause on the steam deck.

Re: [1.1.62] game freeze on quit after starting with new default sound - wasreverting audio to allegro on linux

Posted: Wed Jul 27, 2022 6:01 pm
by Donion
johnLate wrote: Wed Jul 27, 2022 5:47 pm I fixed it on my desktop system with arch linux! TLDR: If you use pipewire make sure you uninstall any old "pulseaudio-alsa" package (but maybe install pipewire-alsa).
That's a great piece of information!
johnLate wrote: Wed Jul 27, 2022 5:47 pm I have no idea if it's the same / a similar cause on the steam deck.
I did some testing on steam deck today (latest beta update) and I can replicate the issue when using steam. If I use a standalone debug build in desktop mode, the audio works normally. I will do some more digging into what packages are installed there.

Also, in the next release I'm adding pulseaudio driver for the SDL backend.

Re: [1.1.62] game freeze on quit after starting with new default sound - wasreverting audio to allegro on linux

Posted: Wed Jul 27, 2022 9:05 pm
by Fiorra
I got a different take on these symptoms: I'm playing along as usual, when suddenly the audio goes silent. I saved my game, tried to restart, and then I got the same hang: "Quitting: user-quit." is the last line, double ctrl-c to quit.

Any other game session, audio worked nicely and exiting worked as expected.

A while earlier, there was a message on stderr
ALSA lib pcm.c:8568:(snd_pcm_recover) underrun occurred
but since that line wasn't timestamped, I'm not sure if it coincides with the audio disappearing.

Running archlinux with pulseaudio, pulseaudio-alsa is installed, factorio default audio backend, no SDL_* variables set.

I'll keep an eye on it to see if it happens again. If it does, I'll report back and try allegro.

/edit: it happened again. There was another underrun, but it was minutes before the audio stopped, so probably unrelated.

Re: [1.1.62] game freeze on quit after starting with new default sound - wasreverting audio to allegro on linux

Posted: Wed Jul 27, 2022 9:23 pm
by Donion
Fiorra wrote: Wed Jul 27, 2022 9:05 pm
ALSA lib pcm.c:8568:(snd_pcm_recover) underrun occurred
but since that line wasn't timestamped, I'm not sure if it coincides with the audio disappearing.

Running archlinux with pulseaudio, pulseaudio-alsa is installed, factorio default audio backend, no SDL_* variables set.

I'll keep an eye on it to see if it happens again. If it does, I'll report back and try allegro.
I've seen this error when testing with slightly older version of pipewire, which went away after an update (not only pipewire was updated so I'm not sure what exactly was the problem). Are you up to date with your pulseaudio and/or alsa (and your system overall)? Can you post versions of pulseaudio, alsa and related packages you are running currently?
I appreciate any information.

Re: [1.1.62] game freeze on quit after starting with new default sound - wasreverting audio to allegro on linux

Posted: Wed Jul 27, 2022 10:11 pm
by Fiorra
Donion wrote: Wed Jul 27, 2022 9:23 pm I've seen this error when testing with slightly older version of pipewire, which went away after an update (not only pipewire was updated so I'm not sure what exactly was the problem). Are you up to date with your pulseaudio and/or alsa (and your system overall)? Can you post versions of pulseaudio, alsa and related packages you are running currently?
I appreciate any information.
It's archlinux, they usually track upstream pretty closely. My system is up to date.
~> pacman -Ss pulseaudio | grep installed
extra/plasma-pa 5.25.3-1 (plasma) [installed]
extra/pulseaudio 16.1-1 [installed]
extra/pulseaudio-alsa 1:1.2.7.1-1 [installed]
multilib/lib32-libpulse 16.1-1 [installed]
~> pacman -Ss alsa | grep installed
extra/alsa-card-profiles 1:0.3.56-1 [installed]
extra/alsa-lib 1.2.7.2-1 [installed]
extra/alsa-plugins 1:1.2.7.1-1 [installed]
extra/alsa-topology-conf 1.2.5.1-1 [installed]
extra/alsa-ucm-conf 1.2.7.2-1 [installed]
extra/alsa-utils 1.2.7-1 [installed]
extra/pulseaudio-alsa 1:1.2.7.1-1 [installed]
multilib/lib32-alsa-lib 1.2.7.2-1 [installed]
Something (kde?) pulls in these, but pipewire isn't running:
~> pacman -Ss pipewire | grep installed
extra/pipewire 1:0.3.56-1 [installed]
extra/wireplumber 0.4.11-2 [installed]
~> uname -a
Linux $hostname 5.18.14-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 23 Jul 2022 11:46:17 +0000 x86_64 GNU/Linux
Also see my edit of my previous post: it happened again and I'm trying allegro now.

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Posted: Fri Aug 05, 2022 8:22 am
by Donion
With 1.1.63 there is a PulseAudio driver for the SDL audio backend. This should make the audio work for more configurations out of the box.
So far, the only setup I was able to reproduce this issue exactly as described was the Steam deck and it works there now (at least on my Steam Deck, latest beta channel).

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Posted: Sat Aug 06, 2022 10:43 pm
by johnLate
Did a short test on my Steam Deck, everything seems to work fine now (Audio + Exiting).
(System Update Channel: Stable and Factorio 1.1.65)

[1.1.65] Unable to quit game

Posted: Sat Aug 06, 2022 11:20 pm
by sitting.duc
Hello,

About 420 hours into a heavily modded Bob-Angel run, and for the past few versions (since 1.1.60?) I have been unable to quit the game. And not because it is addictive, the quit button does not work. And adding or removing mods and then clicking 'continue' also does nothing, the game is sitting there no longer responding to inputs and I have to close the application using the OS tools.

1.1.65, Linux, dozens of mods installed, etc.

To demonstrate, I don't need to load a save or anything, just start the game and immediately try to 'Exit' from the main menu.

I had a look at the current factorio log and threw a copy on pastebin: modded log file https://pastebin.com/6UWgX1Yi, but I don't see anything obvious: the last line just says 'Quitting', and then nothing.

Next step is to disable all the mods and see if it still demonstrates...

Edit:
Restart after disabling all mods, went into the mod list and verified only 'base mod' has a tick, and then attempted to 'Exit' and it still demonstrates. So it is (probably) not the mods.
Clean start log file: https://pastebin.com/cGPxKfPd

System status:
  • Linux sunrise 4.15.0-189-generic #200-Ubuntu SMP Wed Jun 22 19:53:37 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
  • Ubuntu 18.04.6 LTS
  • Nvidia driver is version 390, apparently.
  • i7-4810MQ Haswell CPU
  • nvidia GeForce GTX 870M
(you know, I bet all that is in the log already)
(something tells me it might be time to update this pc)

Merged...

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Posted: Sun Aug 07, 2022 4:37 am
by sitting.duc
So for my scenario, "Factorio: Simple DirectMedia Layer" does show up in pavucontrol.

The log only shows

Code: Select all

0.650 [Audio] Backend:default; Depth:16, Channels:2, Frequency:44100
I did have an argument with apt about pulseaudio earlier this year, but I thought I had factorio exit correctly at least once since I resolved it.
I normally have sound wound down to not annoy people in the room, so I can't actually tell if factorio is making sound...

I will ask apt/aptitude if I have anything weird with pulseaudio

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Posted: Sun Aug 07, 2022 9:52 am
by Donion
sitting.duc wrote: Sun Aug 07, 2022 4:37 am So for my scenario, "Factorio: Simple DirectMedia Layer" does show up in pavucontrol.
Could you try using the Allegro audio backend (it also has both PulseAudio and ALSA driver) and check how Factorio shows up in pavucontrol? I wonder which driver it uses.

Does 1.1.62 with default audio backend (ALSA driver only) have the same problem?
You can also force the ALSA driver for 1.1.63 and newer by setting an environment variable:

Code: Select all

SDL_AUDIODRIVER=alsa

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Posted: Mon Aug 08, 2022 7:44 am
by sitting.duc
Hello,
TL;DR: config.ini change to Allegro backend fixes my issues and I can play on


1.1.62 shows up in pavucontrol as "ALSA plug in [Factorio]: ALSA playback", I get no sound on the loading splash screen/menu, and it does not exit.
Log says "0.592 [Audio] Backend:default; Depth:16, Channels:2, Frequency:44100".

1.1.59 the main menu has sound!, shows up in pavucontrol as "Factorio: Allegro voice". and does exit
Log says "0.603 [Audio] Backend:default; Depth:16, Channel:2, Frequency:44100; MixerQuality:linear"

1.1.65, edited config.ini to use Allegro, splash screen and menu have sound!, shows up in pavucontrol as "Factorio: Allegro voice". and does exit
Log says "0.586 [Audio] Backend:allegro; Depth:16, Channel:2, Frequency:44100; MixerQuality:linear"


With 1.1.65 having sound / having a working quit feature using the thread linked by @Donion to enable Allegro as the backend, my primary issue is resolved and I can keep working towards launching this rocket. Many thanks.

(I never would have thought to check for an audio-issue to cause a failure to exit :) )

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Posted: Mon Aug 08, 2022 8:08 am
by Donion
sitting.duc wrote: Mon Aug 08, 2022 7:44 am
Hi, could you please try one other thing: running 1.1.65 with default (sdl) audio backend and post the log? There is a little bit more logging than in 1.1.62 and it might help me troubleshoot this further. I appreciate your tests and reports very much!