Ubuntu执行sudo apt-get update报错E: Failed to fetch https://mirrors.aliyun.com/docker-ce/linux/ubuntu/di

Ubuntu执行sudo apt-get update报错E: Failed to fetch https://mirrors.aliyun.com/docker-ce/linux/ubuntu/dists/xenial/InRelease Unable to find expected entry ‘stable/source/Sources’ in Release file (Wrong sources.list entry or malformed file)

报错内容:

E: Failed to fetch https://mirrors.aliyun.com/docker-ce/linux/ubuntu/dists/xenial/InRelease  Unable to find expected entry 'stable/source/Sources' in Release file (Wrong sources.list entry or malformed file)
W: Failed to fetch https://pkg.jenkins.io/debian-stable/binary/InRelease  Could not resolve host: pkg.jenkins.io
W: Some index files failed to download. They have been ignored, or old ones used instead.

报错原因:

# 这个错误可能是由于源列表文件(/etc/apt/sources.list)中的条目不正确或文件格式不正确。
# 可以尝试使用以下命令备份源列表文件并创建一个新的源列表文件:

解决办法:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo nano /etc/apt/sources.list

# 在编辑器中打开源列表文件后,将内容替换为以下内容(适用于 Ubuntu 16.04,根据版本自查源地址):

# 阿里云镜像源:

  deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
  deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
  deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
  deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
  deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
  deb https://pkg.jenkins.io/debian-stable binary/

# 清华大学镜像源:
  deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
  deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
  deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
  deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
  deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
  deb https://pkg.jenkins.io/debian-stable binary/

# 将其中之一添加到 `/etc/apt/sources.list` 文件中,
# 保存后运行 `sudo apt-get clean' 'sudo apt-get update` 命令,应该可以成功更新索引文件

sudo apt-get clean

sudo apt-get update

补充:

如果还是没有办法解决问题,请按照下面步骤操作一遍

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

sudo apt-get clean

sudo apt-get update
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

_长风_

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值