[systemd-devel] Question about systemd-firstboot

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Thu Mar 9 16:19:21 UTC 2017


On Thu, Mar 09, 2017 at 03:49:51PM +0100, Francis Moreau wrote:
> On Thu, Mar 9, 2017 at 3:10 PM, Zbigniew Jędrzejewski-Szmek
> <zbyszek at in.waw.pl> wrote:
> > On Thu, Mar 09, 2017 at 10:48:03AM +0100, Francis Moreau wrote:
> >> Hello,
> >>
> >> I'm puzzled about systemd-firstboot service.
> >>
> >> In my understanding this service is ran only during the firstboot. The
> >> firstboot condition is detected with the presence of /etc/machine-id
> >> file.
> >>
> >> If this file is not present then it's assumed to be a first boot and
> >> systemd-firstboot.service is ran and will create the machine-id file.
> >>
> >> Now the thing is that I dont see how systemd-firstboot.service can
> >> have a chance to be started because if /etc/machine-id is missing the
> >> whole boot is failing due to journald requiring /etc/machine-id.
> >>
> >> Could anybody give me some clues ?
> >
> > machine_id_setup() is called from main(). So pid1 should set up
> > /etc/machine-id if possible (/etc is wriable) before it starts the
> > firstboot services.
> >
> 
> For regular boots /etc is always RO when systemd is started, at least
> in my understanding.
It depends on the command-line parameters: 'ro' and 'rw' both work.
'rw' is actually recommended if you're using an initramfs.

Otherwise, an empty /etc/machine-id may be present, if /etc is read-only
at boot, in which case systemd will do a temporary mount.

So 'ro' is supported, but you either need an /etc/machine-id file or
a place to mount one temporarily.

Zbyszek


More information about the systemd-devel mailing list