解决报错: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 签约作者,欢迎关注我分享更多干货!



目录
相关文章
|
7月前
|
Ubuntu 安全
Ubuntu中遇到"无法创建临时文件"/tmp/..."在普通或root用户运行apt-get update时的错误解决办法
这些步骤当然不能涵盖所有可能出现问题的场合,但是能覆盖大多数常见的情景。希望这些信息能帮到你解决"无法创建临时文件"/tmp/..."这样的问题。不过,请记住,因为修改系统文件和目录的权限,清理临时文件,或者运行磁盘检查,都可能对系统造成影响,所以执行这些操作前要先确认这是安全的,必要时最好先做好数据备份。
447 10
|
移动开发 前端开发 HTML5
分享136个HTML公司企业模板,总有一款适合您
分享136个HTML公司企业模板,总有一款适合您
391 0
|
监控 Linux Docker
免费的5款Docker 容器 GUI 管理工具!后悔没早点发现!
免费的5款Docker 容器 GUI 管理工具!后悔没早点发现!
1962 0
|
缓存 NoSQL Linux
Redis(一)Centos7.6安装Redis服务
Centos的yum源中没有redis;这里我们需要安装一个第三方的yum源,这里用了Fedora的epel仓库。
3012 0
Redis(一)Centos7.6安装Redis服务
|
Python
Python函数的返回值深入解析
Python函数的返回值深入解析
433 1
|
缓存 Unix Linux
尝试安装或升级Python包时,由于设备上没有足够的空间而导致的错误
尝试安装或升级Python包时,由于设备上没有足够的空间而导致的错误
758 4
|
Python Windows
Pycharm最新激活教程(亲测有效!) 1
Pycharm最新激活教程(亲测有效!)
|
Web App开发 监控 数据可视化
【JVM实践入门篇】: VisualVM的插件下载
【JVM实践入门篇】: VisualVM的插件下载
970 0
【JVM实践入门篇】: VisualVM的插件下载
|
存储 运维 虚拟化
更改docker存储路径
更改docker存储路径
928 0
|
程序员 Linux Windows
Postman下载最新指南
看到很多小伙伴在问 Postman 下载的相关问题,花时间整理了下,下面教新入门的小伙伴如何去下载 Postman。