每次安装或删除软件包时,我都会收到 LVM2 错误

Chr*_*ris 21 dpkg lvm services 18.04

我需要帮助处理这个错误。我运行 Ubuntu Budgie 18.04LTS。

anon@computer:~$ sudo dpkg --configure -a
Setting up lvm2 (2.02.176-4.1ubuntu3) ...
update-initramfs: deferring update (trigger activated)
Failed to restart lvm2-lvmetad.service: Unit lvm2-lvmetad.socket is masked.
invoke-rc.d: initscript lvm2-lvmetad, action "restart" failed.
? lvm2-lvmetad.service - LVM2 metadata daemon
   Loaded: loaded (/lib/systemd/system/lvm2-lvmetad.service; static; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:lvmetad(8)
dpkg: error processing package lvm2 (--configure):
 installed lvm2 package post-installation script subprocess returned error exit status 1
Processing triggers for initramfs-tools (0.130ubuntu3.1) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-23-generic
Errors were encountered while processing:
 lvm2
anon@computer:~$ 
Run Code Online (Sandbox Code Playgroud)

以上几乎是我在安装/删除软件包时所看到的。我对linux相当陌生。我不知道如何解决这个问题。重新安装LVM2包没有帮助,也不dpkg --configure -adpkg --configure lvm2。但是,我可以很好地安装和删除软件包,似乎包括 lvm2 本身。

我也试过:

anon@computer:~$ sudo service lvm2-lvmetad start
Failed to start lvm2-lvmetad.service: Unit lvm2-lvmetad.socket is masked.

anon@computer:~$ sudo systemctl enable lvm2-lvmetad.socket
Failed to enable unit: Unit file /etc/systemd/system/lvm2-lvmetad.socket is masked.
Run Code Online (Sandbox Code Playgroud)

然后我尝试了此处链接的修复程序,但也没有用。检查 lvmetad 联机帮助页后,我做了:

anon@computer:~$ sudo pvscan --cache
[sudo] password for anon:                 
  WARNING: Failed to connect to lvmetad. Falling back to device scanning.
anon@computer:~$
Run Code Online (Sandbox Code Playgroud)

最后,我还尝试了循环供电、更新和升级所有东西等。我已经没有想法了,拜托了。

更新:我尝试了直接取消屏蔽套接字的建议。起初它似乎在我启用然后启动它没有说失败的 lvm2-lvmetad 服务时工作。我尝试升级软件包,但同样的错误仍然存​​在。

anon@computer:~$ sudo systemctl unmask lvm2-lvmetad.socket
Removed /etc/systemd/system/lvm2-lvmetad.socket.
anon@computer:~$ sudo systemctl enable lvm2-lvmetad.socket
anon@computer:~$ sudo service lvm2-lvmetad start
anon@computer:~$ sudo pvscan --cache
anon@computer:~$ sudo apt update && sudo apt upgrade
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu bionic InRelease                                          
Hit:3 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease                                  
Hit:4 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease          
Hit:5 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease
Hit:6 http://ppa.launchpad.net/otto-kesselgulasch/gimp/ubuntu bionic InRelease
Hit:7 http://ppa.launchpad.net/tista/adapta/ubuntu bionic InRelease           
Hit:8 http://ppa.launchpad.net/ubuntubudgie/backports/ubuntu bionic InRelease 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up lvm2 (2.02.176-4.1ubuntu3) ...
update-initramfs: deferring update (trigger activated)
Failed to restart lvm2-lvmpolld.service: Unit lvm2-lvmpolld.socket is masked.
invoke-rc.d: initscript lvm2-lvmpolld, action "restart" failed.
? lvm2-lvmpolld.service - LVM2 poll daemon
   Loaded: loaded (/lib/systemd/system/lvm2-lvmpolld.service; static; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:lvmpolld(8)
dpkg: error processing package lvm2 (--configure):
 installed lvm2 package post-installation script subprocess returned error exit status 1
Processing triggers for initramfs-tools (0.130ubuntu3.1) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-23-generic
Errors were encountered while processing:
 lvm2
E: Sub-process /usr/bin/dpkg returned an error code (1)
anon@computer:~$ 
Run Code Online (Sandbox Code Playgroud)

在包管理过程中仍然出现错误。

编辑:固定。有关详细信息,请参阅我的评论这是一个损坏的 lvm2 依赖项。

m02*_*3u5 38

对我有用的是完全摆脱 lvm2 然后重新安装它:

$ sudo apt purge lvm2 && sudo apt install lvm2
Run Code Online (Sandbox Code Playgroud)

清除(以上命令拆分)后,您还可以检查是否/etc/lvm已消失。如果不删除它。
这还不够apt remove lvm2

rm -rf /etc/lvm2 对我不起作用,或者至少还不够。