为什么使用开发机保存的镜像创建的新开发机无法执行apt-get update命令

人工智能与算法机器学习技术服务知识库

问题描述

客户使用预置镜像创建开发机,能够正常执行apt-get update命令更新下载源,但基于该开发机保存镜像后,再使用该镜像创建新开发机后,在新开发机中无法使用apt-get update命令更新,出现如下所示报错:

root@di-2023042XXXXXX:/# sudo apt-get update
Get:1 http://mirrors.ivolces.com/ubuntu focal InRelease [265 kB]
Err:1 http://mirrors.ivolces.com/ubuntu focal InRelease
  Couldn't create temporary file /tmp/apt.conf.y0pDXH for passing config to apt-key
Get:2 http://mirrors.ivolces.com/ubuntu focal-security InRelease [114 kB]
Err:2 http://mirrors.ivolces.com/ubuntu focal-security InRelease
  Couldn't create temporary file /tmp/apt.conf.emazGJ for passing config to apt-key
Get:3 http://mirrors.ivolces.com/ubuntu focal-updates InRelease [114 kB]
Err:3 http://mirrors.ivolces.com/ubuntu focal-updates InRelease
  Couldn't create temporary file /tmp/apt.conf.e330LP for passing config to apt-key
Get:4 http://mirrors.ivolces.com/ubuntu focal-proposed InRelease [267 kB]
Err:4 http://mirrors.ivolces.com/ubuntu focal-proposed InRelease
  Couldn't create temporary file /tmp/apt.conf.6rJNyU for passing config to apt-key
Get:5 http://mirrors.ivolces.com/ubuntu focal-backports InRelease [108 kB]
Err:5 http://mirrors.ivolces.com/ubuntu focal-backports InRelease
  Couldn't create temporary file /tmp/apt.conf.WcFxX0 for passing config to apt-key
Get:6 https://developer.download.nvidia.cn/compute/cuda/repos/ubuntu2004/x86_64  InRelease [1581 B]
Err:6 https://developer.download.nvidia.cn/compute/cuda/repos/ubuntu2004/x86_64  InRelease
  Couldn't create temporary file /tmp/apt.conf.oBokD6 for passing config to apt-key
Reading package lists... Done
W: GPG error: http://mirrors.ivolces.com/ubuntu focal InRelease: Couldn't create temporary file /tmp/apt.conf.y0pDXH for passing config to apt-key
E: The repository 'http://mirrors.ivolces.com/ubuntu focal InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://mirrors.ivolces.com/ubuntu focal-security InRelease: Couldn't create temporary file /tmp/apt.conf.emazGJ for passing co

问题分析

  1. 根据报错信息Couldn't create temporary file /tmp/apt.conf.y0pDXH for passing config to apt-key可以得知,在更新源时无法创建临时文件将配置信息传递给 apt-key 。
  2. apt-key、apt.conf 等实际上并不是直接使用/etc/apt/apt.conf配置文件。而是每次执行操作时将配置文件复制到临时文件夹下,以此来进行修改等操作。而/tmp文件目录就是用来保存临时文件的目录。
  3. 怀疑执行子任务时,用户对保存临时文件的目录/tmp无操作权限。

问题解决

  1. 使用 webIDE 连接开发机。
  2. 执行chmod 777 /tmp命令添加全部权限。
  1. 验证执行apt-get update可成功更新。
52
0
0
0
相关产品
评论
未登录
看完啦,登录分享一下感受吧~
暂无评论