Running an LVM command returns "File-based locking initialisation failed" or "Locking type 1 initialisation failed"
Environment
- Red Hat Enterprise Linux 4, 5, 6
- /var filesystem is readonly
Issue
- Running any LVM command returns a failure indicating locking initialisation has failed.
- On RHEL4, the following message is seen: "Locking type 1 initialisation failed."
- On RHEL5 or RHEL6, the following message is seen: "File-based locking initialisation failed"
Resolution
- It is recommended to restore /var to a writeable state, as a readonly /var may cause other issues.
- Workaround 1: Use --ignorelockingfailure option with the LVM command. See "man lvs" for further details.
- Workaround 2: Use an alternative lock file location by changing the value of the 'locking_dir' setting in the 'global' settings section of the LVM configuration.
- On the command line, using the --config option. Example:
# pvs --config 'global { locking_dir = "/tmp" } ' - In the lvm.conf file, look for "locking_dir" and change the value to a writeable directory.
# Miscellaneous global LVM2 settings global {...
# Local non-LV directory that holds file-based locks while commands are
# in progress. A directory like /tmp that may get wiped on reboot is OK.
locking_dir = "/var/lock/lvm"
...
}
- On the command line, using the --config option. Example:
Root Cause
- By default, LVM uses local file locks, and stores them in /var/lock/lvm. If this path is on a readonly filesystem, LVM cannot store its locks, no LVM command will run, and this message will be shown.
- In RHEL5.6, a known issue may also cause this message. See https://access.redhat.com/site/solutions/45475 for further details.
Diagnostic Steps
- Check the location of the LVM locking directory ('locking_dir' option) in lvm.conf. Verify the directory shown is on a read-only filesystem.
SBR
Product(s)
Components
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.