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

pack: Support --real-rootdev for RHCOS+LUKS #251

Merged
merged 1 commit into from
May 28, 2020

Conversation

cgwalters
Copy link
Member

Pairs with: coreos/coreos-assembler#1483

We want RHCOS to support offline installs too (it's key to the UX)
but the LUKS container complicates things. We discussed changing
the RHCOS LUKS bits to save the header in e.g. /boot but it's
a big change to that code, and introduces yet another layout
when we really want to switch to Ignition+LUKS.

@cgwalters
Copy link
Member Author

Current status is that this crashes with a checksum mismatch. Debugging this is fun! (any tips appreciated)

My notes:

  • We need to copy the LUKS header, so I think having OsmetPartition be the full partition is right
  • I think the fiemap offsets are all relative to the dm-linear device's start, but I need to verify this

@jlebon
Copy link
Member

jlebon commented May 27, 2020

I think the fiemap offsets are all relative to the dm-linear device's start, but I need to verify this

Yes, this is correct. We need the data offset of the LUKS container (cryptsetup luksDump prints this, but there's probably a cleaner way to query it), and add that to the fiemap offsets to have it be relative to the partition start. See #187 (comment).

src/cmdline.rs Show resolved Hide resolved
@cgwalters cgwalters force-pushed the osmet-rhcos branch 3 times, most recently from ef23c0d to ae787b5 Compare May 27, 2020 19:50
@cgwalters cgwalters marked this pull request as ready for review May 27, 2020 19:51
@cgwalters cgwalters changed the title WIP: pack: Support --real-rootdev for RHCOS+LUKS pack: Support --real-rootdev for RHCOS+LUKS May 27, 2020
Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

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

Thanks for tackling this! LGTM overall, just some minor comments.

src/cmdline.rs Outdated Show resolved Hide resolved
src/osmet/mod.rs Outdated Show resolved Hide resolved
src/osmet/mod.rs Outdated
let ((start_offset, end_offset), offset) = if let Some(mapping) = mapping {
let bdev = BlkDev { path: mapping.underlying_device.clone(), ..Default::default() };
let (start_offset, end_offset) = bdev.get_partition_offsets()?;
let offset = mapping.offset_bytes.checked_mul(512)
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, does this need to actually be * $sector_size? Or (like partition offsets), is it always in 512 blocks? We can punt on investigating this until we actually plumb through osmet for metal4k images.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question; yeah, I think we should defer this until we've gone through the metal4k exercise.
I wouldn't be surprised if for 4k we also had to change the LUKS bits in RHCOS too.

src/osmet/mod.rs Outdated Show resolved Hide resolved
Pairs with: coreos/coreos-assembler#1483

We want RHCOS to support offline installs too (it's key to the UX)
but the LUKS container complicates things.  We discussed changing
the RHCOS LUKS bits to save the header in e.g. `/boot` but it's
a big change to that code, and introduces yet another layout
when we really want to switch to Ignition+LUKS.
@cgwalters
Copy link
Member Author

cgwalters commented May 27, 2020

One argument to have the "preparation" in the supermin code in coreos-assembler is that it's code that isn't shipped in the main coreos-installer binary people download. An argument against that is that it's (currently) shell script which there's way, way, way too much of in my life...

Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

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

LGTM!

@jlebon
Copy link
Member

jlebon commented May 27, 2020

One argument to have the "preparation" in the supermin code in coreos-assembler is that it's code that isn't shipped in the main coreos-installer binary people download. An argument against that is that it's (currently) shell script which there's way, way, way too much of in my life...

I think it's fine as is. We'll rip this out anyway once we drop the baked LUKS container.

@cgwalters cgwalters merged commit 8bd9e05 into coreos:master May 28, 2020
@jlebon jlebon mentioned this pull request Jun 2, 2020
4 tasks
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.

2 participants