The pavucontrol command is not installed on my host right now. I am using Kubuntu, it probably has its own sound subsystem UI options.
You right, I’ve checked and found installed the PulseAudio package 1:13.99.1-1ubuntu3.10, but anyway, Audacity has only one option to select the Audio host (first member of the DeviceToolbar) - the ALSA.
The recording device control (the second member of the Device Toolbar) contains the pulse option to select, and it looks the same as the default one. Changing this option to pulse and trying other options directly selecting the recording device (see the first attachment) doesn’t have an effect on the issue.
The playback device (the fourth member of the Device Toolbar) also contains pulse and direct device options for the playback device (as in the second attachment). Changing it to the direct device selection (see the second attachment) works around an issue! It might be some tip for developers to find the bug, thank you.
The default sound system is PulseAudio, so “default” is just an alias for PulseAudio.
“ALSA” is the underlying sound system (“drivers”) between PulseAudio and the hardware device.
This is a known issue, and is what I was going to suggest next (but you beat me to it )
It does not happen often these days, but it is still an issue for a few Linux users. Unlike most audio apps, Audacity does not just connect to the sound system and leave the connections open until Audacity is closed. Audacity makes a new connection whenever it is required to play or record, and closes the connection on “stop”. It is like this for historic reasons.
Unfortunately, PulseAudio does not always manage to open and close the connections when requested, which causes PulseAudio to quit and respawn. It’s the “respawning” that causes the problem because Audacity is left in a state where it is trying to communicate with a PulseAudio device that no longer exists - it has been replaced by a new instance of Pulse.
The workaround is to bypass PulseAudio by using the underlying ALSA devices directly. As you have done, you just select the “hw” option that corresponds with the audio device that you are using. In your case that’s “hw:2,0” (the “ALC887-VD Analog” device).
My hope is that eventually Audacity will be changed to make the audio connections persistent, thus avoiding the problem arising from constantly making and closing connections, but this is a big job that goes deep into Audacity’s audio handling so it’s not likely to happen anytime soon.