Stateless BTRFS with systemd-nspawn as opposed to AB partitions #3176
NjlsShade
started this conversation in
Features Request & Ideas | 特性请求 & 头脑风暴
Replies: 1 comment 1 reply
-
Great idea, I'm looking into replacing the AB partition with a btrfs filesystem, but I didn't think of using systemd-nspawn for less work, it's a good idea. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As opposed to using the current AB root partition schema, which reserves space and is difficult to modify and adapt to future needs, I believe using BtrFS subvolumes can replace this functionality entirely.
A "roota" and "data" subvolume can be created, then a snapshot of the root subvolume called “rootb” can be used in place of backing up to a second root partition during updates. You can either delete the existing rootb snapshot to make a new one before updating, or you can simply apply the update directly to rootb, then passively switch to the rootb subvolume as the active root on next reboot.
To ensure system stability the root subvolume should be read-only (with the option to switch to rw for advanced users), and a per-user container subvolume can be created under the data subvolume.
Here we can deploy a systemd-nspawn container of Debian Sid, in the container we have a user automatically created with the same name and UID as the host user (systemd-nspawn also allows bind mounting, so we'll bind the user's home directly for file access, themeing and configurations) any application the user installs would be installed within the container as opposed to the read-only root subvolume. The deepin launcher can be adjusted to look for and launch applications under the read-only root and the container, allowing applications like deepin browser to be included in regular system updates and be immutable.
This setup allows you to stay on a stable base like Debian 10 while still allowing the use of up-to-date applications. I currently use systemd-nspawn on deepin to run the latest version of Flatpak, as many flatpak applications I use require version 1.12+, only available on the Debian Sid branch.
Just a segestion, I’m not sure if you already have plans on moving to a stateless design in some other way, however, I just wanted to throw this option out there as I think it’s a very friendly setup.
Beta Was this translation helpful? Give feedback.
All reactions