[OE-core] [PATCH 0/7] systemd patches

Jonas Bonn jonas at norrbonn.se
Wed Jan 2 11:48:43 UTC 2019


Hi Chen,

Thanks for looking at this.

On 02/01/2019 08:58, ChenQi wrote:
> Hi Jonas,
> 
> I'd like to talk about this patchset from a non-technical view.
> And to be brief, my conclusion is suggesting using some switch, e.g. 
> DISTRO_FEATURE, to control this 'stateless' behavior.
> Please see details below.

OK, I agree, and this is part of the plan.  The patches in this set, 
however, are independent of whether or not the user wants a "stateless" 
system or not.  (My primary requirement is actually a "volatile" system, 
with just an empty /var, but the two go hand in hand so working towards 
"stateless" at the same time as "volatile" seems reasonable).

> 
> This patchset is based on two assumptions:
> 1) Users would generally want 'stateless' system. Or in other words, 
> they would prefer 'stateless' more than 'stateful'.
> 2) Other softwares/upstreams are also working against this 'stateless' 
> goal.
> 
>  From the current situation, both are not that true. As your [PATCH 7/7] 
> points out, even systemd defaults to install things under /etc.
> 
> Cleaning up systemd's /etc files while leaving other softwares requiring 
> /etc files is not that pleasant. At a minimum, systemd users who are not 
> aware of this 'stateless' concept would be confused. "Where's my 
> /etc/systemd/system.conf file?!" They would ask.

If providing the "example" configuration file that systemd installs is 
necessary, then I think it would be better to provide it at:

/etc/systemd/system.conf.d/00-systemd-conf.conf

If the user edits that file, it at least overrides the "system" version 
at /usr/lib/system.conf.d/.  The toplevel file at 
/etc/systemd/system.conf has the lowest priority so editing it does not 
actually override the systemd settings under /usr.

But this is all unrelated to "stateless".  This is mostly a matter of 
getting "distro" configuration out of /etc which _allows for_ stateless 
down the road, if we want.


> So I'd suggest using something like 'stateless' DISTRO_FEATURE (just 
> like 'usrmerge') to control each recipe's behavior.

So, just to outline how "volatile" and "stateless" should work:

i)  The user selects "volatile"
ii)  There may then not be any directories, links, or files under /var
iii)  For directories and links, we need to create entries in 
tmpfiles.d/ so that they get created at boot
iv)  For files under /var, we need to move them to 
/usr/share/factory/var and create entries under tmpfiles.d/

v)  The same applies, roughly, to "stateless", replacing /var by /etc

I've got all this working with some fixups to the packaging and image 
classes and "volatile" works fine if one does the above.  The proper 
cleanup that OE needs to do, however, is to actually minimize the 
content installed in the /var and /etc by the packages in favour of 
tmpfiles and volatiles where possible.

"stateless" is trickier due to needing to handle users, etc., but we'll 
get there.

But please don't get hung up on the "stateless" aspect of things when 
looking at this patch series.  These systemd patches are independent of 
whether or not that is the goal.

/Jonas


> 
> Best Regards,
> Chen Qi
> 
> On 12/31/2018 08:05 PM, Jonas Bonn wrote:
>> These patches make some modifications to systemd with the long-term goal
>> of being able to run OE in systemd's "stateless" configuration.
>> "Stateless" boils down to building an image with empty /etc and /var
>> directories so that volatile (tmpfs) filesystems can be mounted there;
>> this requires that the system subsequently be able to populate these
>> directories dynamically, which systemd mostly takes care of if things
>> are done right.
>>
>> In these patches:
>> i)    Don't include machine-id in writable images so that systemd can run
>> its first-boot machinery
>> ii)   Move systemd configuration files out of /etc
>> iii)  Allow systemd to dynamically enable services and populate
>> /etc/systemd/system via the presets mechanism
>>
>> There's a long way to go to get to a working "stateless" configuration.
>> Getting to a "volatile" system (just empty /var) should be easier and
>> I'll post patches moving things in that direction shortly.
>>
>> /Jonas
>>
>> Jonas Bonn (7):
>>    systemd: do not create machine-id
>>    systemd-conf: simplify creation of configuration
>>    systemd: move additional conffiles to systemd-conf
>>    systemd: create preset files instead of installing in image
>>    systemd-systemctl-native: simplify and support preset-all
>>    rootfs-postcommands: call preset-all for read-only-rootfs
>>    systemd: do not pre-enable services, rely on presets
>>
>>   meta/classes/rootfs-postcommands.bbclass      |  8 ++++
>>   meta/classes/systemd.bbclass                  | 33 +++++++-------
>>   meta/recipes-core/systemd/systemd-conf.bb     | 45 +++++++------------
>>   .../systemd/systemd-systemctl/systemctl       | 36 +++------------
>>   meta/recipes-core/systemd/systemd_239.bb      |  4 ++
>>   5 files changed, 52 insertions(+), 74 deletions(-)
>>
> 


More information about the Openembedded-core mailing list