Ubuntu Software Center crashes due to error in its Python code

7,680

TL;DR:

The following fixed it for me:

sudo chmod -r 755 /usr/local/lib/python2.7/dist-packages/

and

sudo reboot

My debugging path

I'm experiencing the same issues with ubuntuone and software-centre. These are the following steps I took to further debug this issue:

U1_DEBUG=True /usr/lib/ubuntu-sso-client/ubuntu-sso-login

which led to the following output:

...
Traceback (most recent call last):
  File "/usr/lib/ubuntu-sso-client/ubuntu-sso-login", line 67, in <module>
    from ubuntu_sso.main import main
  File "/usr/lib/python2.7/dist-packages/ubuntu-sso-client/ubuntu_sso/main/__init__.py", line 39, in <module>
    from twisted.internet import defer
  File "/usr/lib/python2.7/dist-packages/twisted/__init__.py", line 53, in <module>
    _checkRequirements()
  File "/usr/lib/python2.7/dist-packages/twisted/__init__.py", line 40, in _checkRequirements
    raise ImportError(required + ".")
ImportError: Twisted requires zope.interface 3.6.0 or later.

I then installed the zope.interface :

sudo easy_install zope.interface

I've tried it out in the python interpreter:

>>> import zope.interface

and got a few "Permission denied" errors on the Python packages:

IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/httplib2-0.8-py2.7.egg/EGG-INFO/top_level.txt'IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/httplib2-0.8-py2.7.egg/EGG-INFO/top_level.txt'

after which I decided to change access permissions to the file:

sudo chmod -r 755 /usr/local/lib/python2.7/dist-packages/

which resulted in the GUI of Ubuntu One to pop and attempt to sync. Only to receive a dBus exception afterwards in a pop-up window. At least the GUI started working...

For Software Centre, I ran the following command in the terminal:

software-center --debug

got a few more of the same dBus exceptions and googling the issue I found out that a restart suffice it for the exceptions to go away which are triggered due to a timeout.

Share:
7,680

Related videos on Youtube

Tadeck
Author by

Tadeck

Updated on September 18, 2022

Comments

  • Tadeck
    Tadeck over 1 year

    I searched for that, but did not find any reference to it on this site. If you know some, please refer me to it - the issues I have seen have different symptoms. So, to the point...

    I had Ubuntu 12.04 LTS for a long time, switched to Ubuntu Gnome Shell etc. Recently I wanted to move to Ubuntu 13.04 and found an issue that seemingly occurred previously, but at seemingly random rate. Now I cannot start Ubuntu Software Center at all.

    When I run the console I see:

    $ software-center
    
    (process:22270): Gtk-WARNING **: Locale not supported by C library.
        Using the fallback 'C' locale.
    Traceback (most recent call last):
      File "/usr/bin/software-center", line 36, in <module>
        from softwarecenter.utils import (
      File "/usr/share/software-center/softwarecenter/utils.py", line 47, in <module>
        from config import get_config
      File "/usr/share/software-center/softwarecenter/config.py", line 33, in <module>
        class SoftwareCenterConfig(object, SafeConfigParser):
      File "/usr/lib/python2.7/abc.py", line 87, in __new__
        cls = super(ABCMeta, mcls).__new__(mcls, name, bases, namespace)
    TypeError: Error when calling the metaclass bases
        Cannot create a consistent method resolution
    order (MRO) for bases SafeConfigParser, object
    

    I hoped that following these ideas (source) could be helpful:

    $ sudo apt-get purge software-center
    $ sudo apt-get update
    $ sudo apt-get dist-upgrade
    $ sudo apt-get install software-center
    $ sudo dpkg-reconfigure software-center --force
    

    It was not:

    $ sudo apt-get purge software-center
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following package was automatically installed and is no longer required:
      software-center-aptdaemon-plugins
    Use 'apt-get autoremove' to remove it.
    The following packages will be REMOVED:
      software-center*
    0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
    After this operation, 0 B of additional disk space will be used.
    Do you want to continue [Y/n]? Y
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_US.UTF-8"
        are supported and installed on your system.
    perl: warning: Falling back to the standard locale ("C").
    locale: Cannot set LC_CTYPE to default locale: No such file or directory
    locale: Cannot set LC_MESSAGES to default locale: No such file or directory
    locale: Cannot set LC_ALL to default locale: No such file or directory
    (Reading database ... 269627 files and directories currently installed.)
    Removing software-center ...
    Purging configuration files for software-center ...
    rmdir: failed to remove `/var/cache/software-center/xapian/': No such file or directory
    dpkg: error processing software-center (--purge):
     subprocess installed post-removal script returned error exit status 1
    Errors were encountered while processing:
     software-center
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    What am I doing wrong? How can I get rid of Ubuntu Software Center causing error and install version that will not have that?

    Or maybe the problem is with my Python interpreter?

    $ python --version
    Python 2.7.3
    

    I believe Ubuntu is gradually moving to tools working on Python 3.x only, but is that the cause?

    Thanks for all the tips. I strongly believe it may be also helpful for the others.

    Update 1.:

    The first update went from 12.04 to 12.10, and I did not notice it did not reach 13.04. As soon as I noticed, I upgraded from 12.10 to 13.04. The problem however did not disappear.

    I also did what thefourtheye asked:

    $ sudo locale-gen
    Generating locales...
      en_US.UTF-8... up-to-date
    Generation complete.
    

    And this is the result of trying to do the purge:

    $ sudo apt-get purge software-center
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
      python-oneconf software-center-aptdaemon-plugins
    Use 'apt-get autoremove' to remove them.
    The following packages will be REMOVED:
      software-center*
    0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
    After this operation, 0 B of additional disk space will be used.
    Do you want to continue [Y/n]? Y
    (Reading database ... 279036 files and directories currently installed.)
    Removing software-center ...
    Purging configuration files for software-center ...
    rmdir: failed to remove ‘/var/cache/software-center/xapian/’: No such file or directory
    dpkg: error processing software-center (--purge):
     subprocess installed post-removal script returned error exit status 1
    No apport report written because MaxReports is reached already
                                                                  Errors were encountered while processing:
     software-center
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    Update 2.:

    Another debug information (requested by nickguletskii):

    $ cat /etc/environment
    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
    

    and

    $ sudo apt-get install language-pack-en
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following extra packages will be installed:
      firefox-locale-en language-pack-en-base
    The following NEW packages will be installed:
      firefox-locale-en language-pack-en language-pack-en-base
    0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
    Need to get 1,372 kB of archives.
    After this operation, 4,874 kB of additional disk space will be used.
    Do you want to continue [Y/n]? 
    Get:1 http://security.ubuntu.com/ubuntu/ raring-security/main firefox-locale-en amd64 21.0+build2-0ubuntu0.13.04.2 [549 kB]
    Get:2 http://archive.ubuntu.com/ubuntu/ raring/main language-pack-en-base all 1:13.04+20130418 [822 kB]
    Get:3 http://archive.ubuntu.com/ubuntu/ raring/main language-pack-en all 1:13.04+20130418 [1,968 B]
    Fetched 1,372 kB in 2s (521 kB/s)            
    Selecting previously unselected package language-pack-en-base.
    (Reading database ... 279503 files and directories currently installed.)
    Unpacking language-pack-en-base (from .../language-pack-en-base_1%3a13.04+20130418_all.deb) ...
    Selecting previously unselected package language-pack-en.
    Unpacking language-pack-en (from .../language-pack-en_1%3a13.04+20130418_all.deb) ...
    Selecting previously unselected package firefox-locale-en.
    Unpacking firefox-locale-en (from .../firefox-locale-en_21.0+build2-0ubuntu0.13.04.2_amd64.deb) ...
    Processing triggers for software-center ...
    ERROR:root:DebFileApplication import
    Traceback (most recent call last):
      File "/usr/share/software-center/softwarecenter/db/__init__.py", line 4, in <module>
        from debfile import DebFileApplication, DebFileOpenError
      File "/usr/share/software-center/softwarecenter/db/debfile.py", line 25, in <module>
        from softwarecenter.db.application import Application, AppDetails
      File "/usr/share/software-center/softwarecenter/db/application.py", line 28, in <module>
        import softwarecenter.distro
      File "/usr/share/software-center/softwarecenter/distro/__init__.py", line 26, in <module>
        from softwarecenter.utils import UnimplementedError, utf8
      File "/usr/share/software-center/softwarecenter/utils.py", line 48, in <module>
        from config import get_config
      File "/usr/share/software-center/softwarecenter/config.py", line 33, in <module>
        class SoftwareCenterConfig(object, SafeConfigParser):
      File "/usr/lib/python2.7/abc.py", line 87, in __new__
        cls = super(ABCMeta, mcls).__new__(mcls, name, bases, namespace)
    TypeError: Error when calling the metaclass bases
        Cannot create a consistent method resolution
    order (MRO) for bases object, SafeConfigParser
    Traceback (most recent call last):
      File "/usr/sbin/update-software-center", line 38, in <module>
        from softwarecenter.db.update import rebuild_database
      File "/usr/share/software-center/softwarecenter/db/update.py", line 33, in <module>
        from softwarecenter.backend.scagent import SoftwareCenterAgent
      File "/usr/share/software-center/softwarecenter/backend/scagent.py", line 28, in <module>
        from softwarecenter.distro import get_distro, get_current_arch
      File "/usr/share/software-center/softwarecenter/distro/__init__.py", line 26, in <module>
        from softwarecenter.utils import UnimplementedError, utf8
      File "/usr/share/software-center/softwarecenter/utils.py", line 48, in <module>
        from config import get_config
      File "/usr/share/software-center/softwarecenter/config.py", line 33, in <module>
        class SoftwareCenterConfig(object, SafeConfigParser):
      File "/usr/lib/python2.7/abc.py", line 87, in __new__
        cls = super(ABCMeta, mcls).__new__(mcls, name, bases, namespace)
    TypeError: Error when calling the metaclass bases
        Cannot create a consistent method resolution
    order (MRO) for bases object, SafeConfigParser
    Setting up firefox-locale-en (21.0+build2-0ubuntu0.13.04.2) ...
    Setting up language-pack-en (1:13.04+20130418) ...
    Setting up language-pack-en-base (1:13.04+20130418) ...
    Generating locales...
      en_AG.UTF-8... done
      en_AU.UTF-8... done
      en_BW.UTF-8... done
      en_CA.UTF-8... done
      en_DK.UTF-8... done
      en_GB.UTF-8... done
      en_HK.UTF-8... done
      en_IE.UTF-8... done
      en_IN.UTF-8... done
      en_NG.UTF-8... done
      en_NZ.UTF-8... done
      en_PH.UTF-8... done
      en_SG.UTF-8... done
      en_US.UTF-8... up-to-date
      en_ZA.UTF-8... done
      en_ZM.UTF-8... done
      en_ZW.UTF-8... done
    Generation complete.
    Processing triggers for bamfdaemon ...
    Rebuilding /usr/share/applications/bamf-2.index...
    

    Update 3.:

    After following advice of nickguletskii I am getting this:

    $ cat /etc/environment 
    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
    LC_NUMERIC="en_US.UTF-8"
    LC_TIME="en_US.UTF-8"
    LC_MONETARY="en_US.UTF-8"
    LC_PAPER="en_US.UTF-8"
    LC_IDENTIFICATION="en_US.UTF-8"
    LC_NAME="en_US.UTF-8"
    LC_ADDRESS="en_US.UTF-8"
    LC_TELEPHONE="en_US.UTF-8"
    LC_MEASUREMENT="en_US.UTF-8"
    LANGUAGE="en_US:en_US:en"
    LANG="en_US.UTF-8"
    
    $ software-center
    Traceback (most recent call last):
      File "/usr/bin/software-center", line 36, in <module>
        from softwarecenter.utils import (
      File "/usr/share/software-center/softwarecenter/utils.py", line 48, in <module>
        from config import get_config
      File "/usr/share/software-center/softwarecenter/config.py", line 33, in <module>
        class SoftwareCenterConfig(object, SafeConfigParser):
      File "/usr/lib/python2.7/abc.py", line 87, in __new__
        cls = super(ABCMeta, mcls).__new__(mcls, name, bases, namespace)
    TypeError: Error when calling the metaclass bases
        Cannot create a consistent method resolution
    order (MRO) for bases object, SafeConfigParser
    
    $ sudo apt-get purge software-center
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following packages will be REMOVED:
      software-center*
    0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
    After this operation, 3,588 kB disk space will be freed.
    Do you want to continue [Y/n]? Y
    (Reading database ... 280103 files and directories currently installed.)
    Removing software-center ...
    Purging configuration files for software-center ...
    rmdir: failed to remove ‘/var/cache/software-center/xapian/’: No such file or directory
    dpkg: error processing software-center (--purge):
     subprocess installed post-removal script returned error exit status 1
    Processing triggers for bamfdaemon ...
    Rebuilding /usr/share/applications/bamf-2.index...
    Processing triggers for desktop-file-utils ...
    Processing triggers for gnome-menus ...
    Processing triggers for hicolor-icon-theme ...
    Processing triggers for man-db ...
    Errors were encountered while processing:
     software-center
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    
    $ sudo apt-get install software-center
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following NEW packages will be installed:
      software-center
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 0 B/442 kB of archives.
    After this operation, 3,588 kB of additional disk space will be used.
    Selecting previously unselected package software-center.
    (Reading database ... 279639 files and directories currently installed.)
    Unpacking software-center (from .../software-center_5.6.0-0ubuntu3_all.deb) ...
    Processing triggers for man-db ...
    Processing triggers for hicolor-icon-theme ...
    Processing triggers for bamfdaemon ...
    Rebuilding /usr/share/applications/bamf-2.index...
    Processing triggers for desktop-file-utils ...
    Processing triggers for gnome-menus ...
    Setting up software-center (5.6.0-0ubuntu3) ...
    ERROR:root:DebFileApplication import
    Traceback (most recent call last):
      File "/usr/share/software-center/softwarecenter/db/__init__.py", line 4, in <module>
        from debfile import DebFileApplication, DebFileOpenError
      File "/usr/share/software-center/softwarecenter/db/debfile.py", line 25, in <module>
        from softwarecenter.db.application import Application, AppDetails
      File "/usr/share/software-center/softwarecenter/db/application.py", line 28, in <module>
        import softwarecenter.distro
      File "/usr/share/software-center/softwarecenter/distro/__init__.py", line 26, in <module>
        from softwarecenter.utils import UnimplementedError, utf8
      File "/usr/share/software-center/softwarecenter/utils.py", line 48, in <module>
        from config import get_config
      File "/usr/share/software-center/softwarecenter/config.py", line 33, in <module>
        class SoftwareCenterConfig(object, SafeConfigParser):
      File "/usr/lib/python2.7/abc.py", line 87, in __new__
        cls = super(ABCMeta, mcls).__new__(mcls, name, bases, namespace)
    TypeError: Error when calling the metaclass bases
        Cannot create a consistent method resolution
    order (MRO) for bases object, SafeConfigParser
    Traceback (most recent call last):
      File "/usr/sbin/update-software-center", line 38, in <module>
        from softwarecenter.db.update import rebuild_database
      File "/usr/share/software-center/softwarecenter/db/update.py", line 33, in <module>
        from softwarecenter.backend.scagent import SoftwareCenterAgent
      File "/usr/share/software-center/softwarecenter/backend/scagent.py", line 28, in <module>
        from softwarecenter.distro import get_distro, get_current_arch
      File "/usr/share/software-center/softwarecenter/distro/__init__.py", line 26, in <module>
        from softwarecenter.utils import UnimplementedError, utf8
      File "/usr/share/software-center/softwarecenter/utils.py", line 48, in <module>
        from config import get_config
      File "/usr/share/software-center/softwarecenter/config.py", line 33, in <module>
        class SoftwareCenterConfig(object, SafeConfigParser):
      File "/usr/lib/python2.7/abc.py", line 87, in __new__
        cls = super(ABCMeta, mcls).__new__(mcls, name, bases, namespace)
    TypeError: Error when calling the metaclass bases
        Cannot create a consistent method resolution
    order (MRO) for bases object, SafeConfigParser
    
    $ software-center
    Traceback (most recent call last):
      File "/usr/bin/software-center", line 36, in <module>
        from softwarecenter.utils import (
      File "/usr/share/software-center/softwarecenter/utils.py", line 48, in <module>
        from config import get_config
      File "/usr/share/software-center/softwarecenter/config.py", line 33, in <module>
        class SoftwareCenterConfig(object, SafeConfigParser):
      File "/usr/lib/python2.7/abc.py", line 87, in __new__
        cls = super(ABCMeta, mcls).__new__(mcls, name, bases, namespace)
    TypeError: Error when calling the metaclass bases
        Cannot create a consistent method resolution
    order (MRO) for bases object, SafeConfigParser
    

    Seemingly locale-related errors went away, but I still cannot run Ubuntu Software Center, even after attempt to reinstall it.

    Update 4.:

    After reinstalling some Python stuff and correcting order of base classes for SoftwareCenterConfig, I am getting this:

    $ software-center
    2013-06-09 14:24:06,002 - softwarecenter.ui.gtk3.app - INFO - setting up proxy 'None'
    2013-06-09 14:24:06,283 - softwarecenter.fixme - WARNING - logs to the root logger: '('/usr/lib/python2.7/dist-packages/dbus/proxies.py', 410, '_introspect_error_handler')'
    2013-06-09 14:24:06,283 - dbus.proxies - ERROR - Introspect error on com.ubuntu.sso:/com/ubuntu/sso/credentials: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ChildExited: Process /usr/lib/ubuntu-sso-client/ubuntu-sso-login exited with status 1
    Traceback (most recent call last):
      File "/usr/bin/software-center", line 130, in <module>
        app = SoftwareCenterAppGtk3(options, args)
      File "/usr/share/software-center/softwarecenter/ui/gtk3/app.py", line 338, in __init__
        self.icons)
      File "/usr/share/software-center/softwarecenter/ui/gtk3/session/appmanager.py", line 66, in __init__
        self.oauth_token = helper.find_oauth_token_sync()
      File "/usr/share/software-center/softwarecenter/backend/ubuntusso.py", line 141, in find_oauth_token_sync
        sso.find_credentials()
      File "/usr/share/software-center/softwarecenter/backend/login_impl/login_sso.py", line 75, in find_credentials
        self.proxy.find_credentials(self.appname, self._get_params())
      File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 70, in __call__
        return self._proxy_method(*args, **keywords)
      File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__
        **keywords)
      File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
        message, timeout)
    dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ChildExited: Process /usr/lib/ubuntu-sso-client/ubuntu-sso-login exited with status 1
    
    • gosalia
      gosalia almost 11 years
      Have you tried this sudo locale-gen?
    • Tadeck
      Tadeck almost 11 years
      @thefourtheye: Just did (see the update). I still see various errors, but the Python one still seems to be blocking (I see it when trying to install and/or run software-center). It is line 33 in /usr/share/software-center/softwarecenter/config.py, the definition of SoftwareCenterConfig class. If removal of software center did not work, I wonder what else is wrong.
    • Tadeck
      Tadeck almost 11 years
      @thefourtheye: If you have Ubuntu 13.04, could you tell me what is the result of calling python --version on your system?
    • gosalia
      gosalia almost 11 years
      Mine shows Python 2.7.4
    • gosalia
      gosalia almost 11 years
      Why dont you manually create the directory by mkdir /var/cache/software-center/xapian/?
    • Jose Silva
      Jose Silva almost 11 years
      This has little to do with the Ubuntu Software centre. Please add the output of cat /etc/environment to your question and check that you have language-pack-en installed by running sudo apt-get install language-pack-en.
    • Tadeck
      Tadeck almost 11 years
      @thefourtheye: I was rather trying to modify this Python script in order to get it working (it looks like software center is installed, but has bugs in the Python code). Fixing one bug shows another...
    • Tadeck
      Tadeck almost 11 years
      @nickguletskii: Updated the questions, as you asked. If you know any way of clearing what I have, please let me know. There must be some faster and less intrusive way of fixing this than removing the whole installation of Ubuntu and installing 13.04 again (I do not even know, if that would help, I just hope). I do not care about whether I have different languages than English, I can live without them.
    • stommestack
      stommestack almost 11 years
      Maybe report a bug
    • Lucio
      Lucio almost 11 years
      I would strongly recommend to report a bug. That will be the best way to have all the necessary tools to know what is going on in your system and solve it.
    • Yash Sharma
      Yash Sharma over 8 years
      This works for me on Ubuntu 14.04 : sudo pip2 install --upgrade zope.interface , sudo pip install --upgrade oauthlib
  • Tadeck
    Tadeck almost 11 years
    Thank you, that seemingly solved issues related to locale, but the crashing Software Center is still there. Could you check if your version of /usr/share/software-center/softwarecenter/config.py has the same code in line 33.?
  • Tadeck
    Tadeck almost 11 years
    Yup, did that before, but another error occurred (something involving dbus). Will try that again and inform you about the results. Thanks.
  • Jose Silva
    Jose Silva almost 11 years
    @Tadeck you should also try sudo apt-get --reinstall install python python-apt python-aptdaemon python-dbus
  • Tadeck
    Tadeck almost 11 years
    Did what you asked, still without results. Then I corrected this line in Python code, and now I am receiving different error from Python script. This time seemingly in Ubuntu SSO module. Please see question update.
  • Jose Silva
    Jose Silva almost 11 years
    @Tadeck Did you upgrade from 12.04 to 13.04 and then to 13.10? If so, check that the system is using the correct repositories.
  • Tadeck
    Tadeck almost 11 years
    No, I upgraded from 12.04 to 12.10 and then to 13.04 (lsb_release -a shows 13.04).
  • Jose Silva
    Jose Silva almost 11 years
    @Tadeck Yeah, sorry, that's what I meant. This looks like an issue brought by upgrades... It's difficult to say how to fix it.
  • Salman von Abbas
    Salman von Abbas almost 11 years
    WTH? 777? Are you serious? Not sure if a troll or just stupid.
  • b06
    b06 over 10 years
    Stupid... I meant 755 (or read + execute for group + others). Thanks for noticing though :)
  • Coder Guy
    Coder Guy almost 8 years
    Use chmod -R go+rX /usr/local/lib/python2.7/dist-packages as this ensures the execute permission is applied for groups and other only if some other user already has execute permission on a given file.