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
Copy file name to clipboardExpand all lines: docs/src/filesystem.md
+31-5Lines changed: 31 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,22 +22,48 @@ The overall recommendation is to keep all operating system content in `/usr`. S
22
22
23
23
## `/etc`
24
24
25
-
The `/etc` directory contains persistent state by default; however,
25
+
The `/etc` directory contains mutable persistent state by default; however,
26
26
it is suppported to enable the [`etc.transient` config option](https://ostreedev.github.io/ostree/man/ostree-prepare-root.html).
27
27
28
28
When in persistent mode, it inherits the OSTree semantics of [performing a 3-way merge](https://ostreedev.github.io/ostree/atomic-upgrades/#assembling-a-new-deployment-directory)
29
-
across upgrades.
29
+
across upgrades. In a nutshell:
30
+
31
+
- The *new default*`/etc` is used as a base
32
+
- The diff between current and previous `/etc` is applied to the new `/etc`
33
+
- Locally modified files in `/etc` different from the default `/usr/etc` (of the same deployment) will be retained
34
+
35
+
The implmentation of this defaults to being executed by `ostree-finalize-staged.service`
36
+
at shutdown time, before the new bootloader entry is created.
37
+
38
+
The rationale for this design is that in practice today, many components of a Linux system end up shipping
39
+
default configuration files in `/etc`. And even if the default package doesn't, often the software
40
+
only looks for config files there by default.
41
+
42
+
Some other image-based update systems do not have distinct "versions" of `/etc` and
43
+
it may be populated only set up at a install time, and untouched thereafter. But
44
+
that creates "hysteresis" where the state of the system's `/etc` is strongly
45
+
influenced by the initial image version. This can lead to problems
46
+
where e.g. a change to `/etc/sudoers.conf` (to give on simple example)
47
+
would require external intervention to apply.
48
+
49
+
For more on configuration file best practices, see [Building](building/guidance.md).
30
50
31
51
## `/var`
32
52
33
53
Content in `/var` persists by default; it is however supported to make it or subdirectories
34
-
mount points (whether network or `tmpfs`)
54
+
mount points (whether network or `tmpfs`). There is exactly one `/var`. If it is
55
+
not a distinct partition, then "physically" currently it is a bind mount into
56
+
`/ostree/deploy/$stateroot/var` and shared across "deployments" (bootloader entries).
35
57
36
58
As of OSTree v2024.3, by default [content in /var acts like a Docker VOLUME /var](https://github.com/ostreedev/ostree/pull/3166/commits/f81b9fa1666c62a024d5ca0bbe876321f72529c7).
37
59
38
60
This means that the content from the container image is copied at initial installation time, and *not updated thereafter*.
39
61
40
-
The rationale for this is to keep operating system upgrades from touching machine-local data by default.
62
+
Note this is very different from the handling of `/etc`. The rationale for this is
63
+
that `/etc` should generally only hold small text files, but `/var` should hold arbitrarily
64
+
large data (system logs, databases, etc.). Creating multiple copies of it would have
65
+
66
+
to keep operating system upgrades from touching machine-local data by default.
41
67
If the system is rolled back to a previous bootloader entry, the `/var` content remains. This also
42
68
makes it possible to "stage" new operating system updates in an alternative root without affecting `/var` content.
43
69
@@ -65,7 +91,7 @@ cases, there are several options (containerizing the app, running it in a system
65
91
However, some use cases may find it easier to enable a fully transient writable rootfs by default.
0 commit comments