[systemd-devel] Stateless system howto

Tobias Hunger tobias.hunger at gmail.com
Fri Feb 26 06:51:00 UTC 2016


Hi Visali,

Am 25.02.2016 20:47 schrieb "Vasiliy Tolstov" <v.tolstov at selfip.ru>:
>
> Hi,i want to build image that mounts readonly /usr and / readwrite.

That is really simple to do:

Just edit the kernel command line to include the appropriate flags to mount
usr read-only. Documentation for the flags can be found here:
https://www.freedesktop.org/software/systemd/man/systemd-fstab-generator.html

> I have dracut , systemd and efi system.
> Does somebody have examples of systemd units ?

None should be needed for such a simple setup.

> Also how /etc filled with systemd?

That should not be necessary, if / is persistent. If you want / to be a
tmpfs, then it gets a bit tricky.

I currently added a unit into the initrd that extracts a tarball with the
root filesystem found on the read-only usr partition. The unit doing that
can be found here:
https://gitlab.com/hunger/cleanroom/blob/master/type-baremetal/units/initrd-sysroot-setup.service

That *should* not be necessary starting with systemd 229 (for the
machine-id switch on the kernel commandline) and dbus 1.10 (for starting
without files in /etc) anymore, but I did not verify that yet.

If there is no /etc/machine-id found on the disk, systemd should populate
/etc based on the contents of /usr/share/factory.

Best Regards,
Tobias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20160226/883fe638/attachment.html>


More information about the systemd-devel mailing list