Skip to content

Commit 4120ba7

Browse files
committed
feat: improve README
(WIP)
1 parent a3fb26f commit 4120ba7

File tree

2 files changed

+162
-7
lines changed

2 files changed

+162
-7
lines changed

README.md

+162-7
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22
<img src="abroot-logo.svg" height="120">
33
<h1 align="center">ABRoot v2</h1>
44
<p align="center">ABRoot is utility which provides full immutability and
5-
atomicity to a Linux system, by transacting between
6-
two root filesystems. Updates are performed using OCI
7-
images, to ensure that the system is always in a
8-
consistent state.</p>
5+
atomicity to a Linux system, by transacting between two root filesystems.
6+
Updates are performed using OCI images, to ensure that the system is always
7+
in a consistent state. It also allows for local atomic changes thanks to
8+
the integrated ABRoot package manager, which generates local OCI images
9+
with the user's changes, and then applies them on top of the system's
10+
default image.</p>
911
</div>
1012

11-
> **NOTE**: ABRoot v2 is currently in development. The current
12-
> version is v1, which is available in the `v1` branch.
13+
> **NOTE**: ABRoot v2 is currently in development. The current stable release
14+
> is v1, which is available in the `v1` branch.
1315
14-
## Help
16+
## Help output
1517

1618
```md
1719
ABRoot provides full immutability and atomicity by performing transactions between 2 root partitions (A<->B)
@@ -35,3 +37,156 @@ Flags:
3537

3638
Use "abroot [command] --help" for more information about a command.
3739
```
40+
41+
## Installation
42+
43+
ABRoot is a single binary, which can be placed anywhere on the system. It
44+
requires administrative privileges to run and a configuration file to be
45+
present in one of the following locations, ordered by priority:
46+
47+
- `~/.config/abroot/abroot.json` -> for user configuration
48+
- `config/abroot.json` -> for development purposes only
49+
- `../config/abroot.json` -> for development purposes only
50+
- `/etc/abroot/abroot.json` -> for administrative configuration
51+
- `/usr/share/abroot/abroot.json` -> for system-wide configuration
52+
53+
The configuration file is a JSON file with the following structure:
54+
55+
```json
56+
{
57+
"autoRepair": true,
58+
"maxParallelDownloads": 2,
59+
60+
"registry": "ghcr.io",
61+
"registryService": "registry.ghcr.io",
62+
"registryAPIVersion": "v2",
63+
"name": "vanilla-os/desktop",
64+
"tag": "main",
65+
66+
"iPkgMngPre": "lpkg --unlock",
67+
"iPkgMngPost": "lpkg --lock",
68+
"iPkgMngAdd": "apt install -y",
69+
"iPkgMngRm": "apt remove -y",
70+
"iPkgMngApi": "https://packages.vanillaos.org/api/pkg/{packageName}",
71+
72+
"differURL": "https://differ.vanillaos.org",
73+
74+
"partLabelVar": "vos-var",
75+
"partLabelA": "vos-a",
76+
"partLabelB": "vos-b",
77+
"partLabelBoot": "vos-boot",
78+
"partLabelEfi": "vos-efi",
79+
80+
"thinProvisioning": false,
81+
"thinInitVolume": "",
82+
83+
"libPathStates": "/var/lib/abroot/states"
84+
}
85+
```
86+
87+
The following table describes each of the configuration options:
88+
89+
| Option | Description |
90+
| --- | --- |
91+
| `autoRepair` | If set to `true`, ABRoot will automatically try to repair the system if a broken structure is detected during a transaction. |
92+
| `maxParallelDownloads` | The maximum number of parallel downloads to perform when updating the system. |
93+
| `registry` | The registry to use when pulling OCI images. |
94+
| `registryService` | The registry service to use when pulling OCI images. |
95+
| `registryAPIVersion` | The Docker Registry API version to use when pulling OCI images. (Only `v2` is tested) |
96+
| `name` | The name of the OCI image to use when pulling OCI images. |
97+
| `tag` | The tag of the OCI image to use when pulling OCI images. |
98+
| `iPkgMngPre` | The command to run before performing any package management operation. This is useful to keep the package manager locked outside of a transaction. It can be a command or a script. |
99+
| `iPkgMngPost` | Similar to `iPkgMngPre`, but runs after the package management operation. |
100+
| `iPkgMngAdd` | The command to run when adding a package. It can be a command or a script. |
101+
| `iPkgMngRm` | The command to run when removing a package. It can be a command or a script. |
102+
| `iPkgMngApi` | The API endpoint to use when querying for package information. If not set, ABRoot will not check if a package exists before installing it. This could lead to errors. Take a look at our [Eratosthenes API](https://github.com/Vanilla-OS/Eratosthenes/blob/388e6f724dcda94ee60964e7b12a78ad79fb8a40/eratosthenes.py#L52) for an example. |
103+
| `differURL` | The URL of the [Differ API](https://github.com/Vanilla-OS/Differ) service to use when comparing two OCI images. |
104+
| `partLabelVar` | The label of the partition dedicated to the system's `/var` directory. |
105+
| `partLabelA` | The label of the partition dedicated to the system's `A` root. |
106+
| `partLabelB` | The label of the partition dedicated to the system's `B` root. |
107+
| `partLabelBoot` | The label of the partition dedicated to the master boot. |
108+
| `partLabelEfi` | The label of the partition dedicated to the EFI boot. |
109+
| `thinProvisioning` | If set to `true`, ABRoot will use thin provisioning when creating the transaction volume. Check the section about [thin provisioning](#thin-provisioning) for more information. |
110+
| `thinInitVolume` | The command to run to initialize the transaction volume. This is mandatory if `thinProvisioning` is set to `true`. |
111+
| `libPathStates` | NOT_IMPLEMENTED |
112+
113+
## How it works
114+
115+
ABRoot works by performing transactions between two root partitions, `A` and `B`.
116+
117+
### Terminology
118+
119+
- **immutable** - a file or directory is immutable if it cannot be modified or
120+
deleted by the user directly.
121+
- **transaction** - a transaction in this context is the process of updating
122+
the system or applying changes to it.
123+
- **atomic** - a transaction is atomic if it is either fully applied or not
124+
applied at all. There is no in-between state. This means that if a transaction
125+
fails, the system will be kept in the same state as before the transaction
126+
started, preventing the system from being left in an inconsistent state.
127+
128+
### Boot process
129+
The system manages those root partitions by assigning them the `current` or
130+
`future` roles. The `current` partition is the one that is currently being used
131+
by the system (runtime), while the `future` partition is the one that will be
132+
used after a successful transaction, by performing a reboot, and switching the
133+
roles of the partitions.
134+
135+
The boot process is composed of 2 entities:
136+
137+
- **master boot** - the master boot is the first stage of the boot process. It
138+
is responsible for loading the correct root-specific boot (GRUB config) and
139+
the kernel (which is also root-specific).
140+
- **root-specific boot** - the root-specific boot is the second stage of the
141+
boot process. It is responsible for loading the kernel modules and the kernel
142+
parameters, and then booting the kernel.
143+
144+
The following schema shows how the boot process works:
145+
146+
```
147+
+--------------------+ +--------------------+
148+
| | | |
149+
| Master Boot | -> | Root-specific Boot |
150+
| | | |
151+
+--------------------+ +--------------------+
152+
|
153+
v
154+
+-------------------+ +---------------------+
155+
| | | |
156+
| System | <- | Root-specific |
157+
| | | Kernel |
158+
+-------------------+ | |
159+
+---------------------+
160+
```
161+
162+
### Transaction process
163+
164+
The transaction process is composed of multiple stages (11 at the time of
165+
writing this). Each stage is responsible for performing a specific task, and
166+
then passing the control to the next stage. Since ABRoot v2 is still in
167+
development, the transaction process could still change, so if you're
168+
interested in the details, please check the source code for `ABSystem`, in the
169+
`core` package.
170+
171+
172+
## Thin provisioning
173+
174+
ABRoot supports (and suggests) thin provisioning, which allows for a more
175+
efficient use of disk space.
176+
177+
LVM thin provisioning allows users to create virtual filesystems larger than
178+
the available physical storage. This is possible due to LVM thin pools
179+
allocating blocks when they are written, rather than when a volume gets created.
180+
Thin provisioning is commonly found in places like VPS clusters, where a
181+
provider can allocate a very large storage pool (e.g. 500TB) without needing
182+
to have that amount of physical storage. This way, they can provide customers
183+
with adequate storage limits and only buy more storage when it's actually
184+
needed.
185+
186+
The following schema shows how an ABRoot compatible disk layout would look like
187+
with thin provisioning enabled:
188+
189+
![Thin provisioning schema](assets/lvm-partitioning-structure.png)
190+
191+
To follow-up, have a read at our [blog post](https://vanillaos.org/blog/article/2023-11-22/vanilla-os-orchid---devlog-22-nov)
192+
about thin provisioning in ABRoot.

assets/lvm-partitioning-structure.png

90.3 KB
Loading

0 commit comments

Comments
 (0)