You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MSYS2无法下载包:连接mirror.msys2.org镜像服务器失败求助

解决MSYS2 pacman -Syu无法连接镜像服务器的问题

错误现象

执行pacman -Syu时出现如下错误:

$ pacman -Syu
:: Synchronizing package databases...
 clangarm64.db failed to download
 mingw32.db failed to download
 mingw64.db failed to download
 ucrt64.db failed to download
 clang32.db failed to download
error: failed retrieving file 'ucrt64.db' from mirror.msys2.org : Failed to connect to mirror.msys2.org port 443 after 30 ms: Couldn't connect to server
error: failed retrieving file 'clang32.db' from mirror.msys2.org : Failed to connect to mirror.msys2.org port 443 after 29 ms: Couldn't connect to server
error: failed retrieving file 'clangarm64.db' from mirror.msys2.org : Failed to connect to mirror.msys2.org port 443 after 36 ms: Couldn't connect to server
warning: too many errors from mirror.msys2.org, skipping for the remainder of this transaction
error: failed retrieving file 'mingw32.db' from mirror.msys2.org : Failed to connect to mirror.msys2.org port 443 after 36 ms: Couldn't connect to server

解决方案

1. 切换国内镜像源

编辑/etc/pacman.d/目录下的mirrorlist.mingw32、mirrorlist.mingw64、mirrorlist.ucrt64、mirrorlist.clang32、mirrorlist.clang64、mirrorlist.clangarm64文件,在文件开头添加对应国内镜像地址:

# 对应mirrorlist.mingw32
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686/
# 对应mirrorlist.mingw64
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86_64/
# 对应mirrorlist.ucrt64
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/ucrt64/
# 对应mirrorlist.clang32
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/clang32/
# 对应mirrorlist.clang64
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/clang64/
# 对应mirrorlist.clangarm64
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/clangarm64/

另外编辑/etc/pacman.d/mirrorlist.msys,添加:

Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/$arch/

2. 排查网络限制

  • 执行ping mirror.msys2.org,若无法ping通,说明网络存在防火墙拦截、DNS污染或代理配置问题
  • 若使用代理,在MSYS2终端手动配置代理环境变量:
    export http_proxy=http://你的代理地址:端口
    export https_proxy=http://你的代理地址:端口
    

3. 重置DNS配置

在MSYS2终端执行以下命令,切换公共DNS:

echo "nameserver 8.8.8.8" > /etc/resolv.conf

4. 手动同步数据库

如果上述方法无效,可直接下载对应数据库文件放到/var/lib/pacman/sync/目录,再执行pacman -Syu


内容的提问来源于stack exchange,提问作者Lynn

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.23 06:13:09