WSL2下的Ubuntu 24.0突然apt update报错 Could not wait for server fd 的解决方案

我在WSL下面安装了Ubuntu 24.04.1 LTS (GNU/Linux 6.6.87.2-microsoft-standard-WSL2 x86_64)。 只要一执行apt update命令,它就给我报错:

bash 复制代码
Err:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu noble InRelease
  Could not wait for server fd - select (11: Resource temporarily unavailable) [IP: 101.6.15.130 443]
Err:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-updates InRelease
  Could not wait for server fd - select (11: Resource temporarily unavailable) [IP: 101.6.15.130 443]
Err:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-backports InRelease
  Could not wait for server fd - select (11: Resource temporarily unavailable) [IP: 101.6.15.130 443]

搞了好久一直不知道怎么回事,也怎么也解决不了。一开始,因为wsl老是重置我的/etc/resolv.conf,然后我ping外网也ping不通,那好,我就手动修改了,现在就可以ping得通了。可是,老是出现上面的问题,而且,我感觉它的反应是很慢的,这种感觉就是网络不通的症状。可是......我能够ping得通,也是用的国内源哇?

后来,我找到了这篇文章:APT: Could not wait for server fd - select (11: Resource temporarily unavailable) [IP: 10.158.100.1 8080]

然后,按照它里面所写的,我在/etc/apt/apt.conf.d/下面新增了一个90curtin-aptproxy配置文件:

bash 复制代码
Acquire::http::Proxy "http://127.0.0.1:7890";
Acquire::https::Proxy "http://127.0.0.1:7890";

你猜怎么着?畅通了。着实是诡异的问题。

另,从这个版本开始,apt的配置做了很大的改变,开始使用DEB822 格式来配置软件源:

ini 复制代码
Types: deb
URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
# Types: deb-src
# URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu
# Suites: noble noble-updates noble-backports
# Components: main restricted universe multiverse
# Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
Types: deb
URIs: http://security.ubuntu.com/ubuntu/
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

# Types: deb-src
# URIs: http://security.ubuntu.com/ubuntu/
# Suites: noble-security
# Components: main restricted universe multiverse
# Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

# 预发布软件源,不建议启用

# Types: deb
# URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu
# Suites: noble-proposed
# Components: main restricted universe multiverse
# Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

# # Types: deb-src
# # URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu
# # Suites: noble-proposed
# # Components: main restricted universe multiverse
# # Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
相关推荐
大黄说说1 小时前
深入 Go 语言 GMP 调度模型:高并发的秘密武器
后端
云原生指北1 小时前
Omnipub E2E 测试文章 - 自动化验证
后端
IT_陈寒2 小时前
SpringBoot自动配置揭秘:5个让开发效率翻倍的隐藏技巧
前端·人工智能·后端
添尹2 小时前
Go语言基础之数组
后端·golang
luom01024 小时前
SpringBoot - Cookie & Session 用户登录及登录状态保持功能实现
java·spring boot·后端
黄俊懿4 小时前
【架构师从入门到进阶】第二章:系统衡量指标——第一节:伸缩性、扩展性、安全性
分布式·后端·中间件·架构·系统架构·架构设计
希望永不加班4 小时前
SpringBoot 核心配置文件:application.yml 与 application.properties
java·spring boot·后端·spring
散峰而望4 小时前
【基础算法】从入门到实战:递归型枚举与回溯剪枝,暴力搜索的初级优化指南
数据结构·c++·后端·算法·机器学习·github·剪枝
前端付豪5 小时前
Memory V1:让 AI 记住你的关键信息
前端·后端·llm
编码忘我5 小时前
RokcetMq的顺序消费、防丢失、去重
后端