software-properties-gtk does not run at all!

Bug #1830914 reported by dexter
28
This bug affects 6 people
Affects Status Importance Assigned to Milestone
software-properties (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

software-properties-gtk does not even start!

$ software-properties-gtk --debug

ENABLED COMPS: {'universe', 'main'}
INTERNET COMPS: {'universe', 'main'}
MAIN SOURCES
 URI: http://archive.ubuntu.com/ubuntu
 Comps: ['main']
 Enabled: True
 Valid: True
 MatchURI: archive.ubuntu.com/ubuntu
 BaseURI: http://archive.ubuntu.com/ubuntu

 URI: http://archive.ubuntu.com/ubuntu
 Comps: ['universe']
 Enabled: True
 Valid: True
 MatchURI: archive.ubuntu.com/ubuntu
 BaseURI: http://archive.ubuntu.com/ubuntu

CHILD SOURCES
 URI: http://archive.ubuntu.com/ubuntu
 Comps: ['main']
 Enabled: True
 Valid: True
 MatchURI: archive.ubuntu.com/ubuntu
 BaseURI: None

 URI: http://archive.ubuntu.com/ubuntu
 Comps: ['universe']
 Enabled: True
 Valid: True
 MatchURI: archive.ubuntu.com/ubuntu
 BaseURI: None

 URI: http://archive.ubuntu.com/ubuntu
 Comps: ['main']
 Enabled: True
 Valid: True
 MatchURI: archive.ubuntu.com/ubuntu|security.ubuntu.com
 BaseURI: http://security.ubuntu.com/ubuntu/

 URI: http://archive.ubuntu.com/ubuntu
 Comps: ['universe']
 Enabled: True
 Valid: True
 MatchURI: archive.ubuntu.com/ubuntu|security.ubuntu.com
 BaseURI: http://security.ubuntu.com/ubuntu/

 URI: http://archive.ubuntu.com/ubuntu
 Comps: ['universe', 'main']
 Enabled: True
 Valid: True
 MatchURI: archive.ubuntu.com/ubuntu
 BaseURI: None

CDROM SOURCES
SOURCE CODE SOURCES
DISABLED SOURCES
ISV
Traceback (most recent call last):
  File "/usr/bin/software-properties-gtk", line 100, in <module>
    app = SoftwarePropertiesGtk(datadir=options.data_dir, options=options, file=file)
  File "/usr/lib/python3/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py", line 200, in __init__
    self.init_livepatch()
  File "/usr/lib/python3/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py", line 1482, in init_livepatch
    self.livepatch_page = LivepatchPage(self)
  File "/usr/lib/python3/dist-packages/softwareproperties/gtk/LivepatchPage.py", line 51, in __init__
    self._lps = LivepatchService()
  File "/usr/lib/python3/dist-packages/softwareproperties/LivepatchService.py", line 93, in __init__
    self._session = requests_unixsocket.Session()
NameError: name 'requests_unixsocket' is not defined

{Exited with code 1.}

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 19.04
Release: 19.04
Codename: disco

$ dpkg-query -l software-properties-gtk python3-requests-unixsocket

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===========================-============-============-===============================================================
ii python3-requests-unixsocket 0.1.5-3 all Use requests to talk HTTP via a UNIX domain socket - Python 3.x
ii software-properties-gtk 0.97.11 all manage the repositories that you install software from (gtk)

$ sudo apt-get update
{Works.}

$ sudo apt-get dist-upgrade
{Works.}

Revision history for this message
dexter (rekoghllgsuz) wrote :

I found that if I move a bit the "import requests_unixsocket" line (in file LivepatchService.py), then the software-properties-gtk call *works*.
Please somebody either propagate this solution (if it is a true solution), or tell me how to propagate.
(I do not know shat is exactly happening. Whether the try-clause partly succeeds, then rolls back?..)

$ sudo -s

# cd /usr/lib/python3/dist-packages/softwareproperties

# diff -u4 LivepatchService.py.ORI LivepatchService.py.MY
--- LivepatchService.py.ORI 2019-06-24 14:46:07.000000000 +0200
+++ LivepatchService.py.MY 2019-06-24 14:54:31.000000000 +0200
@@ -23,13 +23,12 @@
 import logging

 import gi
 from gi.repository import Gio, GLib, GObject
+import requests_unixsocket

 try:
     import dateutil.parser
- import requests_unixsocket
-
     gi.require_version('Snapd', '1')
     from gi.repository import Snapd
 except(ImportError, ValueError):
     pass

# cp LivepatchService.py.MY LivepatchService.py

$ software-properties-gtk

{OK, works! The dialog is popping up.}

Revision history for this message
dexter (rekoghllgsuz) wrote :

The software-properties-gtk starts, but the last tab (which is a new tab), captioned "Livepatch", does not work.

The text says "Checking availability...", then, after a while an "internal error detected" dialog comes up.

So "livepatch" does not work (at least does not seem to).

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for your bug report, what's the output of

$ python3 -c 'import dateutil.parser'
and
$ python3 -c 'import requests_unixsocket'

?

Changed in software-properties (Ubuntu):
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
Sved (sveddevs) wrote :

@seb128
I am seeing the same issue after I upgraded to 19.04.

The output of both the commands you requested is a new line (shown below)
sved@sveddt:~$ python3 -c 'import dateutil.parser'
sved@sveddt:~$ python3 -c 'import requests_unixsocket'
sved@sveddt:~$

Revision history for this message
Sebastien Bacher (seb128) wrote :

weird, why would that change makes a difference if the imports are not failing? are you sure it's the same issue?

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for software-properties (Ubuntu) because there has been no activity for 60 days.]

Changed in software-properties (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Tim Richardson (tim-richardson) wrote :

I have this problem in one Ubuntu 18.04

journalctl -e

Sep 06 17:54:28 ubuntu dbus-daemon[723]: [system] Activating service name='com.ubuntu.SoftwareProperties' requested by ':1.106' (uid=1000 pid=6185 comm="/usr/bin/python3 /usr/bin/software-properties-gtk " label="unconfined") (using servicehelper)
Sep 06 17:54:28 ubuntu com.ubuntu.SoftwareProperties[723]: Unable to init server: Could not connect: Connection refused
Sep 06 17:54:28 ubuntu com.ubuntu.SoftwareProperties[723]: Unable to init server: Could not connect: Connection refused
Sep 06 17:54:28 ubuntu dbus-daemon[723]: [system] Successfully activated service 'com.ubuntu.SoftwareProperties'
Sep 06 17:54:28 ubuntu com.ubuntu.SoftwareProperties[723]: Traceback (most recent call last):
Sep 06 17:54:28 ubuntu com.ubuntu.SoftwareProperties[723]: File "/usr/lib/software-properties/software-properties-dbus", line 68, in <module>
Sep 06 17:54:28 ubuntu com.ubuntu.SoftwareProperties[723]: server = SoftwarePropertiesDBus(bus, datadir=datadir)
Sep 06 17:54:28 ubuntu com.ubuntu.SoftwareProperties[723]: File "/usr/lib/python3/dist-packages/softwareproperties/dbus/SoftwarePropertiesDBus.py", line 66, in __init__
Sep 06 17:54:28 ubuntu com.ubuntu.SoftwareProperties[723]: self._livepatch_service = LivepatchService()
Sep 06 17:54:28 ubuntu com.ubuntu.SoftwareProperties[723]: File "/usr/lib/python3/dist-packages/softwareproperties/LivepatchService.py", line 93, in __init__
Sep 06 17:54:28 ubuntu com.ubuntu.SoftwareProperties[723]: self._session = requests_unixsocket.Session()
Sep 06 17:54:28 ubuntu com.ubuntu.SoftwareProperties[723]: NameError: name 'requests_unixsocket' is not defined

Revision history for this message
Tim Richardson (tim-richardson) wrote :

>>> import dateutil.parser
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/dateutil/parser.py", line 40, in <module>
    from six import text_type, binary_type, integer_types
ModuleNotFoundError: No module named 'six'

Revision history for this message
Tim Richardson (tim-richardson) wrote :

I had the module python3-six installed but after I reinstalled it, software-properties-gtk started working again.

Revision history for this message
Gunawan Wibisono (gunse) wrote :

it also happened with me on focal and it was fixed by reinstall python3-six and python3-certifi

Revision history for this message
SunBear (sunbear-c22) wrote :

I enquired about this issue in Aug 2020 (see https://askubuntu.com/q/1271611/541417). @SteveLanders solution worked for me. https://askubuntu.com/a/1312345/541417.

The following reinstallation procedure that he had shared worked for me:
sudo apt install --reinstall python3-six python3-certifi python3-requests python3-idna
sudo apt install --reinstall software-properties-gtk
software-properties-gtk

Revision history for this message
Tony Arkles (tonyarkles) wrote :

I ran into the same problem, I think, today and had to also reinstall python3-urllib3 before it would work again.

Revision history for this message
Jan Frecè (j-frece) wrote :

Is there an official solution to this problem, meanwhile?

I ran into the same problem, but even after reinstalling python3-six, python3-certifi, python3-requests, python3-idna, and python3-urllib3 I still can't start software-properties-gtk, getting the message that the name 'requests_unixsocket' is not defined.

Does anyone have an idea what to try next to get software-properties up and running again?

Revision history for this message
Martin Spacek (mspacek) wrote (last edit ):

@dexter in #1, I also tried moving the `import requests_unixsocket` line up out of the try-except block, and also found that it worked. (None of the other proposed solutions, including reinstalling all of the proposed packages, had any effect). Strangely, afer *undoing* those change, i.e. moving the `import requests_unixsocket` line back into the try-except block, software-properties-gtk was *still* able to start!

Not sure how to explain this, other than perhaps some race condition (interprocess comms via DBus?), or perhaps some old .pyc file that was regenerated after the source .py file as updated. Who knows. Either way, this is still a huge issue. This was a fresh install of Xubuntu 20.04.5. Issue started happening a couple of weeks after installing the OS. No idea what triggered it.

UPDATE: after undoing the changes, and then rebooting, the issue returned. I had to redo the changes to get it to work again. Now software-properties-gtk continues to work between reboots.

Note that `import dateutil.parser` works fine. Everything in that try-except block imports fine when I try it in a separate python3 session. Also, if I try pasting `print(requests_unixsocket)` anywhere outside that block, it works fine. It was only when I tried pasting it in `LivepatchService.__init__` that it failed, almost as if some other module was internally deleting the name from the namespace. Very mysterious.

Also note that I completely uninstalled snap (which I absolutely detest) on this system, but software-properties-gtk was working fine for a couple of weeks after uninstalling snap. I haven't had this problem on another fully updated Xubuntu 20.04 system, where I also uninstalled snap long ago.

Martin Spacek (mspacek)
Changed in software-properties (Ubuntu):
status: Expired → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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