9

I am trying to install or remove any software but I am facing the error below:

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: active (exited) since Wed 2018-05-16 06:40:37 WAT; 1h 54min ago
     Docs: man:lvmetad(8)
    Tasks: 0 (limit: 4915)
   CGroup: /system.slice/lvm2-lvmetad.service

May 16 06:40:37 raikone-X555UB systemd[1]: Starting LSB: LVM2 metadata daemon...
May 16 06:40:37 raikone-X555UB systemd[1]: Started LSB: LVM2 metadata daemon.
dpkg: error processing package lvm2 (--configure):
 installed lvm2 package post-installation script subprocess returned error exit status 1
Processing triggers for shared-mime-info (1.9-2) ...
Processing triggers for gnome-menus (3.13.3-11ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for initramfs-tools (0.130ubuntu3) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-20-generic
Errors were encountered while processing:
 lvm2
E: Sub-process /usr/bin/dpkg returned an error code (1)

I tried to follow some tutorials here but didn't work for me.

  • Now I tried: apt-get -f install dpkg --configure -a apt-get update apt-get clean apt-get autoclean apt-get autoremove apt-get check apt-get -m update apt-get dist-upgrade – Helder Júnior May 16 '18 at 10:37
11

I've resolved this problem with:

sudo apt-get purge lvm2
sudo apt autoremove
sudo apt install lvm2

reboot the system, and new kernel should be installed. Furthermore, this discussion helped me.

|improve this answer|||||
4

If systemctl status lvm2-lvmetad returns Loaded: masked (/dev/null) you should unmask and enable it with

sudo systemctl unmask  lvm2-lvmetad && sudo systemctl enable lvm2-lvmetad

The command systemctl status lvm2-lvmetad.socket should return status confirming success.

If this approach doesn't work for you, you may have better luck with the purge/reinstall approach described here I would recommend having a good backup though.

Source:

https://unix.stackexchange.com/a/307058/67643

|improve this answer|||||
  • @HelderJúnior I'm glad this solution worked for you. The way we say thank you here is by accepting/upvoting answers that were the most helpful to us. As I recall this is mentioned in the tour Cheers! – Elder Geek May 18 '18 at 16:48
  • Thank you for this answer, this was a much better solution than purging and reinstalling lvm2! I had to unmask a few other things too in my particular case, but once I had the idea down it was just iteration. – Doktor J Mar 19 '19 at 18:25
0

I just encountered the same issue. In my case I ran the following commands to solve it:

sudo /bin/rm -rf /etc/lvm/  
sudo rm -rf /etc/lvm/backup/
sudo apt purge lvm2
sudo updatdb
sudo locate lvm2
sudo rm /var/crash/lvm2.0.crash
sudo rm /etc/systemd/system/lvm2-*
sudo rm /etc/systemd/system/sysinit.target.wants/lvm2-*
sudo apt install lvm2
sudo apt update
sudo apt upgrade
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.