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
相关推荐
行智科技9 小时前
ORB-SLAM3代码详解 - 第 01 篇 · 系统总览与三线程架构
linux·ubuntu·架构·自动驾驶
街灯L9 小时前
【Ubuntu】使用ffmpeg解析m3u8网页视频
ubuntu·ffmpeg·音视频
嵌入式学习和实践13 小时前
Ubuntu 系统 socat 详细介绍与使用教程 - 映射任意两种数据通道
linux·ubuntu·虚拟串口·数据映射·socat
YYRAN_ZZU15 小时前
Ubuntu22.04搭建QEMU嵌入式开发环境全攻略
linux·嵌入式硬件·ubuntu
secret_to_me16 小时前
buildRoot编译rootfs实战
linux·c语言·c++·ubuntu·电脑·buildroot
很楠爱上17 小时前
TypeScript 核心知识精要
javascript·ubuntu·typescript
dust_and_stars17 小时前
在Ubuntu 24.04上设置Jupyter Notebook远程访问
linux·ubuntu·jupyter
x_lrong17 小时前
Ubuntu下安装配置Claude Code
linux·ubuntu·elasticsearch
济61717 小时前
ROS2 Humble 开发专栏---ROS2 三维视觉应用(1)---RGB-D 相机三维点云数据获取实验---适配Ubuntu 22.04
ubuntu·嵌入式·ros2·机器人开发·机器人方向
刘国华-平价IT运维课堂17 小时前
Ubuntu 26.04 LTS 发布,研发与运维需要关注什么?
linux·运维·服务器·人工智能·ubuntu