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
相关推荐
陈随易5 小时前
编程语言级别的Skill市场,AI Agent 的未来形态
前端·后端·程序员
IT_陈寒7 小时前
Vite的热更新突然不香了,排查三小时差点砸键盘
前端·人工智能·后端
子兮曰8 小时前
Agency-Agents 深度解析:400+ AI 专家的"梦之队"如何重塑开发工作流
前端·后端·vibecoding
用户8356290780519 小时前
Python 实现 PDF 文件加密与解密方法
后端·python
小满zs9 小时前
Go语言第二章(小无相功)
后端·go
用户8356290780519 小时前
使用 Python 冻结与拆分 Excel 窗格教程
后端·python
karry_k9 小时前
MyBatis批量insert-select踩坑:useGeneratedKeys=true 可能让PostgreSQL返回大量插入结果
java·后端
妙码生花9 小时前
从 PHP 到 AI + Golang,程序员自救转型手记(十九):点选验证码代码逐行目检
前端·后端·go
贰先生9 小时前
Xiuno BBS X版 用户封禁系统
后端
karry_k9 小时前
PostgreSQL 在 MyBatis 中执行正常 SQL 失效:一次 DELETE USING 踩坑记录
java·后端