Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/4] systemd: sort out the conflict between var factory and tmpfiles (branch systemdify-var)
@ 2022-10-15 21:23 Yann E. MORIN
  2022-10-15 21:23 ` [Buildroot] [PATCH 1/4] package/skeleton-systemd: move /var factory out of /etc Yann E. MORIN
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Yann E. MORIN @ 2022-10-15 21:23 UTC (permalink / raw)
  To: buildroot
  Cc: Jérémy Rosen, Yann E . MORIN, Yann E . MORIN,
	Norbert Lange, Romain Naour

Hello All!

This small four-patch series touches on the delicate intricacies of the
systemd package and how we integrate it in Buildroot, especially with
regard to read-only filesystems.

The underlying issue is that systemd wants a writable /var filesystem
(it will store a bunch of things at runtime in there). A lot of packages
also expect a writable /var. After all, var stands for variadic, so it
is not supposed to be set in stone and read-only.

The solution we implemented in Buildroot is to generate a factory for
/var, and register that as tmpfiles, at build time, and mount a tmpfs on
the then-empty /var at runtime, so that systemd-tmpfiles populates /var
on boot. Having a tmpfs means /var is repopulated from a clean state at
each boot, and people who want a persistent /var have to provide their
own mechanism to mount their actual filesystem instead.

However, for some people, this does not seem to work as expected, so we
introduced a call to systemd-tmpfiles at build time, to pre-populate the
rootfs from all the tmpfiles, of which our var factory, at build time.

These two mechanism clash with each others, and are mostly incompatible,
and causes files to be duplicated.

To solve the issue, this series introduces new options, so the user can
elect to use either, none, or both mechanisms, as they see fit.

The first steps are borrowed from Yann@work, where we make it easier to
change the location where /var is nounted from, by making it a systemd
mount unit, rather than use the legacy fstab, and move the factory to
/usr/share as it is a system factory (/etc is for the administartor to
provide overrides). Note that those two are not strictly required for
the following, but since that makes it easier to change the /var
filesystem in a systemd-compliant manner, they are a nice addition to
the series.

Then we move together the two mechanisms under the auspices of a common
package, to make it easier to later make them conditional.

Finally, we introduce those two new options, that drive each mechanism.

Eventally, we want to highlight that, by default, the behaviour has not
changed, since the two new options default to y, so as to explicitly
keep the behaviour from nefore this patchset.

Regards,
Yann E. MORIN.


----------------------------------------------------------------
Yann E. MORIN (4):
      package/skeleton-systemd: move /var factory out of /etc
      package/skeleton-systemd: systemd-ify mounting /var tmpfs with ro rootfs
      package/skeleton-systemd: host the tmpfiles preparation script
      system: add options for var factory and tmpfiles pre-seed

 .../fakeroot_tmpfiles.sh                           |  0
 .../skeleton-init-systemd/skeleton-init-systemd.mk | 18 +++++++---
 package/skeleton-init-systemd/var.mount            | 18 ++++++++++
 package/systemd/systemd.mk                         |  6 ----
 system/Config.in                                   | 38 +++++++++++++++++++++-
 5 files changed, 69 insertions(+), 11 deletions(-)
 rename package/{systemd => skeleton-init-systemd}/fakeroot_tmpfiles.sh (100%)
 create mode 100644 package/skeleton-init-systemd/var.mount

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-10-18  8:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-15 21:23 [Buildroot] [PATCH 0/4] systemd: sort out the conflict between var factory and tmpfiles (branch systemdify-var) Yann E. MORIN
2022-10-15 21:23 ` [Buildroot] [PATCH 1/4] package/skeleton-systemd: move /var factory out of /etc Yann E. MORIN
2022-10-15 21:23 ` [Buildroot] [PATCH 2/4] package/skeleton-systemd: systemd-ify mounting /var tmpfs with ro rootfs Yann E. MORIN
2022-10-15 21:23 ` [Buildroot] [PATCH 3/4] package/skeleton-systemd: host the tmpfiles preparation script Yann E. MORIN
2022-10-15 21:23 ` [Buildroot] [PATCH 4/4] system: add options for var factory and tmpfiles pre-seed Yann E. MORIN
2022-10-17 12:12 ` [Buildroot] [PATCH 0/4] systemd: sort out the conflict between var factory and tmpfiles (branch systemdify-var) Norbert Lange
2022-10-17 14:11   ` yann.morin
2022-10-17 14:50     ` Norbert Lange
2022-10-17 16:00       ` yann.morin
2022-10-17 16:49         ` Norbert Lange
2022-10-17 20:14           ` Yann E. MORIN
2022-10-18  8:40             ` yann.morin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox