lvmetad is blocking boot process

I have a problem during boot: I see the message lvmetad is not active yet, using direct activation during sysinit. The message completely blocks my login process. I'm not able to switch to a non-graphical login screen (they all just show a blinking cursor) or perform any other action than rebooting with CTRL-ALT-DEL.

If I wait for a very long time (more than 10 minutes) I get the following message:

resume: Could not stat the resume file /dev/disk/by-uuid/a62a5e02...
Please type in the full path name to try again or press ENTER to boot the system:

If I press ENTER, booting resumes and my login screen comes up within a second - this only seems to work with older kernels <=4.4.0-43, with newer kernels, ENTER does nothing and I also cannot enter anything else using the keyboard.

The message after the 10 minute break resume: ... led me to think it could be related to a stale disk image after suspending to RAM, but I have no idea how to fix this.

I see no errors in dmesg, everything related to LVM looks fine there.

For a while I was able to boot without delay using kernel 4.4.0-43, but today (after a apt-get kernel upgrade) even this stopped to work.

I found these two threads about the problem, but I'm reluctant to try to change the grub video settings, since they (should) have nothing to do with lvmetad and users report that this workaround came with its own set of issues.

Lvmetad is not active yet

lvmetad is not active yet; using direct activation during sysinit

Can anybody talk me through this? Even in the old days booting did not take 10 minutes and nowadays it a 10 minute timeout seems to be a bit over the top... ;)

[EDIT] Here is the requested output:

blkid:

/dev/sda1: UUID="2EC7-7121" TYPE="vfat" PARTUUID="77533e31-4b1a-40da-9e49-ecebfb701229"
/dev/sda2: UUID="b206ab4e-2119-4d90-ab77-5088177faa08" TYPE="ext2" PARTUUID="a5ddb725-1822-4847-8fd3-c1566b83f740"
/dev/sda3: UUID="uhcPym-YPqH-XGTC-Y0YB-ynxd-K4iK-b0viGE" TYPE="LVM2_member" PARTUUID="455fe5cf-64a0-4ef5-b3e7-19e5f86b3ee4"
/dev/mapper/kubuntu--vg-root: UUID="cba585cc-e15b-419c-b055-f1fe2a56c7da" TYPE="ext4"

cat /etc/fstab:

/dev/mapper/kubuntu--vg-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda2 during installation
UUID=b206ab4e-2119-4d90-ab77-5088177faa08 /boot           ext2    defaults        0       2
# /boot/efi was on /dev/sda1 during installation
UUID=2EC7-7121  /boot/efi       vfat    umask=0077      0       1
/dev/mapper/kubuntu--vg-swap_1 none            swap    sw              0       0

swapon did not produce any output, but with option -a:

swapon: stat of /dev/mapper/kubuntu--vg-swap_1 failed: No such file or directory

[EDIT] In my grub.cfg I find references to an lvmid that does not correspond to any of the blkid - can this be the issue?

set root='lvmid/nvk03P-ihq7-kTsM-LvZ4-DzQu-iOag-4BOz7I/kHYiDJ-9NSq-Wlkc-0YXH-HiX2-SVZ7-MPSFnp'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='lvmid/nvk03P-ihq7-kTsM-LvZ4-DzQu-iOag-4BOz7I/kHYiDJ-9NSq-Wlkc-0YXH-HiX2-SVZ7-MPSFnp'  cba585    cc-e15b-419c-b055-f1fe2a56c7da

Also in grub.cfg there are some references to root and UUIDs - the UUID correspond to /boot (sda2) with --set root b2... and but two lines below there is root=/dev/mapper/kubuntu--vg-root which is a different device:

[---snip---]
if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  b206ab4e-2119-4d90-ab77-5088177faa08
    else
      search --no-floppy --fs-uuid --set=root b206ab4e-2119-4d90-ab77-5088177faa08
    fi
    linux   /vmlinuz-4.4.0-57-generic.efi.signed root=/dev/mapper/kubuntu--vg-root ro  quiet splash $vt_handoff
[---snip---]

[EDIT] Commenting the swap line in fstab does not help with booting and once the system boots, lvdisplay shows both, the root and the swap partition:

lvm> lvdisplay
  --- Logical volume ---
  LV Path                /dev/kubuntu-vg/root
  LV Name                root
  VG Name                kubuntu-vg
  LV UUID                kHYiDJ-9NSq-Wlkc-0YXH-HiX2-SVZ7-MPSFnp
  LV Write Access        read/write
  LV Creation host, time kubuntu, 2016-06-07 12:33:08 +0200
  LV Status              available
  # open                 1
  LV Size                432.86 GiB
  Current LE             110811
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0

  --- Logical volume ---
  LV Path                /dev/kubuntu-vg/swap_1
  LV Name                swap_1
  VG Name                kubuntu-vg
  LV UUID                YiuKj2-FVgn-ufGg-lvZ5-IML5-w3hH-ZeHrrH
  LV Write Access        read/write
  LV Creation host, time kubuntu, 2016-06-07 12:33:08 +0200
  LV Status              available
  # open                 0
  LV     Size                31.93 GiB
  Current LE             8173
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1

[EDIT] Following the suggestions of heynnema below, I remove and re-added swap. There was indeed something wrong : /proc/swaps was empty and free showed a total of 0 before removing and re-creating swap. Now it gets mounted properly and free as well as /proc/swaps show the expected output. Unfortunately the initial issue with the boot delay persists. After this step, I had to update iniramfs (update-initramfs -k all -c) - now it works. Phew. Thanks to heynnema for the great support!


Solution 1:

The lvmetad is not active yet, using direct activation during sysinit is a normal message, and is not causing your boot problem.

Somebody deleted your swap partition.

/etc/fstab has this line:

/dev/mapper/kubuntu--vg-swap_1 none            swap    sw              0       0

looking for a swap partition it never finds. The sudo blkid and the swapon commands confirm this.

Short term fix, comment out the above line in fstab:

In terminal...

gksudo gedit /etc/fstab

change

/dev/mapper/kubuntu--vg-swap_1 none            swap    sw              0       0

to this

#/dev/mapper/kubuntu--vg-swap_1 none            swap    sw              0       0

This will allow you to boot in a normal timeframe, but the system will have no defined swap space.

Long term fix, install the LVM GUI tool to manage your LVM disks:

In terminal...

sudo apt-get update
sudo apt-get install system-config-lvm

Go to the Unity dashboard and type lvm. Use this GUI tool to remake your LVM swap partition. Then go back and uncomment the line from the short term fix.