Bug 1489841

Summary: dracut does not activate LVM thin-provisioned snapshots
Product: Red Hat Enterprise Linux 7 Reporter: Bryn M. Reeves <bmr>
Component: dracutAssignee: Lukáš Nykrýn <lnykryn>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4CC: bmr, dracut-maint-list, harald, jstodola, pkotvan
Target Milestone: rc   
Target Release: 7.5   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: dracut-033-520.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 18:11:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1278192    

Description Bryn M. Reeves 2017-09-08 13:07:24 UTC
Description of problem:
LVM2 added a persistent 'skip activation' flag in 2.02.99 (July 2013), and this is automatically set for new thin-provisioned snapshot volumes:

  Version 2.02.99 - 24th July 2013
  ================================
    Automatically flag thin snapshots to be skipped during activation.
    Add support for persistent flagging of LVs to be skipped during activation.

This prevents users from activating these volumes during boot using the rd.lvm.lv dracut parameter since these volumes will not be activated by 'lvchange' unless the -K/--ignoreactivationskip option is given.

This is inconsistent with the behaviour for 'classic' LVM2 CoW snapshots (since these do not set the activation skip flag by default), and prevents a user from booting the system into a previously created snapshot of the root file system.

Since the user has given the named volume on the kernel command line it is safe to assume that they really intend to activate this device during boot (the boot will fail if the device is actually required anyway).

Version-Release number of selected component (if applicable):
dracut-033-*.el7

How reproducible:
100%

Steps to Reproduce:
1. Install a system to an LVM2 volume group with thin-provisioning enabled for the root volume.
2. Create a thinly provisioned snapshot of the root volume with lvcreate.
3. Attempt to boot the system using root=/dev/$LV_PATH rd.lvm.lv=$LV_PATH

Actual results:
Volume is not activated. Boot fails.

Expected results:
The named logical volume is activated with -K/--ignoreactivationskip

The only way for users to avoid this currently is to either use 'classic' snapshots, or to clear the activation skip flag on each snapshot to be used in this way (which may be undesirable for non-snapshot boot cases).

Additional info:
A PR was submitted to dracut on GitHub to add this capability to the lvm_scan.sh script:

  https://github.com/dracutdevs/dracut/pull/223/

Comment 4 Harald Hoyer 2017-10-12 09:23:56 UTC
merged upstream

Comment 6 Lukáš Nykrýn 2017-11-03 11:50:39 UTC
Hmm that part of code in rhel7 dracut is a bit different.
https://github.com/dracutdevs/dracut/blob/RHEL-7/modules.d/90lvm/lvm_scan.sh#L112
I could blindly place -K on line 112 and 114, but to be sure can you please look at it?

Also do we need now to set a dependency to a newer version of lvm?

Comment 7 Bryn M. Reeves 2017-11-03 12:08:00 UTC
That looks fine - the RHEL7 version has two activation commands to cope with older LVM2 versions that do not support the --sysinit option. There also seems to have been some consolidation of LVM argument handling as $lvm_quirk_args.

Adding the -K to both of these should achieve the same result in RHEL7.

Comment 8 Lukáš Nykrýn 2017-11-03 12:18:26 UTC
Thanks for quick reply!

https://github.com/dracutdevs/dracut/commit/0fe8ed5ccb19cf5fc4a55af1b44a6664c971b5af

Comment 10 Peter Kotvan 2017-12-12 08:25:11 UTC
I was able to reproduce this issue on RHEL-7.4 and verify the fix on RHEL-7.5-20171130.0 with dracut-033-520.el7.

Comment 13 errata-xmlrpc 2018-04-10 18:11:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0964