Elementary-Os
軟體中心立即崩潰,KeyError: ‘CODENAME’ onelementaryOS Luna
當我嘗試打開它時,我的軟體中心立即崩潰。在終端中,它看起來像這樣:
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'
備註:在這發生之前的一段時間,我遇到了一些更新失敗的問題,如此處所述。在那里和其他地方,人們建議將某些 ppas 的“luna”更改為“precise”。我這樣做了,不是通過編輯文件,而是通過軟體中心。我懷疑軟體中心的問題是由於這個原因。但是,在 /etc/apt/sources.list.d/elementary.list 和 /etc/apt/sources.list.d/patches.list 中將“精確”改回“luna”不會使軟體中心再次工作但帶回了更新問題。
通過執行以下操作解決了它:
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!