How to deal with Gentoo failing to boot due to "Locking type initialisation failed" on checkroot?

2

My system is Gentoo Linux based booting off an LVM based root partition.

The system successfully boots through the initrd. It starts the init of the main kernel, but then fails when trying to check the root drive (/etc/init.d/checkroot).

The error reported is that the root drive (/dev/vg/lv) is unavailable for fsck.whichever.

[Note: I have figured out one solution to this problem, and am posting this to help others. If you know a better approach I'd love to hear about it!]

kwutchak

Posted 2009-08-22T19:37:45.767

Reputation: 397

Answers

1

The issue could be that the LVM locking scheme is not allowing the volume group to be activated.

If lvm.conf has:

/etc/lvm/lvm.conf

locking_type = 1
:
locking_dir = "/var/lock/lvm"

Then the locking directory must be writeable for the volume group to be activated. This is a problem at the checkroot stage as the root file system is only read only at this point.

It is possible to set the locking_type to 0, but that carries data loss risks.

Several of the lvm commands accept the --ignorelockingfailure option, which allows the lock to be temporarily sidestepped. This is used in the initrd start scripts.

To get checkroot to work, I added two lines before it actually got started.

&& ! is_net_fs / && ! is_union_fs / ; then

+  lvm vgchange -ayl --ignorelockingfailure
+  lvm vgmknodes --ignorelockingfailure

   if touch -c / >& /dev/null ; then

kwutchak

Posted 2009-08-22T19:37:45.767

Reputation: 397