Skip to content

Reinstall mount warning #1299

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

Merged
merged 2 commits into from
May 14, 2025
Merged

Conversation

ckyrouac
Copy link
Collaborator

@ckyrouac ckyrouac commented May 6, 2025

@cgwalters this is a rough outline of what I'm planning to do to guide the user to handle their mounted filesystems. I'm not sure which mounts we should list though. This code correctly shows the /home mount from a Fedora workstation install but I'm sure there are other cases I'm missing.

(I'm also trying to figure out a more functional way to parse the filesystems)

@ckyrouac ckyrouac requested a review from cgwalters May 6, 2025 14:45
@github-actions github-actions bot added the area/system-reinstall-bootc Issues related to system-reinstall-botoc label May 6, 2025
@ckyrouac ckyrouac marked this pull request as draft May 6, 2025 14:45
@ckyrouac ckyrouac force-pushed the reinstall-mount-warning branch from cefb40e to fdae493 Compare May 6, 2025 15:26
Comment on lines 62 to 64
if let Some(path) = path {
cmd.arg(path);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor but this can also be cmd.args(path) because Option can act like a zero-or-one-element iterator.

root.children
.iter()
.flatten()
.filter(|child| child.source == root.source)
Copy link
Collaborator

Choose a reason for hiding this comment

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

So...this seems like it will basically only find btrfs subvolumes, right? I think that's the only real sane case where the same source device can be mounted multiple times in that way.

In Linux one can mount e.g. the same block device multiple times but for filesystems without subvolumes there's not much use case for it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

So for someone who has e.g. /home or /var/log as a LVM logical volume, the sources are different so this check won't trigger.

However, the hard part here is to generalize this, we're going to need to exclude e.g. the API filesystems among many other things. I'm sure there's code to do this, but we'd need to do some investigation.


if !problematic_filesystems.is_empty() {
println!();
println!("Notice: the following filesystems are currently mounted on the root disk. After rebooting into the bootc system, these filesystems will not be mounted. They will be preserved so you will need to manually mount or remove them.");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Well...strictly speaking, someone could inject configuration into their image to mount it. It would be totally sane to me for example to have an OS configuration that auto-discovers a btrfs subvolume named home and mounts it at /home or whatever.

Getting into this level of detail, we could in theory also scrape /etc/fstab and the .mount units in the target environment...but, yeah a lot there.

I'm uncertain. I think in the short term given the above, effectively special casing "/home btrfs subvolume" could make sense as a starting point.

NOTE: Detected mounted btrfs subvolumes: /home
These subvolumes are left unchanged by this tool.

?

@ckyrouac ckyrouac force-pushed the reinstall-mount-warning branch from fdae493 to c1d3495 Compare May 8, 2025 20:21
Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

Thanks! This is looking pretty good to me so far!

I'm thinking rather than having a lot of explanatory in the binary we add it to the docs or so, which is what the text is implying.

BTW I bet we could get some testing of s-r-b by using loopback mounts to set up alternative root installation targets, though that would require passing through the target root instead of assuming /. But definitely nonblocking.

@ckyrouac ckyrouac force-pushed the reinstall-mount-warning branch from c1d3495 to 7497c43 Compare May 12, 2025 15:08
@ckyrouac ckyrouac marked this pull request as ready for review May 12, 2025 15:34
Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

Thanks! I only have nits basically

This allows retrieving all mounts.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
@ckyrouac ckyrouac force-pushed the reinstall-mount-warning branch from 7497c43 to 5700972 Compare May 14, 2025 14:40
This uses findmnt to locate filesystem mounts that are on the same
source as the root mount. If any are found, the user is warned these
filesystems will persist unmounted in the bootc system. The user must
hit <enter> to proceed.

This does the same for logical volumes in the same group as root.

It also adds a generic warning to help the user understand what will
happen after rebooting into the bootc system.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
@ckyrouac ckyrouac force-pushed the reinstall-mount-warning branch from 5700972 to 118dced Compare May 14, 2025 18:25
@cgwalters cgwalters merged commit 3d93701 into bootc-dev:main May 14, 2025
30 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/system-reinstall-bootc Issues related to system-reinstall-botoc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants