Systemd

Udev、libpam-systemd、systemd-sysv 和 systemd 依賴項錯誤導致無法使用

  • May 18, 2022

再次錯誤下載pop-desktop後,udev和systemd出現依賴錯誤,導致無法使用apt。當我執行 sudo apt upgrade 時,出現此錯誤:

user@computer:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
libpam-systemd : Depends: systemd (= 249.11-0ubuntu3.1)
systemd-sysv : Depends: systemd (= 249.11-0ubuntu3.1)
udev : Breaks: systemd (< 249.11-0ubuntu3.1)
       Breaks: systemd:i386 (< 249.11-0ubuntu3.1)
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

當我嘗試 sudo apt –fix-broken install 時:

user@computer:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
 libpam-systemd libudev1 libudev1:i386 systemd-sysv udev
The following packages will be DOWNGRADED:
 libpam-systemd libudev1 libudev1:i386 systemd-sysv udev
0 upgraded, 0 newly installed, 5 downgraded, 0 to remove and 63 not upgraded.
3 not fully installed or removed.
Need to get 0 B/2,708 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
dpkg: dependency problems prevent configuration of systemd:
udev (249.11-0ubuntu3.1) breaks systemd (<< 249.11-0ubuntu3.1) and is installed.
 Version of systemd to be configured is 249.11-0ubuntu3pop0~1650312774~22.04~cecf6af.

dpkg: error processing package systemd (--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:
systemd
E: Sub-process /usr/bin/dpkg returned an error code (1)

執行該命令後,我去了多個來源,找不到解決我的情況的解決方案。

我試過 sudo dpkg –configure -a 它回來了:

user@computer:~$ sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of systemd:
udev (249.11-0ubuntu3.1) breaks systemd (<< 249.11-0ubuntu3.1) and is installed.
 Version of systemd to be configured is 249.11-0ubuntu3pop0~1650312774~22.04~cecf6af.

dpkg: error processing package systemd (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of systemd-timesyncd:
systemd-timesyncd depends on systemd (= 249.11-0ubuntu3pop0~1650312774~22.04~cecf6af); however:
 Package systemd is not configured yet.

dpkg: error processing package systemd-timesyncd (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libnss-systemd:amd64:
libnss-systemd:amd64 depends on systemd (= 249.11-0ubuntu3pop0~1650312774~22.04~cecf6af); however:
 Package systemd is not configured yet.

dpkg: error processing package libnss-systemd:amd64 (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
systemd
systemd-timesyncd
libnss-systemd:amd64

我試過 sudo apt -f install 和 sudo apt –fix-broken install :

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
 libpam-systemd libudev1 libudev1:i386 systemd-sysv udev
The following packages will be DOWNGRADED:
 libpam-systemd libudev1 libudev1:i386 systemd-sysv udev
0 upgraded, 0 newly installed, 5 downgraded, 0 to remove and 63 not upgraded.
3 not fully installed or removed.
Need to get 0 B/2,708 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
dpkg: dependency problems prevent configuration of systemd:
udev (249.11-0ubuntu3.1) breaks systemd (<< 249.11-0ubuntu3.1) and is installed.
 Version of systemd to be configured is 249.11-0ubuntu3pop0~1650312774~22.04~cecf6af.

dpkg: error processing package systemd (--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:
systemd
E: Sub-process /usr/bin/dpkg returned an error code (1)

我也試過突觸:

                        Errors were encountered while processing:
systemd
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
dpkg: dependency problems prevent configuration of systemd:
udev (249.11-0ubuntu3.1) breaks systemd (<< 249.11-0ubuntu3.1) and is installed.
 Version of systemd to be configured is 249.11-0ubuntu3pop0~1650312774~22.04~cecf6af.

dpkg: error processing package systemd (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of systemd-timesyncd:
systemd-timesyncd depends on systemd (= 249.11-0ubuntu3pop0~1650312774~22.04~cecf6af); however:
 Package systemd is not configured yet.

dpkg: error processing package systemd-timesyncd (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libnss-systemd:amd64:
libnss-systemd:amd64 depends on systemd (= 249.11-0ubuntu3pop0~1650312774~22.04~cecf6af); however:
 Package systemd is not configured yet.

dpkg: error processing package libnss-systemd:amd64 (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
systemd
systemd-timesyncd
libnss-systemd:amd64

有沒有辦法解決這個 udev 和系統問題?如果這個問題已經解決了,能把解決的連結發過來嗎?只是想讓你知道,我正在使用 Pop!_OS 22.04 LTS。

我在 Pop_Os 上遇到了同樣的問題!22.04 LTS 和這裡的答案https://askubuntu.com/questions/146150/unable-to-fix-broken-packages-with-sudo-apt-get-install-f

為我解決了這個問題。我從該文件中刪除了 udev 條目,執行了成功完成的 apt 升級。

然後我確認 udev 回到了文件中,到目前為止一切似乎都很好,並且現在通過終端或流行商店進行更新,但我不能 100% 確定這是否會有任何負面的後續問題。

在做任何事情之前一定要備份文件以防萬一!

引用自:https://unix.stackexchange.com/questions/702334