从 apt-get 更新中删除 Docker PPA

从 apt-get 更新中删除 Docker PPA

当我运行时apt-get update,我收到错误并忽略:

Ign:14 https://download.docker.com/linux/ubuntu hera InRelease                         
Hit:15 https://download.docker.com/linux/ubuntu bionic InRelease                       
Hit:16 http://ppa.launchpad.net/elementary-os/stable/ubuntu bionic InRelease           
Err:17 https://download.docker.com/linux/ubuntu hera Release                           
  404  Not Found [IP: 13.226.234.100 443]

我希望能够从我的列表中删除14和。17但是,当我运行时ls /etc/apt/sources.list.d,我只看到以下内容:

appcenter.list                              mc3man-ubuntu-mpv-tests-bionic.list.save
appcenter.list.save                         openvpn-aptrepo.list
deadsnakes-ubuntu-ppa-bionic.list           openvpn-aptrepo.list.save
deadsnakes-ubuntu-ppa-bionic.list.save      patches.list
elementary.list                             patches.list.save
elementary.list.save                        rednotebook-ubuntu-stable-bionic.list
fcitx-team-ubuntu-nightly-bionic.list       rednotebook-ubuntu-stable-bionic.list.save
fcitx-team-ubuntu-nightly-bionic.list.save  slack.list
google-chrome.list                          slack.list.save
google-chrome.list.save                     spotify.list
mc3man-ubuntu-mpv-tests-bionic.list         spotify.list.save

我怎样才能删除这两个项目?

答案1

我能够通过以下步骤修复它:

  1. 备份
    $ cp /etc/apt/sources.list /etc/apt/sources.list.save
    
  2. 找到仓库
    $ grep -ir "docker.com" /etc/apt/sources.list
    deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable
    # deb-src [arch=amd64] https://download.docker.com/linux/ubuntu focal stable
    
  3. 删除无效的仓库
    $ sudo add-apt-repository --remove 'deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable'
    

答案2

您可以使用add-apt-repository

sudo add-apt-repository --remove 'deb [arch=amd64] https://download.docker.com/linux/ubuntu hera stable'

sudo add-apt-repository --remove 'deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable'

答案3

我发现存储库存储在sources.list和中sources.list.save。要删除它们,我首先运行cd /etc/apt; grep -rI download.docker找到存储存储库的文件,然后运行:

sudo nano /etc/apt/sources.list
sudo nano /etc/apt/sources.list.save

并删除相应的行。

相关内容