Trusty Desktop (14.04.3) 中的软件中心损坏

Trusty Desktop (14.04.3) 中的软件中心损坏

当我usb-creator-gtk创建可启动的 14.04.3 USB 闪存驱动器时,问题就开始了。当应用程序实际运行时,synaptic(v 0.81.1)被启动(不是我启动的)。它的 GUI 在usb-creator-gtk悄悄退出后停留在屏幕上(没有错误消息)。我synaptic在 GUI 中手动终止了。

现在,software-center从 cli 或 gui 启动时会立即崩溃。synaptic另一方面,打开后似乎可以正常运行。我的 Unity 栏上现在有一个红白相间的“单行道”图标。单击它,我读到上面的几个菜单项:

出现错误。请从右键菜单运行软件包管理器或从终端运行 apt-get 以查看错误所在。错误消息为:未知错误:“(E:Opening /etc/apt/source.list - ifstream::ifstream(13:Permission denied))”。这通常意味着您安装的软件包具有未满足的依赖关系。

我尝试过的:

-1-上述简介下方是一些功能菜单项,其中包括“启动软件包管理器”。该菜单synaptic在 GUI 中启动。菜单“编辑//重新加载软件包信息”显示:

**Could not load all repo items**<BR>
Failed to fetch cdrom://Ubuntu 14.04.3 LTS _Trusty Tahr_ - Beta amd64 (20150805)/dists/trusty/main/binary-amd64/Packages  Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs
Failed to fetch cdrom://Ubuntu 14.04.3 LTS _Trusty Tahr_ - Beta amd64 (20150805)/dists/trusty/restricted/binary-amd64/Packages  Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs
Failed to fetch cdrom://Ubuntu 14.04.3 LTS _Trusty Tahr_ - Beta amd64 (20150805)/dists/trusty/main/binary-i386/Packages  Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs
Failed to fetch cdrom://Ubuntu 14.04.3 LTS _Trusty Tahr_ - Beta amd64 (20150805)/dists/trusty/restricted/binary-i386/Packages  Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs
Some index files failed to download. They have been ignored, or old ones used instead.

我从来没有 Trusty 14.04.3 的 CD-ROM,所以我继续排除故障......

-2-在其下方,我查看了菜单项“软件和更新”。
在其通常的 GUI 窗口中,所有设置都是空白的,我在过去 18 个月内添加的所有额外 ppa 都在那里。关闭后会生成崩溃报告。我将其签入/var/crash

$ ls -AFls /var/crash
   total 4512
   0 -rw-rw---- 1 root     whoopsie       0 Dec 29 09:47 .lock
  68 -rw-r----- 1 user      whoopsie   62385 Dec 29 11:06 _usr_bin_software-properties-gtk.1000.crash
   0 -rw-rw---- 1 user      whoopsie       0 Dec 29 11:06 _usr_bin_software-properties-gtk.1000.upload
   0 -rw------- 1 whoopsie whoopsie       0 Dec 29 11:06 _usr_bin_software-properties-gtk.1000.uploaded
  64 -rw-r----- 1 user      whoopsie   59440 Dec 29 11:32 _usr_bin_update-manager.1000.crash
   0 -rw-rw---- 1 user      whoopsie       0 Dec 29 11:32 _usr_bin_update-manager.1000.upload
   0 -rw------- 1 whoopsie whoopsie       0 Dec 29 11:32 _usr_bin_update-manager.1000.uploaded
  28 -rw-r----- 1 user      whoopsie   24652 Dec 29 11:08 _usr_share_oneconf_oneconf-service.1000.crash
   0 -rw-rw---- 1 user      whoopsie       0 Dec 29 11:08 _usr_share_oneconf_oneconf-service.1000.upload
   0 -rw------- 1 whoopsie whoopsie       0 Dec 29 11:08 _usr_share_oneconf_oneconf-service.1000.uploaded

相关内容是这里。其要点如下:

Traceback (most recent call last):
   File "/usr/lib/python3/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py", line 1149, in detect_drivers
     self.apt_cache = apt.Cache()
   File "/usr/lib/python3/dist-packages/apt/cache.py", line 107, in __init__
     self.open(progress)
   File "/usr/lib/python3/dist-packages/apt/cache.py", line 155, in open
     self._list.read_main_list()
 SystemError: E:Opening /etc/apt/sources.list - ifstream::ifstream (13: Permission denied)
UserGroups: adm cdrom dip lp lpadmin plugdev sambashare scanner sudo wireshark www-data
_LogindSession: /user/1000.user/c2.session
Architecture: amd64
DistroRelease: Ubuntu 14.04
Title: software-properties-gtk crashed with SystemError in open(): E:Opening /etc/apt/sources.list - ifstream::ifstream (13: Permission denied)
Uname: Linux 3.16.0-50-generic x86_64
UnreportableReason: E:Opening /etc/apt/sources.list - ifstream::ifstream (13: Permission denied), E:The list of sources could not be read., E:The package lists or status file could not be parsed or opened.

-3-由于 USC 损坏,我使用过滤器搜索了所有已安装的软件包software-centersynaptic并尝试重新安装它们,然后使用各种方式重新启动:

$ sudo apt-get --reinstall install software-center software-center-apt-daemon-plugins appinstall-data oneconf oneconf-common python3-oneconf python-oneconf

$ sudo aptitude reinstall software-center software-center-apt-daemon-plugins appinstall-data oneconf oneconf-common python3-oneconf python-oneconf

两者都安静地退出,但重启后没有任何变化,所以我尝试了......

-4-重建源列表:

$ sudo rm -f /var/lib/apt/lists* && sudo apt-get update

输出到 stdout 是这里

除了需要一张我没有的 14.04.3 CD-ROM 以及重建 apt 源列表之外,我严重地可以使用一些帮助。没有任何更新路径有点糟糕。

编辑1:

$ ls -lA /etc/apt/sources.list
-rw-r----- 1 root root 3022 Dec 29 10:38 /etc/apt/sources.list

... 以前从来没有意识到那/etc/apt/sources.list是“root root”。内容显示/etc/apt/sources.list为第一行未注释的行: deb cdrom:[Ubuntu 14.04.3 LTS _Trusty Tahr_ - Beta amd64 (20150805)]/ trusty main restricted 我认为这一定是在昨天启动时以某种方式插入的usb-creator-gtk。我完全不记得以前在那里见过这行。

答案1

从你的输出

$ ls -lA /etc/apt/sources.list
-rw-r----- 1 root root 3022 Dec 29 10:38 /etc/apt/sources.list

我们可以看到该文件的权限禁止非 root 用户和组进行读取访问。这是错误的,并会导致您遇到的错误。

要修复这些权限(可以肯定的是,我们最好修复所有文件的权限/etc/apt- 不用担心,默认情况下其他用户是可以读取的,甚至必须如此),请运行以下命令:

sudo chmod -R o+r /etc/apt

我来向你解释一下它的各个部分的作用:

  • sudo:以 root 用户身份运行以下命令
  • chmod:更改文件权限的命令
  • -R--recursive:的参数chmod,对给定的目录及其包含的所有文件和子目录进行递归操作
  • o+r:的权限修改规则chmod,告诉它授予(+)所有不是所有者/组(o)的其他人读取权限(r)。
  • /etc/apt:文件/目录参数chmod

相关内容