Ubuntu学习之apt-get update 升级错误

今天在使用 apt-get update 时报错了

Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu xenial InRelease [247 kB]
Get:2 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security InRelease [107 kB]
0% [1 InRelease gpgv 247 kB] [Waiting for headers]Couldn't create tempfiles for splitting up /var/lib/apt/lists/partial/mirrors.cloud.aliyuncs.com_ubuntu_dists_Ign:1 http://mirrors.cloud.aliyuncs.com/ubuntu xenial InRelease
0% [2 InRelease gpgv 107 kB] [Waiting for headers]Couldn't create tempfiles for splitting up /var/lib/apt/lists/partial/mirrors.cloud.aliyuncs.com_ubuntu_dists_Ign:2 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security InRelease
Get:3 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates InRelease [109 kB]
0% [3 InRelease gpgv 109 kB]Couldn't create tempfiles for splitting up /var/lib/apt/lists/partial/mirrors.cloud.aliyuncs.com_ubuntu_dists_xenial-updates_InReleaIgn:3 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates InRelease
Get:4 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-proposed InRelease [260 kB]
0% [4 InRelease gpgv 260 kB]Couldn't create tempfiles for splitting up /var/lib/apt/lists/partial/mirrors.cloud.aliyuncs.com_ubuntu_dists_xenial-proposed_InReleIgn:4 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-proposed InRelease
Get:5 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-backports InRelease [107 kB]
0% [5 InRelease gpgv 107 kB]Couldn't create tempfiles for splitting up /var/lib/apt/lists/partial/mirrors.cloud.aliyuncs.com_ubuntu_dists_xenial-backports_InRelIgn:5 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-backports InRelease
Reading package lists... Error!
W: GPG error: http://mirrors.cloud.aliyuncs.com/ubuntu xenial InRelease: Could not execute 'apt-key' to verify signature (is gnupg installed?)
W: The repository 'http://mirrors.cloud.aliyuncs.com/ubuntu xenial InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Couldn't create temporary file to work with /var/lib/apt/lists/partial/mirrors.cloud.aliyuncs.com_ubuntu_dists_xenial_Release - mkstemp (2: No such file or directory)
W: GPG error: http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security InRelease: Could not execute 'apt-key' to verify signature (is gnupg installed?)
W: The repository 'http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Couldn't create temporary file to work with /var/lib/apt/lists/partial/mirrors.cloud.aliyuncs.com_ubuntu_dists_xenial-security_Release - mkstemp (2: No such file or directory)
W: GPG error: http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates InRelease: Could not execute 'apt-key' to verify signature (is gnupg installed?)
W: The repository 'http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Couldn't create temporary file to work with /var/lib/apt/lists/partial/mirrors.cloud.aliyuncs.com_ubuntu_dists_xenial-updates_Release - mkstemp (2: No such file or directory)
W: GPG error: http://mirrors.cloud.aliyuncs.com/ubuntu xenial-proposed InRelease: Could not execute 'apt-key' to verify signature (is gnupg installed?)
W: The repository 'http://mirrors.cloud.aliyuncs.com/ubuntu xenial-proposed InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Couldn't create temporary file to work with /var/lib/apt/lists/partial/mirrors.cloud.aliyuncs.com_ubuntu_dists_xenial-proposed_Release - mkstemp (2: No such file or directory)
W: GPG error: http://mirrors.cloud.aliyuncs.com/ubuntu xenial-backports InRelease: Could not execute 'apt-key' to verify signature (is gnupg installed?)
W: The repository 'http://mirrors.cloud.aliyuncs.com/ubuntu xenial-backports InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Couldn't create temporary file to work with /var/lib/apt/lists/partial/mirrors.cloud.aliyuncs.com_ubuntu_dists_xenial-backports_Release - mkstemp (2: No such file or directory)
E: Couldn't create temporary file to work with /var/lib/apt/lists/mirrors.cloud.aliyuncs.com_ubuntu_dists_xenial_Release - mkstemp (2: No such file or directory)
E: The package lists or status file could not be parsed or opened.

然后试着用以下指令

1 sudo rm /var/lib/apt/lists/* -vf
2 sudo apt-get update

具体解决:
run these two commands and it should get you fixed up.
Code:
sudo rm /var/lib/apt/lists/* -vf
The first command will remove the damaged list and when you run the second command it will replace it with a new list.

Code:
sudo apt-get update

然后突然想到前天被矿机坑过,我把tmp 文件夹给删了
重新新建了tmp 文件夹后,再试试

Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu xenial InRelease [247 kB]
Get:2 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security InRelease [107 kB]
0% [1 InRelease gpgv 247 kB] [2 InRelease 55.0 kB/107 kB 52%]Couldn't create tempfiles for splitting up /var/lib/apt/lists/partial/mirrors.cloud.aliyuncs.com_ubIgn:1 http://mirrors.cloud.aliyuncs.com/ubuntu xenial InRelease
Get:3 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates InRelease [109 kB]
Get:4 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-proposed InRelease [260 kB]
0% [2 InRelease gpgv 107 kB] [4 InRelease 110 kB/260 kB 42%]Couldn't create tempfiles for splitting up /var/lib/apt/lists/partial/mirrors.cloud.aliyuncs.com_ubuIgn:2 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security InRelease
0% [3 InRelease gpgv 109 kB] [4 InRelease 210 kB/260 kB 80%]Couldn't create tempfiles for splitting up /var/lib/apt/lists/partial/mirrors.cloud.aliyuncs.com_ubuIgn:3 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates InRelease
Get:5 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-backports InRelease [107 kB]
0% [4 InRelease gpgv 260 kB] [5 InRelease 62.1 kB/107 kB 58%]Couldn't create tempfiles for splitting up /var/lib/apt/lists/partial/mirrors.cloud.aliyuncs.com_ubIgn:4 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-proposed InRelease
0% [5 InRelease gpgv 107 kB]Couldn't create tempfiles for splitting up /var/lib/apt/lists/partial/mirrors.cloud.aliyuncs.com_ubuntu_dists_xenial-backports_InRelIgn:5 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-backports InRelease
Fetched 830 kB in 0s (8,379 kB/s)
Reading package lists... Done
W: GPG error: http://mirrors.cloud.aliyuncs.com/ubuntu xenial InRelease: Could not execute 'apt-key' to verify signature (is gnupg installed?)
W: The repository 'http://mirrors.cloud.aliyuncs.com/ubuntu xenial InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security InRelease: Could not execute 'apt-key' to verify signature (is gnupg installed?)
W: The repository 'http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates InRelease: Could not execute 'apt-key' to verify signature (is gnupg installed?)
W: The repository 'http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://mirrors.cloud.aliyuncs.com/ubuntu xenial-proposed InRelease: Could not execute 'apt-key' to verify signature (is gnupg installed?)
W: The repository 'http://mirrors.cloud.aliyuncs.com/ubuntu xenial-proposed InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://mirrors.cloud.aliyuncs.com/ubuntu xenial-backports InRelease: Could not execute 'apt-key' to verify signature (is gnupg installed?)
W: The repository 'http://mirrors.cloud.aliyuncs.com/ubuntu xenial-backports InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.

结果好了一点儿,现在证书又有问题了 。。。。。。。。。。。。。

其实这个是由于新建的 tmp 文件夹权限不够的原因

chmod 777 /tmp

apt-get update --allow-unauthenticated
  • 7
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
### 回答1: "apt-get update" 命令用于更新软件包清单,当这个命令失败时,可能是因为网络连接问题、软件源配置问题或者系统错误。 建议检查网络连接是否正常,确认软件源配置是否正确,如果问题依然存在,可以尝试使用 "apt-get update --fix-missing" 来修复错误。 ### 回答2: 当使用`apt-get update`命令更新Ubuntu系统包列表时,可能会出现失败的情况。下面是一些可能导致此问题的原因及解决办法: 1. 网络连接问题:首先,确保你的网络连接正常。可以尝试通过`ping`命令检查互联网连接是否稳定。如果网络连接有问题,可能需要检查网络设置、重启路由器或与网络管理员联系。 2. 软件源问题:`apt-get update`命令会从软件源中获取最新的软件包信息。如果你的软件源配置有问题,那么更新将会失败。可以尝试恢复默认的软件源配置,或者更换为其他可用的软件源。 3. 错误的代理设置:如果你使用了代理服务器来连接互联网,则需要确保代理服务器设置正确。你可以在终端中执行`echo $http_proxy`命令来检查当前的代理设置。如果设置了错误的代理,可以使用`export`命令来修改或删除代理设置。 4. 错误的密钥或签名:在软件源中,每个软件包都有一个相关的密钥或签名用于验证包的完整性。如果密钥或签名出现问题,`apt-get update`命令也会失败。可以尝试重新导入密钥或者更换软件源来解决问题。 5. 系统时间设置问题:如果你的系统时间设置有误,可能会导致与软件源服务器之间的连接失败。确保系统的时钟与实际时间一致,可以通过命令`date`来检查和修改系统时间。 总之,当`apt-get update`失败时,需要先排除网络连接问题,然后检查软件源配置、代理设置、密钥或签名以及系统时间等方面的问题,并采取相应的解决办法来解决问题。 ### 回答3: 在Ubuntu中,当我们运行apt-get update命令时,它会检查系统中所有已经安装的软件包,并且与存储在软件源中的最新版本进行比较,以便确保系统中的软件包是最新的。当apt-get update命令失败时,可能会有以下几个原因: 1. 网络连接问题:apt-get update命令需要连接到软件源服务器来检查软件包的更新。如果你的网络连接出现问题,可能导致apt-get update失败。你可以尝试检查网络连接是否正常,或者尝试在其他时间重新运行apt-get update命令。 2. 软件源配置问题:apt-get update命令需要访问正确的软件源来获取最新的软件包信息。如果你的软件源配置有误或过期,就会导致更新失败。你可以检查/etc/apt/sources.list文件中的软件源配置,确保其正确并且没有错误。 3. 防火墙或代理问题:如果你的系统上存在防火墙或代理设置,它们可能会阻止apt-get update命令的正常运行。你可以检查防火墙或代理设置,确保它们不会影响apt-get update命令的执行。 4. 软件源服务器问题:有时,软件源服务器可能出现故障或维护,导致apt-get update命令无法正常运行。在这种情况下,你只需要等待软件源服务器恢复正常,并重新运行apt-get update命令即可。 总结:当apt-get update命令失败时,我们可以首先检查网络连接、软件源配置、防火墙和代理设置等可能的问题。如果问题不在你的系统上,那么很可能是软件源服务器的问题,你只需要等待恢复即可。如果以上方法都没有解决问题,你可以尝试清除本地软件包缓存,再重新运行apt-get update命令来解决问题。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值