GPG error

今天在服务器上更换软件源时,碰见了如下错误,主要是提示“Couldn't create temporary file /tmp”

Err:1 http://mirrors.aliyun.com/ubuntu bionic InRelease
  Couldn't create temporary file /tmp/apt.conf.emq6YJ for passing config to apt-key
Reading package lists... Done
W: GPG error: http://mirrors.aliyun.com/ubuntu bionic InRelease: Couldn't create temporary file /tmp/apt.conf.emq6YJ for passing config to apt-key
E: The repository 'http://mirrors.aliyun.com/ubuntu bionic 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.
E: Sub-process returned an error code
root@larryhe1-s15-0:/etc/apt# mkdir /tmp
root@larryhe1-s15-0:/etc/apt# apt-get update
Get:1 http://mirrors.aliyun.com/ubuntu bionic InRelease [242 kB]
Err:1 http://mirrors.aliyun.com/ubuntu bionic InRelease
  Couldn't create temporary file /tmp/apt.conf.euv1j1 for passing config to apt-key
Reading package lists... Done
W: GPG error: http://mirrors.aliyun.com/ubuntu bionic InRelease: Couldn't create temporary file /tmp/apt.conf.euv1j1 for passing config to apt-key
E: The repository 'http://mirrors.aliyun.com/ubuntu bionic 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.

手动创建了/tmp文件夹还是无解。于是乎,找到了一篇博客:https://www.kaijia.me/2017/08/apt-get-couldnt-create-temporary-file-for-passing-config-to-apt-key-issue-solved/

参照博客内容:

chmod 777 /tmp
apt update
apt-get upgrade
解释:
显示apt-key等等实际上并不是直接使用/etc/apt/apt.conf配置文件,而是每次执行操作的时候将配置文件复制到临时文件夹下(以做一些修改等等)。虽然apt-get需要Root权限才能执行,但执行过程中的子任务,例如调用apt-key时,是交给_apt这一用户完成的。所以实际上问题很简单,既是目录对_apt用户缺少了权限,因此无法创建临时的apt.conf文件。
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值