package/skeleton-systemd: systemd-ify mounting /var tmpfs with ro rootfs
To mount our /var tmpfs when the rootfs is mounted read-only (really,
not remounted read-write), we use an entry in fstab.
However, /etc could also be a tmpfs (for full state-less systems, or
easy factory-reset, see [0]). It also prevents easily ordering other
systemd units until after /var is mounted (not impossible, but less
easy).
So, we register /var as a systemd mount unit, so that we can also have
the /var factory populated and functional even when /etc is empty. The
var.mount unit is heavily modelled after systemd's own tmp.mount one, so
we carry the same license for that file (in case that may apply).
This has two side effects:
- as hinted previously, it simplifies writing other systemd units to
order them after /var is mounted
- user can easily replace it with their own, which mounts an actual
filesystem
[0] http://0pointer.de/blog/projects/stateless.html
Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Cc: Norbert Lange <nolange79@gmail.com>
Cc: Romain Naour <romain.naour@smile.fr>
Cc: Jérémy Rosen <jeremy.rosen@smile.fr>
[yann.morin.1998@free.fr:
- split original patch in two
- this one only handles converting /var mounting into a systemd unit
- adapt commit log accordingly
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Reviewed-by: Norbert Lange <nolange79@gmail.com>
[yann.morin.1998@free.fr (as suggested by Norbert):
- fix Before= dependencies
- drop [Install] section
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2022-10-18 21:43:05 +02:00
|
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
# Modelled after systemd's tmp.mount
|
|
|
|
|
|
|
|
[Unit]
|
|
|
|
Description=Buildroot /var tmpfs
|
|
|
|
DefaultDependencies=no
|
|
|
|
Conflicts=umount.target
|
|
|
|
Before=local-fs.target umount.target
|
|
|
|
After=swap.target
|
|
|
|
|
|
|
|
[Mount]
|
|
|
|
What=tmpfs
|
|
|
|
Where=/var
|
|
|
|
Type=tmpfs
|
2023-01-15 13:52:50 +01:00
|
|
|
Options=nosuid,nodev,size=50%%,nr_inodes=1m
|