首先我要声明我是一名新用户,希望大家能对我宽容一点。我读过其他关于这个问题的帖子,但我的问题略有不同,提供的解决方案对我的情况没有起到作用,所以这里就不多说了...
当我尝试输入时sudo apt-get update
,遇到以下错误消息......
E: Malformed entry 57 in list file /etc/apt/sources.list(Component)
E: The list of sources could not be read.
在阅读了类似问题的回复后,我尝试sudo -H gedit /etc/apt/sources.list
该命令打开了我的来源列表:
# deb http://us.archive.ubuntu.com/ubuntu/bionic main restricted
# deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb http://security.ubuntu.com/ubuntu bionic-security main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic universe main restricted multiverse
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe main restricted multiverse
## 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://us.archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic universe
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-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://us.archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-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://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe 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 bionic partner
deb-src http://archive.canonical.com/ubuntu bionic partner
deb http://security.ubuntu.com/ubuntu bionic-security main restricted
deb-src http://security.ubuntu.com/ubuntu bionic-security universe main restricted multiverse
deb http://security.ubuntu.com/ubuntu bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse
deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main
# deb-src https://dl.winehq.org/wine-builds/ubuntu/ bionic main
deb https://dl.winehq.org/wine-builds/ubuntu/ cosmicmain
# deb-src https://dl.winehq.org/wine-builds/ubuntu/ cosmicmain
# deb-src https://dl.winehq.org/wine-builds/ubuntu/ cosmicmain
deb https://dl.winehq.org/wine-builds/ubuntu/ bionicmain
# deb-src https://dl.winehq.org/wine-builds/ubuntu/ bionicmain
deb https://dl.winehq.org/wine-builds/ubuntu/ xenialmain
# deb-src https://dl.winehq.org/wine-builds/ubuntu/ xenialmain
deb https://dl.winehq.org/wine-builds/ubuntu/ trustymain
# deb-src https://dl.winehq.org/wine-builds/ubuntu/ trustymain
我读到运行从源列表中删除行的命令可能会完全破坏你的列表文件,所以我犹豫着是否要这样做,而且我不知道如何取消注释一行。
此外,为了规避对声誉点数低于 10 的会员施加的 8 个链接限制。我不得不在来源列表的链接中添加空格,以避免将其注册为链接,以便能够发布此问题。因此,请忽略以下示例中将表示为下划线的额外空格...
例如:http_://us.archive.ubunt....etc 等等。
有人可以帮忙吗?谢谢。
答案1
您确实有格式错误的行。实际上有很多行,但包括错误所抱怨的特定行。我已将您的文件另存为file
,可以看到第 57 行是:
$ awk NR==57 file
# deb-src https://dl.winehq.org/wine-builds/ubuntu/ trustymain
你想要trusty main
而不是trustymain
。我不知道这是怎么回事,但很容易修复。只需运行以下命令:
sudo sed -i.bak -E 's/([cly])main/\1 main/' /etc/apt/sources.list
这将执行以下操作:
sourcce.list
它将创建您现有呼叫的备份/etc/apt/sources.list.bak
,因此您不必担心破坏它。它将用单词本身(无论是 、 还是 )加上一个空格来替换单词前紧接着出现的、或 的
c
所有l
情况。y
main
c
y
l
您需要这个,因为您有以下几行:
$ grep -P '^[^#].*\Smain' file deb https://dl.winehq.org/wine-builds/ubuntu/ cosmicmain deb https://dl.winehq.org/wine-builds/ubuntu/ bionicmain deb https://dl.winehq.org/wine-builds/ubuntu/ xenialmain deb https://dl.winehq.org/wine-builds/ubuntu/ trustymain
需要将其改为:
$ grep -P '^[^#].*\Smain' file | sed -E 's/([cly])main/\1 main/' deb https://dl.winehq.org/wine-builds/ubuntu/ cosmic main deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main deb https://dl.winehq.org/wine-builds/ubuntu/ xenial main deb https://dl.winehq.org/wine-builds/ubuntu/ trusty main
这正是该命令要做的事情。
答案2
检查一下:
# deb http://us.archive.ubuntu.com/ubuntu/bionic main restricted
# deb http: //us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb http://security.ubuntu.com/ubuntu bionic-security main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic universe main restricted multiverse
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe main restricted multiverse
## 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://us.archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic universe
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-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://us.archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-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://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe 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 bionic partner
deb-src http://archive.canonical.com/ubuntu bionic partner
deb http://security.ubuntu.com/ubuntu bionic-security main restricted
deb-src http://security.ubuntu.com/ubuntu bionic-security universe main restricted multiverse
deb http://security.ubuntu.com/ubuntu bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse
deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main
# deb-src https://dl.winehq.org/wine-builds/ubuntu/ bionic main
deb https://dl.winehq.org/wine-builds/ubuntu/ cosmic main
# deb-src https://dl.winehq.org/wine-builds/ubuntu/ cosmic main
# deb-src https://dl.winehq.org/wine-builds/ubuntu/ cosmic main
# deb-src https://dl.winehq.org/wine-builds/ubuntu/ bionic main
deb https://dl.winehq.org/wine-builds/ubuntu/ xenial main
# deb-src https://dl.winehq.org/wine-builds/ubuntu/ xenial main
deb https://dl.winehq.org/wine-builds/ubuntu/ trusty main
# deb-src https://dl.winehq.org/wine-builds/ubuntu/ trusty main
你之间没有任何空格宇宙主干->宇宙主宰 第 47 行和第 52 行基本相同
另外,我不建议使用不同版本的发行版,因为你可能会遇到麻烦