martin-ueding/thinkpad-scripts

thinkpad-dock no longer works after purging PulseAudio

dnisyd opened this issue · 3 comments

Had problems with PulseAudio hence I changed over to ALSA and purged PulseAudio.
thinkpad-dock (on|off) and manually docking the device stopped working throwing the following error:

Verbindungsfehler: Verbindung verweigert
pa_context_new() fehlgeschlagen: Verbindung verweigert
Traceback (most recent call last):
  File "/usr/bin/thinkpad-dock", line 9, in <module>
    load_entry_point('thinkpad-scripts==4.9.1', 'console_scripts', 'thinkpad-dock')()
  File "/usr/local/lib/python3.5/dist-packages/thinkpad_scripts-4.9.1-py3.5.egg/tps/dock.py", line 278, in main
  File "/usr/local/lib/python3.5/dist-packages/thinkpad_scripts-4.9.1-py3.5.egg/tps/dock.py", line 152, in dock
  File "/usr/local/lib/python3.5/dist-packages/thinkpad_scripts-4.9.1-py3.5.egg/tps/sound.py", line 45, in unmute
  File "/usr/local/lib/python3.5/dist-packages/thinkpad_scripts-4.9.1-py3.5.egg/tps/sound.py", line 34, in get_pulseaudio_sinks
  File "/usr/local/lib/python3.5/dist-packages/thinkpad_scripts-4.9.1-py3.5.egg/tps/__init__.py", line 140, in wrapper
  File "/usr/lib/python3.5/subprocess.py", line 626, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.5/subprocess.py", line 708, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['pactl', 'list', 'sinks']' returned non-zero exit status 1

I checked through your code and you seem to check for something in PulseAudio.
I also cleared all sound related options in my config.
Reinstalling thinkpad-scripts does not help as well.

In the code we have the following check:

if not tps.has_program('pactl'):
    logger.warning('pactl is not installed')
    return []

output = tps.check_output(['pactl', 'list', 'sinks'], logger).decode()

Your system seems to be in a strange state: You have pactl installed, but Pulse Audio is not running. I would say that you should also purge pactl from your system to make it consistent.

Of course we could try to ignore failures from pactl in our code. But it sounds like a niche application that could be solved by getting rid of pactl.

My bad, should have read more carefully through your code. Uninstalling sudo apt-get purge pulseaudio-utils:i386 fixed it for me. Now it just tells me tps.sound WARNING pactl is not installed which is fine. Thanks.

Don't worry, glad to hear that it works now!