[systemd-devel] /etc/os-release but for images

Lennart Poettering lennart at poettering.net
Wed Mar 23 10:32:54 UTC 2022


On Mi, 23.03.22 10:51, Davide Bettio (davide.bettio at secomind.com) wrote:

> Hello,
>
> First of all, thanks for your answers.
>
> It wasn't really clear to me that the /etc/os-release file was editable
> from a 3rd party other than the distribution maintainers, so thanks for the
> clarifications.

Well, it's not precisely supposed to be something users or admins
should edit. But image builders may.

> Are the distributions required to leave IMAGE_ID and
> IMAGE_VERSION empty?

Well, if the distribution people build both packages and disk images,
they can set IMAGE_ID/IMAGE_VERSION for the latter. But this should
always be part of building images, not of building packages.

> Can I safely just append those fields at the end of
> the copy of the /etc/os-release file?

That's the idea: take the packages, build an image, and then append
IMAGE_ID/IMAGE_VERSION to it?

> Speaking of BUILD_ID, according to the spec sounds like a field
> reserved to

BUILD_ID? That's a different thing...

https://www.freedesktop.org/software/systemd/man/os-release.html#IMAGE_ID=
vs.
https://www.freedesktop.org/software/systemd/man/os-release.html#BUILD_ID=

> distributions: "BUILD_ID may be used in distributions where the original
> installation image version is important", from my side what I need is to
> identify the git revision + build date of the recipe I'm using to cook the
> image installed on the system, also my plan is to change that ID every time
> I cook a new image, furthermore I plan to replace the whole operating
> system image (that I keep read-only) in order to update it, so BUILD_ID
> would change at every update (so it sounds slightly different from the
> original described semantic).

BUILD_ID is not for that. You are looking for IMAGE_VERSION.

> Last but not least, I was looking for a machine parsable unique id, so I
> plan to use BUILD_UUID if it is not kept reserved for other usages, that
> will be an UUID that is freshly generated every time I cook a new image.

What's this for?

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list