BOOTC-DESTR...ANUP.SERVICE(5)
π NAME π
bootc-destructive-cleanup.service β bestie, this is the lil systemd glow-up that tidies up your old OS after you move in next to it π§Ήβ¨
πΈ DESCRIPTION πΈ
okay so picture this: this systemd service shows up on first boot right after an "alongside" installation that you did with bootc install to-existing-root --cleanup. Its whole job? Clean up the files from the previous operating system. it's giving β¨spring cleaningβ¨ but for an entire OS π
The service is a oneshot unit, and it runs a distribution-specific cleanup script that lives at /usr/lib/bootc/fedora-bootc-destructive-cleanup β that's the path for Fedora derivatives, iykyk π§
π¦ How it works π¦
- While you're doing
bootc install to-existing-root --cleanup, a stamp file gets created at/sysroot/etc/bootc-destructive-cleanupπ - Then a systemd generator,
bootc-systemd-generator, spots that stamp file at boot time and enables thebootc-destructive-cleanup.serviceunit. like. it literally goes "oh? π stamp? guess we're doing this" - And then the service runs the cleanup script on first boot. slay, that's the whole pipeline π₯
π What the cleanup script does π
On Fedora derivatives, bestie, the cleanup script does all of this:
- Remounts
/sysrootas read-write π - Removes all RPM packages installed in the physical root (aka the previous OS) β yes, ALL of them, no crumbs left π
- Removes all container images from
/sysroot/var/lib/containersusingpodman system prune --all -fποΈβ¨
Note: the cleanup script does not remove stopped containers, so some storage may remain. Lowkey annoying, but that's how it is right now β this behavior may change in the future π
π CUSTOMIZING THE CLEANUP SCRIPT π
Right now the implementation ships with a Fedora-specific cleanup script. But other distributions?? they can absolutely bring their own β¨ β either by creating an executable at /usr/lib/bootc/fedora-bootc-destructive-cleanup, or by editing the systemd unit file so it points at a different path. main character energy, do your own thing π«Ά
Want an example implementation to peek at? Go see the Fedora cleanup script: https://github.com/bootc-dev/bootc/blob/main/contrib/scripts/fedora-bootc-destructive-cleanup π
π PREVIOUS FILESYSTEM DATA π
So after an alongside installation, all your previous root filesystem data is still chillin' at /sysroot (everyone calls it the "physical root" π).
But ngl, here's the tea: previous mount points or subvolumes will not be automatically mounted in the new system. For example, a btrfs subvolume for /home will not be automatically mounted to /sysroot/home. π
These filesystems do persist though β so you can handle them manually, or define them as mount points in the bootc image. your call, you got this π
π SEE ALSO π
β VERSION β
v1.17.1
okay that's the whole page bestie, no cap π this was the BOOTC-DESTR...ANUP.SERVICE(5) page from the File Formats Manual, brought to you by version v1.17.1. go forth and clean up that old OS, you're literally iconic π¦β¨
π¦ where this page comes from
- fedora 43: bootc 1.17.1-1.fc43 Β· Apache-2.0 AND BSD-3-Clause AND MIT AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND (Unlicense OR MIT)
- fedora 44: bootc 1.17.1-1.fc44 Β· Apache-2.0 AND BSD-3-Clause AND MIT AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND (Unlicense OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms