Repository navigation
Description
Under the immutable infrastructure model, we encourage users to handle config changes by reprovisioning their systems, rather than using configuration management or manually modifying the running system. This is okay in virtualized setups or in the cloud, and is also okay on bare metal where PXE infrastructure or IPMI-assisted ISO boot is available. But on single-node bare metal setups without external infrastructure, manual reinstall is impractical. (See e.g. this discussion.)
For this use case, it might help to have a command which receives an Ignition config to use for reprovisioning, copies it into /boot, sets first-boot kargs, and reboots. Then the initramfs, before running the usual first-boot steps, would need to restore the system to a pristine state. That process might look a lot like #94, or might look more like clearing /var and resetting /etc from /usr/etc. If those are in non-standard locations, perhaps the user-mode command could add kargs which tell the initramfs where to find them.
Because we'd be deleting user customizations before rerunning Ignition, this approach wouldn't[*] get into unsupported territory of using Ignition for configuration management. It would slightly complicate OS maintenance, though. At present we can freely change the Ignition initrd glue in ways that are incompatible with old installs (e.g. by changing first-boot kargs) because old installs will never run Ignition again. Supporting factory reset of old nodes would presumably add some additional constraints.
[*] Presumably it'd be infeasible to delete every possible user customization, so that statement might be optimistic.
Activity
bgilbert commentedon Feb 27, 2020
Discussed in the community meeting today.
lsblk,udevadm, andgpg./bootand the safety partition, 5) reboot into the new system. That's complex though.There was a general sense that the feature would be nice, but there was also concern about implementation complexity depending on the approach taken.
jlebon commentedon Mar 19, 2020
Note with the stage 2 approach, as long as the stage 2 binary is the initrd we append to the base one, it should contain both the osmet file and the root squashfs, so it should be possible to do the re-install completely offline.
jlebon commentedon Apr 17, 2020
Related OSTree issue: ostreedev/ostree#1793
cgwalters commentedon May 22, 2020
Also, if we shipped the
.osmetfile in e.g./sysroot/fcos.osmet, then we could always support a factory reset back to the aleph image. If we wanted to support reset back to the current ostree commit we'd need a tool to fetch it out of band.(This all said I think a lot of cases are going to be happy enough with the "ostree level" factory reset and not "wipe and replace disk image", particularly because the former can be made transactional)
cgwalters commentedon Apr 9, 2021
As is today, it will work in many basic scenarios to just do:
A much stronger version would look like
touch /run/factory-resetand we go back into the initramfs at shutdown time and do e.g.rm /var/* -rf && rsync -rlv --delete /usr/etc/ etc/.The strongest version here of course is re-fetching and re-imaging the target disk from the initramfs, but that's even more involved.
jlebon commentedon Apr 9, 2021
Truly shipping the osmet file in the image is impossible because it's a circular dependency. So it would probably instead require coreos-installer to propagate it there manually at install time. But the problem is that the osmet file is tied to the OSTree commit of the aleph version, so if the node upgraded at all, we would need to fetch the aleph OSTree commit. One thing we could easily do is have coreos-installer add a ref to it it's not GC'ed, but then every node is paying that storage cost.
bgilbert commentedon Apr 9, 2021
This won't remove any existing customizations, so I don't think we should encourage it.
jlebon commentedon Oct 25, 2021
A variation on #399 (comment) using
kexecwould be:kexecwith base OSTree kernel + concatenated initrd and--append 'coreos.inst.install_dev=... ...etc, to reinstall on the same deviceSince the rootfs CPIO includes the osmet file, no network is required during install. But air-gapped systems will need a way to obtain the rootfs initrd in the first place.
Would require some tweaks to support pointing at a local Ignition config from
coreos.inst.*kargs, but if we're wrapping all this in a e.g.coreos-installer reinstall, then we could also just generate a live Ignition config and do away withcoreos.inst.*kargs entirely.jlebon commentedon Dec 13, 2021
Opened a proof of concept for this in coreos/coreos-installer#712.
dustymabe commentedon Feb 16, 2022
We discussed this in the community meeting today.
25 remaining items
Add support for `--replace-mode=alongside` for ostree target
Add support for `--replace-mode=alongside` for ostree target
WIP: Add support for `--replace-mode=alongside` for ostree target
Add support for `--replace-mode=alongside` for ostree target
Add support for `--replace-mode=alongside` for ostree target
cgwalters commentedon Nov 7, 2024
FTR some things related to this continue on the bootc side in bootc-dev/bootc#404
Add support for `--replace-mode=alongside` for ostree target
Add support for `--replace-mode=alongside` for ostree target
Add support for `--replace-mode=alongside` for ostree target
Add support for `--replace-mode=alongside` for ostree target
Add support for `--replace-mode=alongside` for ostree target
Add support for `--replace-mode=alongside` for ostree target
Add support for `--replace-mode=alongside` for ostree target
the-dipsy commentedon Dec 14, 2024
As someone unfamiliar with bootc, OSTree and the intricacies of CoreOS and ignition, I'm finding parts of the puzzle but can't figure out, what exactly I'd currently need to do to reset which parts of my deployment.
Given a CoreOS installation with a generic ignition file that only loads a remote ignition file to replace itself with, what's a light weight way to reset /etc and /var, load a new remote ignition file from the same location as before and have it at least setup my files and configurations accordingly (ideally including the ability to boot into the previous state in case something goes wrong)? Is that already possible?
Thanks for the great work 😊
the-dipsy commentedon Apr 25, 2026
I built a factory reset/quick reprovisioning solution as part of a library with many other abstractions for CoreOS. Would be happy to have native support someday anyways of course.