KDE/Kubuntu: Module "module-switch-on-connect" should be loaded once at most. Refusing to load.

Bug #1720519 reported by ben van 't ende on 2017-09-30
214
This bug affects 43 people
Affects Status Importance Assigned to Milestone
PulseAudio
Confirmed
Medium
pulseaudio (Ubuntu)
High
Unassigned

Bug Description

Pulseaudio daemon does not start after the update to Kubuntu 17.10 beta2, because the module fails to load although it is there.

From 'pulseaudio -vv'

E: [pulseaudio] module.c: Module "module-switch-on-connect" should be loaded once at most. Refusing to load.
E: [pulseaudio] main.c: Module load failed.
E: [pulseaudio] main.c: Failed to initialize daemon.

PS sorry I am not a seasoned bug reporter. Let me know if I can provide more info.

ProblemType: Bug
DistroRelease: Ubuntu 17.10
Package: pulseaudio 1:10.0-2ubuntu3
ProcVersionSignature: Ubuntu 4.13.0-12.13-generic 4.13.3
Uname: Linux 4.13.0-12-generic x86_64
ApportVersion: 2.20.7-0ubuntu1
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/pcmC0D0p: ben 2809 F...m chrome
 /dev/snd/controlC0: ben 2809 F.... chrome
 /dev/snd/timer: ben 2809 f.... chrome
CurrentDesktop: KDE
Date: Sat Sep 30 11:20:55 2017
InstallationDate: Installed on 2017-04-07 (175 days ago)
InstallationMedia: Kubuntu 17.04 "Zesty Zapus" - Beta amd64 (20170321)
PulseList: Error: command ['pacmd', 'list'] failed with exit code 1: No PulseAudio daemon running, or not running as session daemon.
SourcePackage: pulseaudio
UpgradeStatus: Upgraded to artful on 2017-09-30 (0 days ago)
dmi.bios.date: 10/29/2015
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: P1.10
dmi.board.name: B150M-ITX
dmi.board.vendor: ASRock
dmi.chassis.asset.tag: To Be Filled By O.E.M.
dmi.chassis.type: 3
dmi.chassis.vendor: To Be Filled By O.E.M.
dmi.chassis.version: To Be Filled By O.E.M.
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvrP1.10:bd10/29/2015:svnToBeFilledByO.E.M.:pnToBeFilledByO.E.M.:pvrToBeFilledByO.E.M.:rvnASRock:rnB150M-ITX:rvr:cvnToBeFilledByO.E.M.:ct3:cvrToBeFilledByO.E.M.:
dmi.product.family: To Be Filled By O.E.M.
dmi.product.name: To Be Filled By O.E.M.
dmi.product.version: To Be Filled By O.E.M.
dmi.sys.vendor: To Be Filled By O.E.M.

ben van 't ende (benvantende) wrote :
ben van 't ende (benvantende) wrote :

Heyla,

After reading up some more I removed alsa and pulseaudio and reinstalled like this:

sudo apt-get remove --purge alsa-base pulseaudio

Now install again Alsa and Pulse Audio:

sudo apt-get install alsa-base pulseaudio

Then, reload Alsa:

sudo alsa force-reload

That made audio up and running again!

ben van 't ende (benvantende) wrote :

fixed myself by reinstalling pulseaudio

Changed in pulseaudio (Ubuntu):
assignee: nobody → ben van 't ende (benvantende)
David Eichelsdörfer (themysi) wrote :

had the same problem and could only fix it by removing the line
load-module module-switch-on-connect
from
/etc/pulse/default.pa

Good to know. Honestly for some weird reason the same bug re-appeared. I
had to do the same again to solve that, but also removed Discord
<https://discordapp.com/>. I vaguely remembered reading somewhere that
could cause problems. For now all is fine.

On Mon, 2 Oct 2017 at 21:41 David Eichelsdörfer <email address hidden>
wrote:

> had the same problem and could only fix it by removing the line
> load-module module-switch-on-connect
> from
> /etc/pulse/default.pa
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1720519
>
> Title:
> Module "module-switch-on-connect" should be loaded once at most.
> Refusing to load.
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1720519/+subscriptions
>
--
ben van 't ende
Web:* ben.vanten.de <http://ben.vanten.de/>*
Tel: +31 (0)6 47074151
Email: <email address hidden>
Social: benvantende

pulseaudio 1:10.0-2ubuntu3 does only load that module once. So it sounds like some other config file is getting loaded with it in your case. Perhaps Kubuntu-specific? Can anyone with this bug search their /etc and ~/ and find out all the locations where switch-on-connect is loaded?

grep -r 'load-module module-switch-on-connect' /etc

Changed in pulseaudio (Ubuntu):
assignee: ben van 't ende (benvantende) → nobody
status: New → Incomplete
assignee: nobody → Daniel van Vugt (vanvugt)
assignee: Daniel van Vugt (vanvugt) → nobody
Joni Hyttinen (jonihyt) wrote :

This would seem to happen because start-pulseaudio-x11 tries to load module-device-manager that unfortunately conflicts with module-switch-on-connect.

https://bugs.freedesktop.org/show_bug.cgi?id=95104

summary: - Module "module-switch-on-connect" should be loaded once at most.
- Refusing to load.
+ KDE/Kubuntu: Module "module-switch-on-connect" should be loaded once at
+ most. Refusing to load.
Changed in pulseaudio (Ubuntu):
status: Incomplete → Confirmed
importance: Undecided → High
tags: added: pulse11

Same bug over here; commands given in #2 helped me to get audio up and running again.

Fixed like in #4 by commenting load-module module-switch-on-connect, but this may brake functionality with hot connecting devices.

Rik Mills (rikmills) wrote :

Possibly introduced by:

https://launchpad.net/ubuntu/+source/pulseaudio/1:10.0-2ubuntu1

* Enable modules that needn't be disabled:
  - module-role-cork: Now enabled per upstream defaults (LP: #1701688)
  - module-switch-on-connect: Enabled for seamless hotplugging (LP: #1702794)

Horst Schirmeier (horst) wrote :

I'm seeing this as well on a machine with a clean 17.04 installation that was upgraded to 17.10, using KDE (sound: Intel HDA). Steps in comment #2 fixed this problem, at least temporarily.

Horst Schirmeier (horst) wrote :

Update: After reinstalling pulseaudio, alsa-base, pulseaudio-module-bluetooth and plasma-pa (for KDE's volume control applet), the problem reappeared. Commenting out "load-module module-switch-on-connect" in /etc/pulse/default.pa (see comment #4) seems to fix the issue permanently; the module still seems to be loaded due to some other means of triggering the load (see output of: pactl list modules).

Changed in pulseaudio:
importance: Unknown → Medium
status: Unknown → Confirmed
Juancho (juan-baptiste-0) wrote :

I had the same issue and workaround from #2 worked, thanks !

Imre Széll (konzerwe) wrote :

After upgrading from 17.04 I had this issue. Neither could I connect to an external audio device via Bluetooth.

I started pulseaudio in verbose mode (-vvv) and found that the module "module-switch-on-connect" is already loaded when it is tried to load again. I commented out the following lines in /etc/pulse/default.pa:

.ifexists module-switch-on-connect.so
load-module module-switch-on-connect
.endif

This workaround solves the problem permanently. I was able to use my USB Bluetooth adapter to connect external playback device.

The module "module-switch-on-connect" could be loaded by default or some dependency...

Changed in pulseaudio (Ubuntu):
assignee: nobody → Daniel van Vugt (vanvugt)
Changed in pulseaudio (Ubuntu):
status: Confirmed → In Progress
Changed in pulseaudio (Ubuntu):
status: In Progress → Triaged
assignee: Daniel van Vugt (vanvugt) → nobody
Oded Arbel (oded-geek) wrote :

The problem is in an incorrect interaction between KDE's KCM audio configuration module and PulseAudio's default configuration in Ubuntu:

* As per bug #1702794, the default PA configuration on Ubuntu enables the "switch-on-connect" module by default (in /etc/pulse/default.pa)
* "switch-on-connect" can only be loaded once, and if it gets loaded a second time, PulseAudio terminates.
* The KCM module for audio configuration has an option under "Advanced" to "Automatically switch all running streams when a new output becomes available". This checkbox updates the PulseAudio gconf configuration /system/pulseaudio/modules/switch-on-connect/enabled and sets it to "true". What that is set, when the PA gconf module gets loaded, it tries to load the switch-on-connect module again - cause PA to crash.

The fix should be - IMHO:
 - in PulseAudio don't crash when switch-on-connect gets loaded a second time, just ignore it as it is 99.99999% a configuration mistake and should not be fatal.
 - in PulseAudio gconf module, when deciding if to load modules specified in the gconf configuration, don't try to load modules already loaded.
 - in the Audio Volume KCM module, check the status of switch-on-connect in PA's default configuration and if it is enabled, show the "Automatically switch all running streams..." checkbox as checked and disabled. Only have the checkbox editable if the default PA configuration does not have switch-on-connect enabled.

Daniel van Vugt (vanvugt) wrote :

I agree we need a proper fix like that.

Further discussion about this issue probably should go upstream where the fix would ideally be applied first. If not here:
  https://bugs.freedesktop.org/show_bug.cgi?id=95104
then in another upstream bug.

Woden Cafe (wodencafe) wrote :

I have this bug now too, seems to happen every time I restart.

Everything was fine until upgrading to 17.10, which caused this and several other unrelated bugs.

This kind of stuff makes me very wary to doing release upgrades anymore.

E: [pulseaudio] module.c: Module "module-switch-on-connect" should be loaded once at most. Refusing to load.
E: [pulseaudio] main.c: Module load failed.
E: [pulseaudio] main.c: Failed to initialize daemon.

michael (reeves-87) wrote :

Attached is a patch from upstream made against Pulse Audio 12. The patch makes attempted to load an already loaded load once module non-fatal. This will enables the PulseAudio deamon to start normally under to conditions described in this bug. There will still be a warning message in the system logs however.

The attachment "Upstream patch from Pulse Audio 12" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Shaheed Haque (srhaque-i) wrote :

The workaround in #4 works-for-me.

Workaround in #4 works for me, but only for the computer-integrated speaker. Integrated microphone and also headsets don't work any more.

José Manuel (manuelvsqz) wrote :

I experienced this bug too. #2 fixes the problem but also removes plasma-pa. When plasma-pa is reinstalled it breaks pulseaudio again.

Daniel van Vugt (vanvugt) wrote :

I actually tried removing the module with the upgrade to PA 11.1 in Ubuntu 18.04. The release notes for PA 11.0 suggested that switch-on-connect would not be required, but my testing shows it still is needed for both Bluetooth and USB audio devices. Sorry about that.

After upgrading from 17.04 to 17.10 I also had this issue with error:

> pulseaudio[6267]: Module "module-switch-on-connect" should be loaded once at most. Refusing to load.

Fixed like in #4 by commenting load-module module-switch-on-connect out of /etc/pulse/default.pa

Have not tried any plug-in-devices to see if this fix affects their usage.

By commenting the lines from /etc/pulse/default.pa

#.ifexists module-switch-on-connect.so
#load-module module-switch-on-connect
#.endif

And reinstalling pulse audio and alsa-base as here:

apt-get remove --purge pulseaudio
rm -rf /etc/pulse
apt-get install pulseaudio
reboot

I managed to get the audio again, but I cannot control it with the volume controls of my keyboard, neither with thw sound tray icon(that completely dissapeared)

DimanNe (dimanne) wrote :

Thank you, benvantende! Reinstalling pulseaudio has helped me too

ahhh cool that helped. I have updated to 18.04 last week and did not come
across any problems any more.

gRTZ ben

On Tue, 27 Mar 2018 at 11:20 DimanNe <email address hidden> wrote:

> Thank you, benvantende! Reinstalling pulseaudio has helped me too
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1720519
>
> Title:
> KDE/Kubuntu: Module "module-switch-on-connect" should be loaded once
> at most. Refusing to load.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/pulseaudio/+bug/1720519/+subscriptions
>
--
ben van 't ende
Web:* ben.vanten.de <http://ben.vanten.de/>*
Tel: +31 (0)6 47074151
Email: <email address hidden>
Social: benvantende

Daniel van Vugt (vanvugt) wrote :

Are you saying this bug was fixed somewhere in 18.04?

Changed in pulseaudio (Ubuntu):
status: Triaged → Incomplete
Nate Graham (pointedstick) wrote :

I think so, yes.

I also had this problem after upgrading to 17.10 and solved it with commenting out load-module module-switch-on-connect in /etc/pulse/default.pa.

When upgrading to 18.04 I opt for replacing the /etc/pulse/default.pa so the setting is back, but I don't have this issue, so it's fixed for me in 18.04.

Daniel van Vugt (vanvugt) wrote :

The error message still exists in the latest (12.2) PulseAudio:

  pa_log("Module \"%s\" should be loaded once at most. Refusing to load.", name);
  errcode = -PA_ERR_EXIST;
  goto fail;

So if it seems fixed then that probably means the KDE/Kubuntu side got fixed.

Changed in pulseaudio (Ubuntu):
status: Incomplete → Won't Fix
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.