A temporary fix to several audio bugs in Ubuntu

Published: 2018-03-18 1 minute read

There are two bugs affecting my computer that prevent audio from playing:

  1. If I boot my Ubuntu laptop with headphones plugged in, no audio will play while the headphones are plugged in.
  2. Firefox 58 and 59 will not play audio unless another program produced a sound before Firefox was started.

I finally found a combination of hacks that resolves these issues, though this is clearly only for the kind of sociopath that continues to use Linux under such conditions.

Install mpg123: sudo apt install mpg123

Download this 50 ms inaudible mp3 I made: curl https://www.rybarski.com/static/very-quiet-noise.mp3 -o ~/Documents/very-quiet-noise.mp3

Then add this to ~/.profile:

# Plays a sound at boot so Firefox 58+ will be able to play audio.
mpg123 -q  ~/Documents/very-quiet-noise.mp3

# If we booted with headphones plugged in, this will allow audio to work
# The strange invocation is required to suppress an error message on boot
bash -c 'alsactl restore || true' 2>&1 > /dev/null