Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

harv-install: deactivate LVM in spite of global_filter #711

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

tserong
Copy link
Contributor

@tserong tserong commented Apr 19, 2024

Problem:

harvester/os2#86 adds a global_filter to /etc/lvm/lvm.conf to avoid activing LVM on the host. Unfortunately, dracut-initqueue runs very early in the boot process (before any of the elemental stages are run), so this filter isn't taken into account on boot, and LVM volumes are still potentially activated. Later, when we try to run blkdeactivate in harv-install, it doesn't work, because the filter is active then, so it skips deactivation and then the subsequent disk repartitioning fails.

Solution:

We can work around this by setting up a temporary lvm config which has that global_filter stripped out.

Related Issue:

harvester/harvester#5398

Test plan:

Note: this requires real hardware (I couldn't reproduce the problem running the installer in a VM):

  1. Create LVM volumes on the disk you plan to install on. There's several ways to do this, including:
    • Boot the installer, then switch to the second console, use pvcreate, vgcreate and lvcreate to create a volume or volumes on the disk you plan to install on.
    • Install a Linux distro (whichever you like), ensuring that LVM is set up during the partitioning step.
  2. Boot the 1.3.0 ISO and try to install. Verify that installation fails as described in the related issue.
  3. Boot the ISO with this fix, and verify that installation succeeds, or at least that the LVM volumes are deactivated and the disk is successfully repartitioned (once we get past that point, we know we're good - we don't need to wait for the entire installation to complete).

harvester/os2#86 adds a global_filter to
/etc/lvm/lvm.conf to avoid activing LVM on the host.  Unfortunately,
dracut-initqueue runs _very_ early in the boot process (before any of
the elemental stages are run), so this filter isn't taken into account
on boot, and LVM volumes are still potentially activated.  Later, when
we try to run `blkdeactivate` in `harv-install`, it doesn't work,
because the filter _is_ active then, so it skips deactivation and then
the subsequent disk repartitioning fails.  We can work around this by
setting up a temporary lvm config which has that global_filter stripped
out.

Related issue: harvester/harvester#5398

Signed-off-by: Tim Serong <tserong@suse.com>
Copy link
Member

@bk201 bk201 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgmt, thanks!

Copy link
Contributor

@Vicente-Cheng Vicente-Cheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch! Thanks!

@Vicente-Cheng Vicente-Cheng merged commit 43dd846 into harvester:master Apr 19, 2024
5 checks passed
@Vicente-Cheng
Copy link
Contributor

@Mergifyio backport v1.2

Copy link

mergify bot commented Apr 19, 2024

backport v1.2

✅ Backports have been created

@Vicente-Cheng
Copy link
Contributor

@Mergifyio backport v1.3

Copy link

mergify bot commented Apr 19, 2024

backport v1.3

✅ Backports have been created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants