每当我尝试打开 Ubuntu 软件中心时,它都会在几秒钟内自动关闭。当我尝试从命令提示符运行更新时,会发生以下情况:
anujsharma@anuj-sharma:~$ sudo apt-get update
E: Malformed line 59 in source list /etc/apt/sources.list (dist parse)
E: The list of sources could not be read.
源列表 /etc/apt/sources.list 中的第 59 行是:
deb http://archive.canonical.com/ $(lsb_release-sc)partenr
我的 sources.list 文件如下:
# deb cdrom:[Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release amd64 (20130213)]/ dists/precise/main/binary-i386/
# deb cdrom:[Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release amd64 (20130213)]/ dists/precise/restricted/binary-i386/
# deb cdrom:[Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release amd64 (20130213)]/ precise main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://in.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http://in.archive.ubuntu.com/ubuntu/ precise main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://in.archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb-src http://in.archive.ubuntu.com/ubuntu/ precise-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://in.archive.ubuntu.com/ubuntu/ precise universe
deb-src http://in.archive.ubuntu.com/ubuntu/ precise universe
deb http://in.archive.ubuntu.com/ubuntu/ precise-updates universe
deb-src http://in.archive.ubuntu.com/ubuntu/ precise-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://in.archive.ubuntu.com/ubuntu/ precise multiverse
deb-src http://in.archive.ubuntu.com/ubuntu/ precise multiverse
deb http://in.archive.ubuntu.com/ubuntu/ precise-updates multiverse
deb-src http://in.archive.ubuntu.com/ubuntu/ precise-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://in.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://in.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu precise-security main restricted
deb-src http://security.ubuntu.com/ubuntu precise-security main restricted
deb http://security.ubuntu.com/ubuntu precise-security universe
deb-src http://security.ubuntu.com/ubuntu precise-security universe
deb http://security.ubuntu.com/ubuntu precise-security multiverse
deb-src http://security.ubuntu.com/ubuntu precise-security multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu precise partner
# deb-src http://archive.canonical.com/ubuntu precise partner
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http://extras.ubuntu.com/ubuntu precise main
deb http://archive.canonical.com/ $(lsb_release-sc)partenr
deb-src http://archive.canonical.com/ $(lsb_release-sc)partenr
deb-src http://extras.ubuntu.com/ubuntu precise main
现在我非常沮丧。请帮我摆脱这个错误。我甚至无法安装任何东西,甚至无法从终端、更新管理器或 Ubuntu 软件中心进行更新。
答案1
你确定这条线
deb http://archive.canonical.com/ $(lsb_release-sc)partenr
不应该是这样的吗
deb http://archive.canonical.com/ $(lsb_release-sc)partner
?
我猜想“格式错误的行”错误是由于“partner”一词拼写错误造成的
编辑:并且看起来下一行(第 60 行)也有同样的错误,假设它是一个。
您可能还需要在“partner”一词前留一个空格才能使其起作用(尚未测试过,因此我不能肯定地说)。作为比较,我的源文件中有类似的一行:
deb http://extras.ubuntu.com/ubuntu raring main
答案2
您的 /etc/apt/sources.list 文件的第 58 行和第 59 行有两个拼写错误。这两行是针对 Skype 的 Canonical Partner Repository。您目前在第 58 行和第 59 行中的内容如下:
deb http://archive.canonical.com/ $(lsb_release-sc)partenr
deb-src http://archive.canonical.com/ $(lsb_release-sc)partenr
您应该编辑这两行,使它们如下所示:
deb http://archive.canonical.com/ $(lsb_release -sc) partner
deb-src http://archive.canonical.com/ $(lsb_release -sc) partner
上面提到的“如下”是指“完全如下”,空格也很重要。要编辑 sources.list 文件,请打开终端并运行:
sudo nano '/etc/apt/sources.list'
如果您以前从未使用过 nano,那么它非常简单 - 保存文件和关闭 nano 的说明始终位于 nano 页面的底部。要在 nano 中保存文件,请使用键盘组合Ctrl+O然后按Enter。要退出 nano,请使用键盘组合Ctrl+ X。
现在,作为一次性操作,您应该告诉您的系统从它所知道的每个档案中拉下最新的软件列表,包括您刚刚通过编辑 sources.list 更改的 Skype 的 Canonical Partner Repository:
sudo apt-get update
答案3
用新的 sources.list 替换旧的
在终端中运行以下命令。
sudo mv /etc/apt/sources.list /etc/apt/sources.list.old
gksudo gedit /etc/apt/sources.list
将新生成的 sources.list 中的所有文本复制/粘贴到此文件。保存并关闭 Gedit。
现在,更新 apt。
sudo apt-get update