-
Notifications
You must be signed in to change notification settings - Fork 169
Support stateroot and mount specs in install config file #1945
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -562,9 +562,15 @@ impl State { | |
| } | ||
|
|
||
| fn stateroot(&self) -> &str { | ||
| // CLI takes precedence over config file | ||
| self.config_opts | ||
| .stateroot | ||
| .as_deref() | ||
| .or_else(|| { | ||
| self.install_config | ||
| .as_ref() | ||
| .and_then(|c| c.stateroot.as_deref()) | ||
| }) | ||
| .unwrap_or(ostree_ext::container::deploy::STATEROOT_DEFAULT) | ||
| } | ||
| } | ||
|
|
@@ -2233,7 +2239,12 @@ pub(crate) async fn install_to_filesystem( | |
| // We support overriding the mount specification for root (i.e. LABEL vs UUID versus | ||
| // raw paths). | ||
| // We also support an empty specification as a signal to omit any mountspec kargs. | ||
| let root_info = if let Some(s) = fsopts.root_mount_spec { | ||
| // CLI takes precedence over config file. | ||
| let config_root_mount_spec = state | ||
| .install_config | ||
| .as_ref() | ||
| .and_then(|c| c.root_mount_spec.as_ref()); | ||
| let root_info = if let Some(s) = fsopts.root_mount_spec.as_ref().or(config_root_mount_spec) { | ||
|
Comment on lines
+2243
to
+2247
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| RootMountInfo { | ||
| mount_spec: s.to_string(), | ||
| kargs: Vec::new(), | ||
|
|
@@ -2314,7 +2325,12 @@ pub(crate) async fn install_to_filesystem( | |
| let device_info = bootc_blockdev::partitions_of(Utf8Path::new(&backing_device))?; | ||
|
|
||
| let rootarg = format!("root={}", root_info.mount_spec); | ||
| let mut boot = if let Some(spec) = fsopts.boot_mount_spec { | ||
| // CLI takes precedence over config file. | ||
| let config_boot_mount_spec = state | ||
| .install_config | ||
| .as_ref() | ||
| .and_then(|c| c.boot_mount_spec.as_ref()); | ||
| let mut boot = if let Some(spec) = fsopts.boot_mount_spec.as_ref().or(config_boot_mount_spec) { | ||
|
Comment on lines
+2329
to
+2333
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| // An empty boot mount spec signals to omit the mountspec kargs | ||
| // See https://github.com/bootc-dev/bootc/issues/1441 | ||
| if spec.is_empty() { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,14 @@ The `install` section supports these subfields: | |
| - `kargs`: An array of strings; this will be appended to the set of kernel arguments. | ||
| - `match_architectures`: An array of strings; this filters the install config. | ||
| - `ostree`: See below. | ||
| - `stateroot`: The stateroot name to use. Defaults to `default`. | ||
| - `root-mount-spec`: A string specifying the root filesystem mount specification. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's debate this one a bit. I am OK to keep this as is under the concept that we're basically just supporting what But most cases now ideally use the DPS. When would one want to hardcode a different UUID? For your use case you just need to support omitting it right? We could start with just But I dunno.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I guess some people may need to, in some very specific cases? but yeah, I agree that simply having a Also we recently moved to DPS in coreos-assembler as well, so it's worth investigating if that would work as-is. |
||
| For example, `UUID=2e9f4241-229b-4202-8429-62d2302382e1` or `LABEL=rootfs`. | ||
| If not provided, the UUID of the target filesystem will be used. | ||
| An empty string signals to omit boot mount kargs entirely. | ||
| - `boot-mount-spec`: A string specifying the /boot filesystem mount specification. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one heavily relates to #1388 among others - we need to change/strengthen how we do Are you also just omitting this value?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
in the FCOS case yes, as we expect to find the partition with it's label during first boot. |
||
| If not provided and /boot is a separate mount, its UUID will be used. | ||
| An empty string signals to omit boot mount kargs entirely. | ||
|
|
||
| # filesystem | ||
|
|
||
|
|
@@ -51,8 +59,13 @@ Configuration options for the ostree repository. There is one valid field: | |
| ```toml | ||
| [install.filesystem.root] | ||
| type = "xfs" | ||
|
|
||
| [install] | ||
| kargs = ["nosmt", "console=tty0"] | ||
| stateroot = "myos" | ||
| root-mount-spec = "LABEL=rootfs" | ||
| boot-mount-spec = "UUID=abcd-1234" | ||
|
|
||
| [install.ostree] | ||
| bls-append-except-default = 'grub_users=""' | ||
| ``` | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
staterootvalue can now be supplied via the installation configuration file. This value is used to construct file system paths (e.g.,ostree/deploy/{stateroot}) and is passed to libostree functions without validation. A malicious value containing path traversal sequences (e.g.,..) could be used to manipulate files outside the intended directory on the target system during installation. It is recommended to validate that thestaterootvalue is a simple alphanumeric string and does not contain path traversal sequences or directory separators.