What to do if “failed to connect to lvmetad” slows down booting on Linux Mint or Ubuntu

As my system was very slow to boot, while grub loaded, I press the Esc key see what was wrong. The error related to “failed to connect to lvmetad” occurred frequently.

This error is due to improperly configured swap file for the resume of the laptop on hibernate. To fix this, open a terminal window and do following to find out the UUID for swap:
$ sudo blkid | grep swap <enter>
/dev/mapper/mint-swap: UUID=”76f1a846-eadb-46df-acbf-0e7a3cceee38” TYPE=”swap”
/dev/mapper/cryptswap1: UUID=”57c35b6d-8e8b-4c92-9ce6-de3fabe073e9″ TYPE=”swap”

Note the UUID of the mint-swap and cryptswap1 devices.

Next, check for the UUID in the /etc/crypttab file as follows:
$ sudo cat /etc/crypttab <enter>
It displays the following
cryptswap1 UUID=76f1a846-eadb-46df-acbf-0e7a3cceee38 /dev/urandom swap,offset=1024,cipher=aes-xts-plain64
sda7_crypt UUID=62149ccd-2d32-4a0b-89b9-e55aaed64d68 /crypto_keyfile.bin luks,keyscript=/bin/cat

To fix it, do following:
$ sudo vi /etc/initramfs-tools/conf.d/resume <enter>

where the UUID=76f1a846-eadb-46df-acbf-0e7a3cceee38 is that displayed by the /etc/crypttab command for the cryptswap1 entry above.

To make the changes to boot, do:
$ sudo update-initramfs -u <enter>

Restart the computer and it should boot faster. Essentially, this issue occurred due to a mismatch in the UUID of the encrypted swap partition and that displayed by the crypttab and blkid commands.