关键词:ubuntu, apt

ubuntu apt 的几个问题

碰到的问题:

执行 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys

会报错,报错如下:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Executing: /tmp/apt-key-gpghome.s1rywy7rMb/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys
gpg: invalid key resource URL '/tmp/apt-key-gpghome.s1rywy7rMb/home:manuelschneid3r.asc.gpg'
gpg: 密钥区块资源‘(null)’:一般错误
gpg: key 7721F63BD38B4796: 2 个签名因密钥遗失而未被检查
gpg: key 1488EB46E192A257: 1 个签名因密钥遗失而未被检查
gpg: key 3B4FE6ACC0B21F32: 3 个签名因密钥遗失而未被检查
gpg: key D94AA3F0EFE21092: 3 个签名因密钥遗失而未被检查
gpg: key 871920D1991BC93C: 1 个签名因密钥遗失而未被检查
gpg: 处理的总数:6
gpg:       已跳过的新密钥:6

解决:

  1. 首先删除 home:manuelschneid3r.asc.gpg 对应的位置: sudo rm /etc/apt/trusted.gpg.d/home:manuelschneid3r.asc

  2. 然后执行命令添加缺失的 key : sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7721F63BD38B4796 1488EB46E192A257

1
2
3
4
5
6
7
fupeng@fupeng:~/下载$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7721F63BD38B4796 1488EB46E192A257
Executing: /tmp/apt-key-gpghome.6gaCubwLuW/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 7721F63BD38B4796 1488EB46E192A257
gpg: 密钥 1488EB46E192A257:公钥 “home:manuelschneid3r OBS Project <home:[email protected]>” 已导入
gpg: 密钥 7721F63BD38B4796:“Google Inc. (Linux Packages Signing Authority) <[email protected]>” 未改变
gpg: 处理的总数:2
gpg:               已导入:1
gpg:              未改变:1

碰到如下错误是执行顺序错误导致的,按照正确的顺序来即可:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
fupeng@fupeng:~/下载$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7721F63BD38B4796 1488EB46E192A257
Executing: /tmp/apt-key-gpghome.Pha7uWyRAL/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 7721F63BD38B4796 1488EB46E192A257
gpg: 密钥 1488EB46E192A257:“home:manuelschneid3r OBS Project <home:[email protected]>” 未改变
gpg: 密钥 7721F63BD38B4796:“Google Inc. (Linux Packages Signing Authority) <[email protected]>” 未改变
gpg: 处理的总数:2
gpg:              未改变:2
gpg: invalid key resource URL '/tmp/apt-key-gpghome.Pha7uWyRAL/home:manuelschneid3r.asc.gpg'
gpg: 密钥区块资源‘(null)’:一般错误
gpg: key 7721F63BD38B4796: 2 个签名因密钥遗失而未被检查
gpg: key 1488EB46E192A257: 1 个签名因密钥遗失而未被检查
gpg: key 3B4FE6ACC0B21F32: 3 个签名因密钥遗失而未被检查
gpg: key D94AA3F0EFE21092: 3 个签名因密钥遗失而未被检查
gpg: key 871920D1991BC93C: 1 个签名因密钥遗失而未被检查
gpg: 处理的总数:6
gpg:       已跳过的新密钥:6

参考


问题:

dpkg: 处理软件包 xxx (–configure)时出错

第一步:备份

$ sudo mv /var/lib/dpkg/info /var/lib/dpkg/info.bk

第二步:新建

$ sudo mkdir /var/lib/dpkg/info

第三步:更新

$ sudo apt update $ sudo apt -f install

第四步:替换

$ sudo mv /var/lib/dpkg/info/* /var/lib/dpkg/info.bk //把更新的文件替换到备份文件夹

第五步:删除

$ sudo rm -rf /var/lib/dpkg/info //把自己新建的info文件夹删掉

第六步:还原

$ sudo mv /var/lib/dpkg/info.bk /var/lib/dpkg/info //把备份的info.bk还原

sudo mv /var/lib/dpkg/info /var/lib/dpkg/info.bk
sudo mkdir /var/lib/dpkg/info
sudo apt update
sudo apt -f install
sudo mv /var/lib/dpkg/info/* /var/lib/dpkg/info.bk 
sudo rm -rf /var/lib/dpkg/info 
sudo mv /var/lib/dpkg/info.bk /var/lib/dpkg/info

sudo openssl
req
-new
-x509
-newkey
rsa:2048
-keyout ${out_dir}/MOK.priv
-outform DER
-out ${out_dir}/MOK.der
-days 36500
-subj “/CN=${name}/”