软件中心立即崩溃,并出现 KeyError:elementaryOS Luna 上的“CODENAME”

软件中心立即崩溃,并出现 KeyError:elementaryOS Luna 上的“CODENAME”

当我尝试打开我的软件中心时,它立即崩溃。在终端中它看起来像这样:

software-center
2014-08-29 17:44:29,262 - softwarecenter.fixme - WARNING - logs to the root logger: '('/usr/lib/python2.7/dist-packages/gi/importer.py', 51, 'find_module')'
2014-08-29 17:44:29,262 - root - ERROR - Could not find any typelib for Gst
2014-08-29 17:44:29,324 - softwarecenter.ui.gtk3.app - INFO - setting up proxy 'None'
2014-08-29 17:44:29,329 - softwarecenter.db.database - INFO - open() database: path=None use_axi=True use_agent=True
2014-08-29 17:44:29,489 - softwarecenter.backend.reviews - WARNING - Could not get usefulness from server, no username in config file
2014-08-29 17:44:29,559 - softwarecenter.ui.gtk3.app - INFO - show_available_packages: search_text is '', app is None.
2014-08-29 17:44:29,561 - softwarecenter.db.pkginfo_impl.aptcache - INFO - aptcache.open()
Traceback (most recent call last):
  File "/usr/bin/software-center", line 176, in <module>
    app.run(args)
  File "/usr/share/software-center/softwarecenter/ui/gtk3/app.py", line 1422, in run
    self.show_available_packages(args)
  File "/usr/share/software-center/softwarecenter/ui/gtk3/app.py", line 1352, in show_available_packages
    self.view_manager.set_active_view(ViewPages.AVAILABLE)
  File "/usr/share/software-center/softwarecenter/ui/gtk3/session/viewmanager.py", line 154, in set_active_view
    view_widget.init_view()
  File "/usr/share/software-center/softwarecenter/ui/gtk3/panes/availablepane.py", line 171, in init_view
    self.apps_filter)
  File "/usr/share/software-center/softwarecenter/ui/gtk3/views/catview_gtk.py", line 238, in __init__
    self.build(desktopdir)
  File "/usr/share/software-center/softwarecenter/ui/gtk3/views/catview_gtk.py", line 511, in build
    self._build_homepage_view()
  File "/usr/share/software-center/softwarecenter/ui/gtk3/views/catview_gtk.py", line 257, in _build_homepage_view
    self._append_banner_ads()
  File "/usr/share/software-center/softwarecenter/ui/gtk3/views/catview_gtk.py", line 372, in _append_banner_ads
    scagent.query_exhibits()
  File "/usr/share/software-center/softwarecenter/backend/scagent.py", line 119, in query_exhibits
    lang=get_language(), series=self.distro.get_codename())
  File "/usr/share/software-center/softwarecenter/distro/__init__.py", line 92, in get_codename
    self._distro_code_name = distro_info['CODENAME']
KeyError: 'CODENAME'

备注:在发生这种情况之前一段时间,我遇到了一些更新失败的问题,正如所讨论的这里。在那里和其他地方,人们建议将某些 ppa 的“luna”更改为“precise”。我不是通过编辑文件而是通过软件中心做到了这一点。我怀疑软件中心的问题就是由此引起的。但是,在 /etc/apt/sources.list.d/elementary.list 和 /etc/apt/sources.list.d/patches.list 中将“precise”改回“luna”并不会使软件中心再次工作但又带来了更新问题。

答案1

通过执行以下操作解决了该问题:

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install --reinstall base-files=6.5ubuntu6.7+elementary8~ubuntu0.2.1

我不是专家,所以我无法解释它,但我找到了解决方案这里。似乎与 /etc/os-release 和 /etc/lsb-release 有关。就我而言,在尝试上述解决方案之前,这些文件看起来像这样:

cat /etc/os-release
NAME="Ubuntu"
VERSION="12.04.5 LTS, Precise Pangolin"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu precise (12.04.5 LTS)"
VERSION_ID="12.04"

cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.5 LTS"

然后他们看起来像这样:

cat /etc/os-release
NAME="elementary OS"
VERSION="0.2.1 Luna"
ID="elementary OS"
ID_LIKE=ubuntu
PRETTY_NAME="elementary OS Luna"
VERSION_ID="0.2.1"

cat /etc/lsb-release
DISTRIB_ID="elementary OS"
DISTRIB_RELEASE=0.2.1
DISTRIB_CODENAME=luna
DISTRIB_DESCRIPTION="elementary OS Luna"

另外它还解决了我遇到的另一个问题,即添加ppas!

相关内容