0%

apt update 出现 cannot create /dev/null: Permission denied

解决方法

  • 原因是 /dev/null 设备可能被常规文件替换了,重新创建即可

方法一

  • 重启就好了,重启后该设备会自动重新创建

方法二

  • 手动重新创建该设备
1
rm -f /dev/null; mknod -m 666 /dev/null c 1 3
  • 重建之后看起来就正常了
1
2
3
4
5
Hit:1 http://mirrors.tencentyun.com/ubuntu focal InRelease
Hit:2 http://mirrors.tencentyun.com/ubuntu focal-security InRelease
Hit:3 http://mirrors.tencentyun.com/ubuntu focal-updates InRelease
Hit:4 http://ppa.launchpad.net/alessandro-strada/ppa/ubuntu focal InRelease
Reading package lists... Done

问题表现

这一大堆,我也懒得看…

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
❯ apt update
Hit:1 http://mirrors.tencentyun.com/ubuntu focal InRelease
Hit:2 http://mirrors.tencentyun.com/ubuntu focal-security InRelease
Hit:3 http://mirrors.tencentyun.com/ubuntu focal-updates InRelease
0% [Connecting to ppa.launchpad.net (91.189.95.85)]gpgv: Signature made Fri Apr 24 01:34:17 2020 CST
gpgv: using RSA key 3B4FE6ACC0B21F32
gpgv: Good signature from "Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>"
gpgv: Signature made Fri Apr 24 01:34:17 2020 CST
gpgv: using RSA key 871920D1991BC93C
gpgv: Good signature from "Ubuntu Archive Automatic Signing Key (2018) <ftpmaster@ubuntu.com>"
/usr/bin/apt-key: 57: cannot create /dev/null: Permission denied
0% [Connecting to ppa.launchpad.net (91.189.95.85)]gpgv: Signature made Tue Nov 2 05:30:01 2021 CST
gpgv: using RSA key 3B4FE6ACC0B21F32
gpgv: Good signature from "Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>"
gpgv: Signature made Tue Nov 2 05:30:01 2021 CST
gpgv: using RSA key 871920D1991BC93C
gpgv: Good signature from "Ubuntu Archive Automatic Signing Key (2018) <ftpmaster@ubuntu.com>"
/usr/bin/apt-key: 57: cannot create /dev/null: Permission denied
0% [Waiting for headers]gpgv: Signature made Tue Nov 2 05:30:35 2021 CST
gpgv: using RSA key 3B4FE6ACC0B21F32
gpgv: Good signature from "Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>"
gpgv: Signature made Tue Nov 2 05:30:35 2021 CST
gpgv: using RSA key 871920D1991BC93C
gpgv: Good signature from "Ubuntu Archive Automatic Signing Key (2018) <ftpmaster@ubuntu.com>"
/usr/bin/apt-key: 57: cannot create /dev/null: Permission denied
Hit:4 http://ppa.launchpad.net/alessandro-strada/ppa/ubuntu focal InRelease
0% [Working]gpgv: Signature made Sun Oct 24 03:17:20 2021 CST
gpgv: using RSA key 9EA4D6FCA5D37A5D1CA9C09AAD5F235DF639B041
gpgv: Good signature from "Launchpad PPA for Alessandro Strada"
/usr/bin/apt-key: 57: cannot create /dev/null: Permission denied
Reading package lists... Done

Ref

  • https://unix.stackexchange.com/questions/146633/bash-dev-null-permission-denied
-------------本文结束再接再厉-------------

本文标题:apt update 出现 cannot create /dev/null: Permission denied

文章作者:IITII

发布时间:2021年11月01日 - 16:11

最后更新:2021年11月01日 - 16:11

原始链接:https://iitii.github.io/2021/11/01/1/

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。