![运行 sudo apt update 和 upgrade 时出现问题](https://linux22.com/image/953632/%E8%BF%90%E8%A1%8C%20sudo%20apt%20update%20%E5%92%8C%20upgrade%20%E6%97%B6%E5%87%BA%E7%8E%B0%E9%97%AE%E9%A2%98.png)
这是输出:
Ign:2 ://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:1 ://archive.ubuntu.com/ubuntu jammy InRelease
Err:2 ://security.ubuntu.com/ubuntu jammy-security InRelease
Temporary failure resolving 'security.ubuntu.com'
Ign:3 ://archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:4 ://archive.ubuntu.com/ubuntu jammy-backports InRelease
Ign:1 ://archive.ubuntu.com/ubuntu jammy InRelease
Ign:3 ://archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:4 ://archive.ubuntu.com/ubuntu jammy-backports InRelease
Err:1 ://archive.ubuntu.com/ubuntu jammy InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:3 ://archive.ubuntu.com/ubuntu jammy-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
答案1
您可以通过以下方式清理并刷新 apt 缓存:
apt-get 清理
rm -rf /var/lib/apt/lists/*
apt-get 更新