ubantu22.04 源异常

问题

bash 复制代码
root@NGN-5004:/usr/lib/apt# apt-get update
命中:2 http://mirrors.aliyun.com/docker-ce/linux/ubuntu focal InRelease
命中:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal InRelease
命中:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates InRelease
命中:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports InRelease
命中:5 http://security.ubuntu.com/ubuntu focal-security InRelease
正在读取软件包列表... 完成
E: 无法找到获取软件包的渠道 /usr/lib/apt/methods/<http 所需的驱动程序。
N: 是否安装了 apt-transport-<http 软件包?
E: 无法下载 <http://mirrors.aliyun.com/docker-ce/linux/ubuntu>/dists/focal/InRelease
E: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。

解决

bash 复制代码
# 1. 暂时禁用所有第三方源
sudo mv /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/docker.list.disabled

# 2. 使用最简单的官方源
sudo tee /etc/apt/sources.list << 'EOF'
deb http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu focal-security main restricted universe multiverse
EOF

# 3. 现在应该可以更新了
sudo apt-get update

# 4. 安装 curl 和 wget(如果没有)
sudo apt-get install -y curl wget ca-certificates
相关推荐
大肥羊学校懒羊羊7 小时前
FAST-LIVO2 一键复现教程(Ubuntu 20.04 / ROS Noetic )
linux·运维·ubuntu
郝亚军7 小时前
libmodbus在Ubuntu 22.04上按arm64架构编译方法
linux·运维·ubuntu
学习是种信仰7 小时前
复现conda环境及Python 项目路径(PYTHONPATH)问题——基于Ubuntu
python·ubuntu·conda
cen__y8 小时前
Linux10(计算机网络01)
linux·运维·服务器·c语言·计算机网络·ubuntu
我先去打把游戏先8 小时前
【虚拟机专用】Ubuntu 22.04 LTS 服务器版本镜像下载
linux·服务器·ubuntu
海盗船长没有船y11 小时前
避坑指南:Ubuntu 启动报错 “Unable to mount root fs“ 的深层诱因与修复
linux·ubuntu·故障排除·dkms
东风微鸣11 小时前
Ubuntu 26.04 游戏配置指南:魔兽争霸3 Dota1
linux·ubuntu·游戏
郝亚军11 小时前
在Ubuntu 2.04上如何按照x86_64架构编译libmodbus库
linux·运维·ubuntu
小黑蛋学java11 小时前
Ubuntu Docker 安装手册
linux·ubuntu·docker
hjhcos1 天前
【pgsql】Ubuntu备份和清理数据库postgresql
数据库·ubuntu·postgresql