今天早上我安装了一个小更新,但 apt 现在陷入了处理触发器的困境。我不知道为什么突然出现这个问题。
$ sudo apt upgrade --autoremove
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages will be REMOVED:
linux-image-5.10.0-10-amd64
The following packages will be upgraded:
libexpat1
1 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0 B/98.5 kB of archives.
After this operation, 302 MB disk space will be freed.
Do you want to continue? [Y/n] y
Reading changelogs... Done
(Reading database ... 152993 files and directories currently installed.)
Removing linux-image-5.10.0-10-amd64 (5.10.84-1) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.10.0-10-amd64
/etc/kernel/postrm.d/zz-update-grub:
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-5.10.0-12-amd64
Found initrd image: /boot/initrd.img-5.10.0-12-amd64
Found linux image: /boot/vmlinuz-5.10.0-11-amd64
Found initrd image: /boot/initrd.img-5.10.0-11-amd64
done
(Reading database ... 148225 files and directories currently installed.)
Preparing to unpack .../libexpat1_2.2.10-2+deb11u3_amd64.deb ...
Unpacking libexpat1:amd64 (2.2.10-2+deb11u3) over (2.2.10-2+deb11u2) ...
Setting up libexpat1:amd64 (2.2.10-2+deb11u3) ...
Processing triggers for libc-bin (2.31-13+deb11u2) ...
^C
它没有超时,当我尝试重新安装它时,我遇到了同样的问题:
$ sudo apt install libexpat1 --reinstall
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 0 B/98.5 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 148225 files and directories currently installed.)
Preparing to unpack .../libexpat1_2.2.10-2+deb11u3_amd64.deb ...
Unpacking libexpat1:amd64 (2.2.10-2+deb11u3) over (2.2.10-2+deb11u3) ...
Setting up libexpat1:amd64 (2.2.10-2+deb11u3) ...
Processing triggers for libc-bin (2.31-13+deb11u2) ...
^C
我仍然可以删除并安装像curl这样的小包,即使它再次以相同的方式挂起:
$ sudo apt remove curl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
curl
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 436 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 148225 files and directories currently installed.)
Removing curl (7.74.0-1.3+deb11u1) ...
Processing triggers for man-db (2.9.4-2) ...
$ sudo apt install curl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
curl
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/267 kB of archives.
After this operation, 436 kB of additional disk space will be used.
Selecting previously unselected package curl.
(Reading database ... 148217 files and directories currently installed.)
Preparing to unpack .../curl_7.74.0-1.3+deb11u1_amd64.deb ...
Unpacking curl (7.74.0-1.3+deb11u1) ...
Setting up curl (7.74.0-1.3+deb11u1) ...
Processing triggers for man-db (2.9.4-2) ...
^C
$ curl --version
curl 7.74.0 (x86_64-pc-linux-gnu) libcurl/7.74.0 OpenSSL/1.1.1k zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.43.0 librtmp/2.3
Release-Date: 2020-12-09
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets
以下是有关该系统的一些一般信息:
$ cat /etc/debian_version
11.2
$ apt --version
apt 2.2.4 (amd64)
$ uname -a
Linux <system> 5.10.0-12-amd64 #1 SMP Debian 5.10.103-1 (2022-03-07) x86_64 GNU/Linux
有什么建议下一步要检查什么吗?
答案1
通过使用pstree
和查看该apt
进程的子进程,我能够找到一个已挂起的 needrestart 进程:
|-systemd-+-(sd-pam)
| |-apt---sh---needrestart
但是 needrestart 使机器严重挂起,以至于我无法执行像 ps 这样的普通命令来获取 PID 来杀死它。我用大锤子解决了,然后重启了整机。
重新启动后,所有命令都按预期工作,并且安装似乎没有出错。甚至 libexpat1 也没有被 --audit 命令列为部分安装的软件包:
$ sudo dpkg --audit