You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

Parallels Desktop下Ubuntu 20.04.2 ARM64版本执行sudo apt update报错求助

Parallels Desktop下Ubuntu 20.04.2 ARM64版本执行sudo apt update报错求助

你好!从你贴出的报错信息来看,核心问题其实很明确,咱们一步步来解决:

问题根源分析

你遇到的两类错误本质上是同一个原因导致的:虚拟机的系统时间和真实世界的时间严重不同步——你的虚拟机时间比实际时间慢了80多天,这就导致:

  1. Docker源的证书因为“尚未到生效时间”被验证失败
  2. Ubuntu和NI源的Release文件也被判定为“还未到生效时间”,无法正常更新

具体解决步骤

1. 先同步虚拟机的系统时间(最关键)

这是解决所有问题的前提,有两种方式:

  • 自动同步(推荐):打开Parallels Desktop,选中你的Ubuntu虚拟机,点击右上角「设置」→「选项」→「时间同步」,勾选「与主机同步时间」(Mac主机就是“与Mac同步时间”),然后重启虚拟机就行。
  • 手动设置:如果自动同步没生效,直接手动输入当前真实时间,执行命令:
    sudo date -s "202X-MM-DD HH:MM:SS"
    
    202X-MM-DD HH:MM:SS替换成你当下的真实日期和时间,比如2024-05-20 15:10:00

2. 修复Docker源的证书验证问题

时间同步完成后,重新更新Docker的GPG密钥,确保证书能被正常识别:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

如果之前的Docker源配置有问题,也可以重新添加适配ARM64的正确源:

echo "deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu jammy stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

3. 重新执行更新命令

完成上面两步后,再运行:

sudo apt update

应该就能正常获取更新源的信息了。

你提供的原始报错信息

Hit:1 http://ports.ubuntu.com/ubuntu-ports jammy InRelease

Get:2 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease [119 kB]

Ign:3 https://download.docker.com/linux/ubuntu jammy InRelease

Get:4 https://download.ni.com/ni-linux-desktop/stream/deb/ni/focal focal InRelease [3,064 B]

Get:5 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease [109 kB]

Get:6 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease [110 kB]

Ign:3 https://download.docker.com/linux/ubuntu jammy InRelease Ign:3 https://download.docker.com/linux/ubuntu jammy InRelease Err:3 https://download.docker.com/linux/ubuntu jammy InRelease

Certificate verification failed: The certificate is NOT trusted. The certificate chain uses not yet valid certificate. Could not handshake: Error in the certificate verification.

[IP: 52.222.169.60 443]

Reading package lists... Done

E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/jammy-updates/InRelease is not valid yet (invalid for another 85d 3h 8min 50s). Updates for this repository will not be applied.

E: Release file for https://download.ni.com/ni-linux-desktop/stream/deb/ni/focal/dists/focal/InRelease is not valid yet (invalid for another 62d 0h 4min 59s). Updates for this repository will not be applied.

E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/jammy-backports/InRelease is not valid yet (invalid for another 85d 3h 9min 58s). Updates for this repository will not be applied.

E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/jammy-security/InRelease is not valid yet (invalid for another 85d 3h 8min 55s). Updates for this repository will not be applied.

备注:内容来源于stack exchange,提问作者JDoe

火山引擎 最新活动