You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
install: Support reinstallation (factory reset) #404
Basically we should support something like bootc install factory-reset that would configurably wipe local system state.
On the implementation side...I think the best way to do this would be something like:
Create new deployment with fresh etc targeting a new stateroot
Boot into it
optional: clean up old deployment + stateroot
The beauty of this approach is that the "factory reset" would actually also be fully transactional, i.e. you could roll back into the previous state. It'd be easy to copy over any desired state (SSH host keys, cached container images e.g.) from the previous boot before deleting it.
Make stateroots more visible, e.g. at least status should show them if different
Need to support explicit pruning of deployments e.g. bootc deployment rm (like ostree admin undeploy) so that I can get rid of old stateroots
Ideas:
Add bootc mount <deployment> /run/tmp-next-root so that I can cp -a --reflink=always /var/home /run/tmp-next/root/var/home
Reacted by Malix - Alix Brunet, xyny, Tulip Blossom, Luke Short, Luca Ferrari, Harrison Gulliver, Alexandre Malo, Robert Sturla, renner, Schmuuu and 5 more
BTW one tricky thing in this is kernel arguments...cc #401
And also related to this, we should probably go to some effort to preserve the original kargs.
An entirely different way to implement this would be to retain a pinned version of the original installed deployment. Some people will want to do that, and we already effectively support it with ostree admin pin. However...rolling back to that in the general case will imply rolling back to something pretty outdated, which we don't want to encourage. So I think we should focus more on better capturing and maintaining the bits of state that we want from that which mostly I think boils down to kargs.
So #137 landed some important preparatory code here. However...that's covering the "reinitialize system from a different bootc container image". What we obviously could streamline is the flow of "reinitialize system from the booted image".
Probably something like bootc install to-existing-root --from-booted? And we need to bikeshed what state preservation options we support.
I think in the core design (as used by #1389) it's ~trivial to copy over whatever state one wants from the previous root. But it'd definitely be nice to add some sugar for this.
But it'd definitely be nice to add some sugar for this.
I'm trying to think of areas users may hurt themselves with this. I'm not sure we can add sugar for everything, but I agree w/ @imbev that users & /home dirs are a good starting point. Other contenders could be fstab or mount unints, host ssh keys (probably not that important), Networking (static IPs or bonds), hostname? I wish we had a clean way to reapply whatever anaconda did and/or cloud-init. In lieu of that, maybe some command flags to preserve some things items will help w/ foot guns. $0.02
But it'd definitely be nice to add some sugar for this.
I'm trying to think of areas users may hurt themselves with this. I'm not sure we can add sugar for everything, but I agree w/ @imbev that users & /home dirs are a good starting point. Other contenders could be fstab or mount unints, host ssh keys (probably not that important), Networking (static IPs or bonds), hostname? I wish we had a clean way to reapply whatever anaconda did and/or cloud-init. In lieu of that, maybe some command flags to preserve some things items will help w/ foot guns. $0.02
Anaconda could be used with the /root/anaconda-ks.cfg generated by the initial installation, but that is an additional dependency.
I agree about the value of the factory reset having flags and file config options for each part.
Note that in the current design we will always default to a nondestructive factory reset by creating a new stateroot. Then users are required to clean up the prior stateroot when they're happy. If it doesn't work, then a rollback into the previous deployment undoes everything.
Yeah I get that. I think we both want to avoid users resetting their systems, rebooting, and not being able to log in. :) Is the sugar you were thinking of doing the copy for the user? Or were you thinking it could work differently?
Anaconda could be used with the /root/anaconda-ks.cfg generated by the initial installation, but that is an additional dependency.
Yes! We had a team chat around this issue and for sure it'd be awesome to have Anaconda be useful in this setup to do a reinstallation into a new stateroot.
In theory we could have something like factory reset plugins /usr/lib/bootc/factory-reset.d or something that could help guide users who did an install with anaconda to also do a factory reset that way? Or well, a fedora-derivative feature flag that
bootc-image-builder/osbuild are not really designed for this, but maybe could be reworked to do so.
I'm not a dev, just a hobbyist, but I'd like to provide my thoughts regarding the matter.
Atleast on Silverblue with OStree, when I attempted a "Factory Reset" (see this) the GNOME OOTB/firstboot wizard appeared just like during the first boot after a fresh install and all the relevant files were auto-generated.
Instead of copying/migrating files like /etc/passwd, bootc or another program could provide a firstboot/OOTB experience.
I was thinking something like a systemd service like bootc-firstboot.service, which checks for a file named /etc/bootc-firstboot-complete (could be another file) and if it doesn't exist, prompts the user to configure their locale, keyboard layout and setup users just like the GNOME OOTB/firstboot wizard, or maybe even prompt the user for a "setup file" that contains all that information.
I was thinking something like a systemd service like bootc-firstboot.service,
What would it provide over systemd-firstboot and gnome-initial-setup (and other tools like Ignition or cloud-init)?
systemd-firstboot is exactly what I was describing. I thought something like this didn't exist as other spins like Kinoite and such couldn't survive --no-merge "Factory Reset" deployments.
Activity
[-]install: Support reinstallation[/-][+]install: Support reinstallation (factory reset)[/+]cgwalters commentedon Mar 20, 2024
BTW one tricky thing in this is kernel arguments...cc #401
And also related to this, we should probably go to some effort to preserve the original kargs.
An entirely different way to implement this would be to retain a pinned version of the original installed deployment. Some people will want to do that, and we already effectively support it with
ostree admin pin. However...rolling back to that in the general case will imply rolling back to something pretty outdated, which we don't want to encourage. So I think we should focus more on better capturing and maintaining the bits of state that we want from that which mostly I think boils down to kargs.cgwalters commentedon Sep 4, 2024
One question came up tangentially related to this too - why does the current install integration test suite not work on an ostree based system?
First there's two things; the
to-diskcode; that works everywhere, it's easy we just use loopback.For the alongside install tests, it's basically because of this. We'd need to be sure to use an alternative stateroot vs the booted one, etc.
vrothberg commentedon Oct 10, 2024
I'd love to have such a reset functionality for
bootc-{switch,update}as well.kfox1111 commentedon Oct 16, 2024
Maybe an option to reset state on just a single file in etc or a path under etc too, rather then a complete reset.
`install` feature is always on, add `install-to-disk`
`install` feature is always on, add `install-to-disk`
`install` feature is always on, add `install-to-disk`
Malix-Labs commentedon Jan 10, 2025
Hello folks, is there a clear path of what to do next to make this happen?
cgwalters commentedon Jan 17, 2025
So #137 landed some important preparatory code here. However...that's covering the "reinitialize system from a different bootc container image". What we obviously could streamline is the flow of "reinitialize system from the booted image".
Probably something like
bootc install to-existing-root --from-booted? And we need to bikeshed what state preservation options we support.imbev commentedon Jun 5, 2025
How should
/homeand/etc/passwdbe handled?cgwalters commentedon Jun 30, 2025
Opened #1389 for this
cgwalters commentedon Jun 30, 2025
I think in the core design (as used by #1389) it's ~trivial to copy over whatever state one wants from the previous root. But it'd definitely be nice to add some sugar for this.
cgwalters commentedon Aug 4, 2025
xref https://www.freedesktop.org/software/systemd/man/devel/systemd-factory-reset.html - some integration work to do here
mrguitar commentedon Aug 4, 2025
I'm trying to think of areas users may hurt themselves with this. I'm not sure we can add sugar for everything, but I agree w/ @imbev that users & /home dirs are a good starting point. Other contenders could be fstab or mount unints, host ssh keys (probably not that important), Networking (static IPs or bonds), hostname? I wish we had a clean way to reapply whatever anaconda did and/or cloud-init. In lieu of that, maybe some command flags to preserve some things items will help w/ foot guns. $0.02
imbev commentedon Aug 4, 2025
Anaconda could be used with the
/root/anaconda-ks.cfggenerated by the initial installation, but that is an additional dependency.I agree about the value of the factory reset having flags and file config options for each part.
cgwalters commentedon Aug 5, 2025
Note that in the current design we will always default to a nondestructive factory reset by creating a new stateroot. Then users are required to clean up the prior stateroot when they're happy. If it doesn't work, then a rollback into the previous deployment undoes everything.
mrguitar commentedon Aug 5, 2025
Yeah I get that. I think we both want to avoid users resetting their systems, rebooting, and not being able to log in. :) Is the sugar you were thinking of doing the copy for the user? Or were you thinking it could work differently?
cgwalters commentedon Sep 8, 2025
My instinct here is to land some experimental form of this ASAP and gather feedback from ~real world experience.
cgwalters commentedon Sep 11, 2025
Yes! We had a team chat around this issue and for sure it'd be awesome to have Anaconda be useful in this setup to do a reinstallation into a new stateroot.
In theory we could have something like factory reset plugins
/usr/lib/bootc/factory-reset.dor something that could help guide users who did an install with anaconda to also do a factory reset that way? Or well, afedora-derivativefeature flag thatbootc-image-builder/osbuild are not really designed for this, but maybe could be reworked to do so.
cgwalters commentedon Sep 22, 2025
Ideally we minimize "magic" here; admins should know where the data is coming from and why it's preserved.
cgwalters commentedon Sep 22, 2025
As far as "being able to log in", one pattern we use for https://github.com/bootc-dev/bcvk (and is also used by podman-bootc) is https://github.com/bootc-dev/bcvk/blob/aae33b4a252fea309bd38bfd3dba992187656b22/crates/kit/src/sshcred.rs#L16 where we use systemd credentials to add a tmpfiles.d unit that injects a SSH key via SMBIOS (virt level creds). Notably, factory reset at the bootc level won't get rid of that key.
ScatteredCognition commentedon Sep 29, 2025
I'm not a dev, just a hobbyist, but I'd like to provide my thoughts regarding the matter.
Atleast on Silverblue with OStree, when I attempted a "Factory Reset" (see this) the GNOME OOTB/firstboot wizard appeared just like during the first boot after a fresh install and all the relevant files were auto-generated.
Instead of copying/migrating files like
/etc/passwd, bootc or another program could provide a firstboot/OOTB experience.I was thinking something like a systemd service like
bootc-firstboot.service, which checks for a file named/etc/bootc-firstboot-complete(could be another file) and if it doesn't exist, prompts the user to configure their locale, keyboard layout and setup users just like the GNOME OOTB/firstboot wizard, or maybe even prompt the user for a "setup file" that contains all that information.cgwalters commentedon Sep 29, 2025
What would it provide over
systemd-firstbootand gnome-initial-setup (and other tools like Ignition or cloud-init)?Now one issue right now is the Fedora bootc base image has this https://gitlab.com/fedora/bootc/base-images/-/blame/main/minimal/manifest.yaml#L18 but that's effectively a legacy bug. Though changing it would require analysis of consumers.
ScatteredCognition commentedon Sep 29, 2025
systemd-firstbootis exactly what I was describing. I thought something like this didn't exist as other spins like Kinoite and such couldn't survive--no-merge"Factory Reset" deployments.cgwalters commentedon Jul 2, 2026
I think
bootc install factory-reset --print-etc-diffmight be a good replacement forostree admin config-diff