解决报错:Couldn't create temporary file /tmp/apt.conf.IRqbCz

简介: 问题操作容器应该是属于服务器开发同学的常规操作,经常我们会遇到系统缺少对应的工具的情况,比如我们进入容器后,想使用 vim 修改某个文件,但是发现该容器没有安装 vim 工具。这个时候,一般都需要自己手动安装,比如在 unbuntu 系统中,可以使用 apt-get 包管理命令。

目录

  • 问题
  • 解决
  • 结尾

问题

操作容器应该是属于服务器开发同学的常规操作,经常我们会遇到系统缺少对应的工具的情况,比如我们进入容器后,想使用 vim 修改某个文件,但是发现该容器没有安装 vim 工具。这个时候,一般都需要自己手动安装,比如在 unbuntu 系统中,可以使用 apt-get 包管理命令。

但是,执行 apt-get install vim 命令时,提示没有仓库记录,因此,需要先更新包管理仓库列表,也就是执行 apt-get update 命令,但是遇到了如下报错信息:

root@al-bj-boom-hb-backstage-01:/etc/nginx# apt-get update
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Err:1 http://security.debian.org/debian-security buster/updates InRelease
  Couldn't create temporary file /tmp/apt.conf.IRqbCz for passing config to apt-key
Get:2 http://deb.debian.org/debian buster InRelease [122 kB]
Err:2 http://deb.debian.org/debian buster InRelease
  Couldn't create temporary file /tmp/apt.conf.Afcu25 for passing config to apt-key
Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
Err:3 http://deb.debian.org/debian buster-updates InRelease
  Couldn't create temporary file /tmp/apt.conf.fztemY for passing config to apt-key
Reading package lists... Done
W: GPG error: http://security.debian.org/debian-security buster/updates InRelease: Couldn't create temporary file /tmp/apt.conf.IRqbCz for passing config to apt-key
E: The repository 'http://security.debian.org/debian-security buster/updates 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://deb.debian.org/debian buster InRelease: Couldn't create temporary file /tmp/apt.conf.Afcu25 for passing config to apt-key
E: The repository 'http://deb.debian.org/debian buster 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://deb.debian.org/debian buster-updates InRelease: Couldn't create temporary file /tmp/apt.conf.fztemY for passing config to apt-key
E: The repository 'http://deb.debian.org/debian buster-updates 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.

解决

解决方法总结下来也非常简单,执行下面的命令就可以了:

chmod 777 /tmp

执行后,再执行 apt-get update 命令,终于成功啦!

执行过程如下:

root@al-bj-boom-hb-backstage-01:/etc/nginx# chmod 777 /tmp
root@al-bj-boom-hb-backstage-01:/etc/nginx# apt-get update
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:2 http://deb.debian.org/debian buster InRelease [122 kB]
Get:3 http://security.debian.org/debian-security buster/updates/main amd64 Packages [308 kB]
Get:4 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7906 kB]
Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [15.2 kB]
Fetched 8230 kB in 4min 19s (31.7 kB/s)
Reading package lists... Done

整体过程截图如下:

image.png

结尾

更新完 apt-get 的工具库列表,我们就可以正常安装和使用 vim 工具啦!实时证明:确实好用。



作者简介:大家好,我是 liuzhen007,是一位音视频技术爱好者,同时也是CSDN博客专家、华为云享专家(共创编辑)、InfoQ 签约作者,欢迎关注我分享更多干货!



目录
相关文章
|
5月前
|
Ubuntu 安全
Ubuntu中遇到"无法创建临时文件"/tmp/..."在普通或root用户运行apt-get update时的错误解决办法
这些步骤当然不能涵盖所有可能出现问题的场合,但是能覆盖大多数常见的情景。希望这些信息能帮到你解决"无法创建临时文件"/tmp/..."这样的问题。不过,请记住,因为修改系统文件和目录的权限,清理临时文件,或者运行磁盘检查,都可能对系统造成影响,所以执行这些操作前要先确认这是安全的,必要时最好先做好数据备份。
264 10
|
Linux Shell 网络安全
|
监控 Linux Docker
免费的5款Docker 容器 GUI 管理工具!后悔没早点发现!
免费的5款Docker 容器 GUI 管理工具!后悔没早点发现!
1765 0
|
Ubuntu 开发工具
Ubuntu更换阿里云软件源
Ubuntu更换阿里云软件源
141262 0
|
缓存 Linux 开发工具
CentOS 7- 配置阿里镜像源
阿里镜像官方地址http://mirrors.aliyun.com/ 1、点击官方提供的相应系统的帮助 :2、查看不同版本的系统操作: 下载源1、安装wget yum install -y wget2、下载CentOS 7的repo文件wget -O /etc/yum.
255335 0
|
存储 Linux
挂在mount报错can't read superblock修复过程
`can't read superblock`错误表明存在文件系统或硬件问题,解决这类问题需要先从软件层面尝试修复,无效时再考虑硬件替换。值得注意的是,数据备份对于防范这类突发故障至关重要,应定期进行数据备份,以最大限度减少数据丢失风险。
6672 3
|
Linux
Linxu开机出现 Generating "/run/initramfs/rdsosreport.txt"解决方案
Linux启动时遇到`Generating "/run/initramfs/rdsosreport.txt"`错误,通常是文件系统问题。解决方案包括:1) 使用`ls /dev/mapper`找到-root卷;2) 运行`xfs_repair /dev/mapper/xxx-root`修复(可能需多次尝试);3) 若失败,风险下`umount`卷并检查无打开文件;4) 再次运行`xfs_repair`;5) 重启系统。注意:卸载可能导致数据丢失。
2130 0
|
Python
Python函数的返回值深入解析
Python函数的返回值深入解析
305 1
|
存储 编解码 算法
栅格数据矢量化(附有完整代码)
栅格数据矢量化(附有完整代码)