This is caused by missing or broken Python packages.
First, check which packages are missing, run:
sudo journalctl -u dbus -f
JournalCTL is the logging program for accessing Systemd logs, -u
is the Unit that you want to view the logs for, -f
means 'follow', it will remain open and print new logs until you close it.
Open a new terminal and try running software-properties-gtk
, your first terminal will receive the Python error telling you which packages are missing:
Sep 18 00:33:42 Tiles-PC dbus-daemon[3736]: [system] Activating service name='com.ubuntu.SoftwareProperties' requested by ':1.1926' (uid=1000 pid=408791 comm="/usr/bin/python3 /usr/bin/software-properties-gtk " label="unconfined") (using servicehelper)
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: Unable to init server: Could not connect: Connection refused
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: Unable to init server: Could not connect: Connection refused
Sep 18 00:33:42 Tiles-PC dbus-daemon[3736]: [system] Successfully activated service 'com.ubuntu.SoftwareProperties'
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: Traceback (most recent call last):
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: File "/usr/lib/software-properties/software-properties-dbus", line 68, in <module>
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: server = SoftwarePropertiesDBus(bus, datadir=datadir)
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: File "/lib/python3/dist-packages/softwareproperties/dbus/SoftwarePropertiesDBus.py", line 66, in __init__
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: self._livepatch_service = LivepatchService()
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: File "/lib/python3/dist-packages/softwareproperties/LivepatchService.py", line 93, in __init__
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: self._session = requests_unixsocket.Session()
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: NameError: name 'requests_unixsocket' is not defined
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: Error in sys.excepthook:
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: Traceback (most recent call last):
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: File "/lib/python3/dist-packages/apport_python_hook.py", line 72, in apport_excepthook
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: from apport.fileutils import likely_packaged, get_recent_crashes
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: File "/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: from apport.report import Report
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: File "/lib/python3/dist-packages/apport/report.py", line 32, in <module>
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: import apport.fileutils
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: File "/lib/python3/dist-packages/apport/fileutils.py", line 12, in <module>
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: import os, glob, subprocess, os.path, time, pwd, sys, requests_unixsocket
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: File "/lib/python3/dist-packages/requests_unixsocket/__init__.py", line 1, in <module>
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: import requests
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: ModuleNotFoundError: No module named 'requests'
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: Original exception was:
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: Traceback (most recent call last):
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: File "/usr/lib/software-properties/software-properties-dbus", line 68, in <module>
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: server = SoftwarePropertiesDBus(bus, datadir=datadir)
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: File "/lib/python3/dist-packages/softwareproperties/dbus/SoftwarePropertiesDBus.py", line 66, in __init__
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: self._livepatch_service = LivepatchService()
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: File "/lib/python3/dist-packages/softwareproperties/LivepatchService.py", line 93, in __init__
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: self._session = requests_unixsocket.Session()
Sep 18 00:33:42 Tiles-PC com.ubuntu.SoftwareProperties[408804]: NameError: name 'requests_unixsocket' is not defined
You are looking for the ModuleNotFoundError
, in my case requests
and requests_unixsocket
are missing or broken.
Reinstall the missing/broken packages:
sudo apt install python3-requests python3-requests-unixsocket --reinstall
Try running software-properties-gtk
again. You may need to repeat the process multiple times if further packages are broken.