无法激活服务“org.freedesktop.systemd1”:apt 升级后超时

无法激活服务“org.freedesktop.systemd1”:apt 升级后超时

当我跑常规

$ sudo apt update && sudo apt full-upgrade -y && sudo apt autoremove

我明白了

...
After this operation, 0 B of additional disk space will be used.
Setting up clamav-freshclam (0.103.2+dfsg-0ubuntu0.20.10.1) ...
Failed to reload daemon: Connection reset by peer
Failed to get unit file state for clamav-freshclam.service: Failed to activate service 'org.freedesktop.systemd1': timed out (service_start_timeout=25000ms)
Failed to retrieve unit state: Failed to activate service 'org.freedesktop.systemd1': timed out (service_start_timeout=25000ms)
clamav-freshclam.service is a disabled or a static unit not running, not starting it.
Failed to reload daemon: Failed to activate service 'org.freedesktop.systemd1': timed out (service_start_timeout=25000ms)
Failed to reload daemon: Failed to activate service 'org.freedesktop.systemd1': timed out (service_start_timeout=25000ms)
Failed to retrieve unit state: Failed to activate service 'org.freedesktop.systemd1': timed out (service_start_timeout=25000ms)
Failed to start clamav-freshclam.service: Connection timed out
See system logs and 'systemctl status clamav-freshclam.service' for details.
invoke-rc.d: initscript clamav-freshclam, action "start" failed.
Failed to get properties: Connection timed out
dpkg: error processing package clamav-freshclam (--configure):
 installed clamav-freshclam package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of clamav:
 clamav depends on clamav-freshclam (>= 0.103.2+dfsg) | clamav-data; however:
  Package clamav-freshclam is not configured yet.
  Package clamav-data is not installed.
  Package clamav-freshclam which provides clamav-data is not configured yet.

dpkg: error processing package clamav (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
 clamav-freshclam
 clamav
E: Sub-process /usr/bin/dpkg returned an error code (1)

虽然看起来这个问题,那里的答案没有帮助:

$ busctl | grep systemd1
org.freedesktop.systemd1                - -               -                (activatable) -                           -       -          

(硬重启后,此行不存在(activatable)。)

$ systemctl daemon-reexec
$ sudo kill 1
$ busctl | grep systemd1
org.freedesktop.systemd1                - -               -                (activatable) -                           -       -          
$ systemctl --version
systemd 246 (246.6-1ubuntu1.3)
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +ZSTD +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid

所以我无法重新启动它,并且版本高于 236,这有问题。

我该如何恢复?在当前状态下,我无法注销或关机。我必须硬重置。而且 apt 升级失败。

系统信息

$ uname -a
Linux codex 5.8.0-49-generic #55-Ubuntu SMP Wed Mar 24 14:45:45 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/apt/sources.list.d/* | grep -v "^#"
deb [arch=amd64] https://packages.microsoft.com/ubuntu/20.04/prod focal main
deb [arch=amd64] https://packages.microsoft.com/ubuntu/20.04/prod focal main
deb [arch=amd64] https://updates.signal.org/desktop/apt xenial main
deb [arch=amd64] https://updates.signal.org/desktop/apt xenial main
deb http://ppa.launchpad.net/ubuntuhandbook1/audacity/ubuntu focal main
$ cat /etc/apt/sources.list | grep -v "^#"
deb http://mirror.uchile.cl/ubuntu/ groovy main restricted
deb-src http://mirror.uchile.cl/ubuntu/ groovy restricted universe multiverse main #Added by software-properties
deb http://mirror.uchile.cl/ubuntu/ groovy-updates main restricted
deb-src http://mirror.uchile.cl/ubuntu/ groovy-updates restricted universe multiverse main #Added by software-properties
deb http://mirror.uchile.cl/ubuntu/ groovy universe
deb http://mirror.uchile.cl/ubuntu/ groovy-updates universe
deb http://mirror.uchile.cl/ubuntu/ groovy multiverse
deb http://mirror.uchile.cl/ubuntu/ groovy-updates multiverse
deb http://mirror.uchile.cl/ubuntu/ groovy-backports main restricted universe multiverse
deb-src http://mirror.uchile.cl/ubuntu/ groovy-backports main restricted universe multiverse #Added by software-properties
deb http://mirror.uchile.cl/ubuntu/ groovy-security main restricted
deb-src http://mirror.uchile.cl/ubuntu/ groovy-security restricted universe multiverse main #Added by software-properties
deb http://mirror.uchile.cl/ubuntu/ groovy-security universe
deb http://mirror.uchile.cl/ubuntu/ groovy-security multiverse

显然clamav是罪魁祸首。也会戳他们。

$ busctl | grep systemd1
org.freedesktop.systemd1                 1 systemd         root             :1.0          init.scope                  -       -          
$ sudo apt install clamav
...
Setting up clamav-base (0.103.2+dfsg-0ubuntu0.20.10.1) ...
uid=125(clamav) gid=134(clamav) groups=134(clamav)
Setting up clamav-freshclam (0.103.2+dfsg-0ubuntu0.20.10.1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/clamav-freshclam.service → /lib/systemd/system/clamav-freshclam.service.
Failed to reload daemon: Connection reset by peer
/usr/bin/deb-systemd-helper: error: systemctl preset failed on clamav-freshclam.service: No such file or directory
Failed to reload daemon: Failed to activate service 'org.freedesktop.systemd1': timed out (service_start_timeout=25000ms)
Failed to get unit file state for clamav-freshclam.service: Failed to activate service 'org.freedesktop.systemd1': timed out (service_start_timeout=25000ms)
Failed to retrieve unit state: Failed to activate service 'org.freedesktop.systemd1': timed out (service_start_timeout=25000ms)
clamav-freshclam.service is a disabled or a static unit, not starting it.
Failed to reload daemon: Failed to activate service 'org.freedesktop.systemd1': timed out (service_start_timeout=25000ms)
Failed to reload daemon: Failed to activate service 'org.freedesktop.systemd1': timed out (service_start_timeout=25000ms)
Failed to retrieve unit state: Connection timed out
Failed to start clamav-freshclam.service: Connection timed out
See system logs and 'systemctl status clamav-freshclam.service' for details.
invoke-rc.d: initscript clamav-freshclam, action "start" failed.
Failed to get properties: Failed to activate service 'org.freedesktop.systemd1': timed out (service_start_timeout=25000ms)
dpkg: error processing package clamav-freshclam (--configure):
 installed clamav-freshclam package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of clamav:
 clamav depends on clamav-freshclam (>= 0.103.2+dfsg) | clamav-data; however:
  Package clamav-freshclam is not configured yet.
  Package clamav-data is not installed.
  Package clamav-freshclam which provides clamav-data is not configured yet.

dpkg: error processing package clamav (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Processing triggers for systemd (246.6-1ubuntu1.3) ...
Failed to reload daemon: Failed to activate service 'org.freedesktop.systemd1': timed out (service_start_timeout=25000ms)
...
$ busctl | grep systemd1
org.freedesktop.systemd1                 - -               -                (activatable) -                           -       -          

这个问题已报告给 ClamAV, 也。

相关内容