[OE-core] [OE-Core][PATCH] systemd: Default to non-stateless images

Jonas Bonn jonas at norrbonn.se
Mon May 6 11:11:38 UTC 2019


Hi Peter,

On 06/05/2019 12:28, Peter Kjellerstedt wrote:
>> -----Original Message-----
>> From: openembedded-core-bounces at lists.openembedded.org <openembedded-
>> core-bounces at lists.openembedded.org> On Behalf Of Jonas Bonn
>> Sent: den 6 maj 2019 06:54
>> To: Alex Kiernan <alex.kiernan at gmail.com>; openembedded-
>> core at lists.openembedded.org
>> Subject: Re: [OE-core] [OE-Core][PATCH] systemd: Default to non-
>> stateless images
>>
>> Hi Alex,
>>
>> The below is fine and looks good.  The one thing that bothers me about
>> this is that "stateless" isn't really a property of the "distro",
>> rather
>> it's a property of the image/machine.  I suspect, in the same sense
>> that
>> we have readonly-rootfs, that we should probably have image features
>> "stateless-rootfs" (no /etc, no /var) and "volatile-rootfs" (no /var).
>>
>> Furthermore, if you want to boot with 'ro' on the command-line, I
>> really
>> think you need to build your image with the "readonly-rootfs" feature
>> set.  The default should be writable+persistent /etc as that's the
>> configuration used 99% of the time (currently).  "readonly-rootfs" does
>> a bit more than just creating machine-id but it's all relevant to the
>> 'ro' case where /etc isn't writable.
>>
>> Just for clarification:
>>
>> i)  volatile-rootfs:  means there's no point in prepopulating /var
>> because it's on a tmpfs and needs to be populated at boot time
> 
> This doesn't really say anything about the state of the rootfs outside
> of /var, i.e., is it writable or read-only?
> 
>> ii)  stateless-rootfs:  means there's no point in prepopulating neither
>> /etc nor /var because they are on a tmpfs and need to be populated at
>> boot time
> 
> Same here.
> 
>> iii)  readonly-rootfs:  means that /etc is really not writable so it's
>> important that: the systemd first-boot stuff needs to be done at build
>> time:  machine-id, unit files set up, all tmpfiles.d snippets that
>> touch /etc and /var need to be done in advance.
>>
>> /Jonas
> 
> Maybe we need some more generic way of describing the intended
> structure of the image? E.g., what are the expected behavior of
> /etc, /var and the rest of the rootfs? For each they can typically
> be "read-only", "persistent" (writable and survives reboots) or
> "volatile" (writable, but doesn't survive a reboot).

Alex already put this link into an earlier response but I'll repeat it 
here and defer to it for the terminology and justification.

http://0pointer.net/blog/projects/stateless.html

That said, the paradigm here is that:

i)  /etc MUST be writable
ii)  /var MUST be writable
iii)  For everything, it doesn't matter... writable or not.  Most 
importantly, though, read-only is OK and no program should assume that 
they can write outside of /etc and /var (and /tmp and /run).

/Jonas

> 
> //Peter
> 


More information about the Openembedded-core mailing list