Дилемма Sources.list в Ubuntu 18.04 (неправильно сформированная запись 57)

Я хотел бы начать с заявления о том, что я новый пользователь, и хотел бы попросить вас всех относиться ко мне спокойно. Я читал другой пост с этой проблемой, за исключением того, что моя проблема немного отличается, и предлагаемые решения не привели к решению в моем случае, так что вот оно ...

Когда я пытаюсь ввести 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

Я прочитал, что выполняющиеся команды, которые удаляют строки из списка источников могут полностью испортить файл списка, поэтому я не решаюсь это сделать и не знаю, как раскомментировать строку.

Кроме того, чтобы обойти ограничение 8 ссылок, наложенное на участников с менее чем 10 очками репутации. Я был вынужден добавить пробелы в ссылках моего списка источников, чтобы избежать его регистрации в качестве ссылки, чтобы иметь возможность опубликовать этот вопрос. Поэтому, пожалуйста, игнорируйте лишние пробелы, которые будут представлены в нижнем подчеркивании в следующем примере ...

Пример: http_: //us.archive.ubunt....etc и т. Д.

Может кто-нибудь, пожалуйста, помогите, спасибо.

2
задан 12 September 2019 в 20:35

2 ответа

У Вас действительно есть уродливая строка. Многие, на самом деле, но включая определенного ошибка жаловались на. Я сохранил Ваш файл как 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

Это сделает следующее:

  1. Это создаст резервное копирование Вашего существующего sourcce.list названный /etc/apt/sources.list.bak таким образом, Вы не должны волноваться о повреждении его.
  2. Это заменит все случаи, где у Вас есть a c, l, или a 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
    

    Который является точно, что сделает эта команда.

1
ответ дан 2 December 2019 в 04:36

Проверьте этого:

# 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

У Вас не было пробелов между cosmicmain->, космическое основное И строки 47 и 52 были в основном тем же

Кроме того, я не предложил бы иметь различные версии дистрибутива, поскольку можно войти в проблему

0
ответ дан 2 December 2019 в 04:36

Другие вопросы по тегам:

Похожие вопросы: