安装软件包和 apt-get 更新时出错

安装软件包和 apt-get 更新时出错

我试图安装 mariadb-server,但是在安装过程中出现错误,尝试执行 apt-get update 时也出现大致相同的错误。

这是 apt-get update 的命令输出

root@autoapi:~# sudo apt-get update
Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
  System error resolving 'security.ubuntu.com:80' - getaddrinfo (16: Device or resource busy)
Err:2 http://it.archive.ubuntu.com/ubuntu bionic InRelease
  System error resolving 'it.archive.ubuntu.com:80' - getaddrinfo (16: Device or resource busy)
Err:3 http://it.archive.ubuntu.com/ubuntu bionic-updates InRelease
  System error resolving 'it.archive.ubuntu.com:80' - getaddrinfo (16: Device or resource busy)
Err:4 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease
  System error resolving 'ppa.launchpad.net:80' - getaddrinfo (16: Device or resource busy)
Err:5 http://ppa.launchpad.net/webupd8team/java/ubuntu bionic InRelease
  System error resolving 'ppa.launchpad.net:80' - getaddrinfo (16: Device or resource busy)
Reading package lists... Done
W: Failed to fetch http://it.archive.ubuntu.com/ubuntu/dists/bionic/InRelease  System error resolving 'it.archive.ubuntu.com:80' - getaddrinfo (16: Device or resource busy)
W: Failed to fetch http://it.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  System error resolving 'it.archive.ubuntu.com:80' - getaddrinfo (16: Device or resource busy)
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  System error resolving 'security.ubuntu.com:80' - getaddrinfo (16: Device or resource busy)
W: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/dists/bionic/InRelease  System error resolving 'ppa.launchpad.net:80' - getaddrinfo (16: Device or resource busy)
W: Failed to fetch http://ppa.launchpad.net/webupd8team/java/ubuntu/dists/bionic/InRelease  System error resolving 'ppa.launchpad.net:80' - getaddrinfo (16: Device or resource busy)
W: Some index files failed to download. They have been ignored, or old ones used instead.

服务器信息

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

我如何解决它?

答案1

检查你的 iptables 规则。你可能忘记指定接口和传入连接的规则:

iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

答案2

您可以尝试以下操作:

sudo rm -rf /var/lib/apt/lists/* 
sudo apt-get update

这将删除现有的 apt-get 缓存并强制重新下载所有内容。如果这不能解决问题,您将需要手动浏览软件源列表并删除无效条目。

这是一篇关于如何修复大多数 apt-get 错误的精彩文章: 修复 apt-get 错误

答案3

我引用了https://forums.developer.nvidia.com/t/dns-related-issues-with-custom-carrier-board-and-l4t-35-3-1/255657并且把/etc、/etc/systemd、/etc/systemd/system、/usr、/usr/lib、/usr/lib/systemd、/usr/lib/systemd/system上的大部分权限都改成了755权限。我出错的原因是,我对/root下的所有目录和文件都设置了777权限,而update对权限比较敏感,它的安全机制要求比较高,所以sudo apt-get update一直会报错。

相关内容