[systemd-devel] ConditionFirstBoot question

mattwood2000 at gmail.com mattwood2000 at gmail.com
Tue Mar 12 13:06:35 UTC 2024


Hi,

I have a system that needs to perform some tasks on first boot.  I have
this working for the most part but I had some general questions and would
like some guidance on the proper implementation.

The tasks I need to perform on first boot include changing the hostname,
formatting some flash and mounting the filesystem, updating some config
files, etc.

I found that if I put these tasks sequentially into single script
/etc/hostname is updated and the hostname command returns the updated
value, the hostname shown at login is still the old value.

Now if I split tasks into individual services and order them with Before
and After the hostname is correct at login.

I suspect this is because of systemd's parallelization and the monolithic
script will not finish before the service or target that pulls in
/etc/hostname, is that correct?

It is not clear to me what specific target or service my service needs to
be set Before so that the script can finish.

It also occurs to me that perhaps it makes more sense to split the tasks
out so that they can run in parallel to optimize the boot, would this be
the best practice?

Thanks, Matt.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20240312/2bad5a83/attachment.htm>


More information about the systemd-devel mailing list