B
BlueBuild2mo ago
Yokai

Key file does not have key “VERSION_ID” in group “os-release”

Hi, I recently asked in the dev channel by mistake about updating os-release contents so that a date is included that shows when the image was created. For example, silverblue does the following formatting style and is preserved in blue-build systems if you don't override the PRETTY_NAME entry. Fedora Silverblue 43.20251105.0 I was told this wasn't supported, and since I wanted this same formatting, I tried doing my own modification with the following:
# ...
- type: os-release
properties:
ID: fedora_maetel
ID_LIKE: fedora
Name: Maetel
PRETTY_NAME: Maetel [Fedora] Image

- type: containerfile
snippets:
- RUN sed -e 's/PRETTY_NAME=.*/PRETTY_NAME="Maetel [Fedora] '$( date +%y%m%d )'"/' /etc/os-release > /etc/os-release
# ...
# ...
- type: os-release
properties:
ID: fedora_maetel
ID_LIKE: fedora
Name: Maetel
PRETTY_NAME: Maetel [Fedora] Image

- type: containerfile
snippets:
- RUN sed -e 's/PRETTY_NAME=.*/PRETTY_NAME="Maetel [Fedora] '$( date +%y%m%d )'"/' /etc/os-release > /etc/os-release
# ...
This logically seemed like it wouldn't break the system, and AFAIK the os-release formatting is exactly as it should be. Any attempt to boot into this system however results in the following error:
error: Key file does not have key “VERSION_ID” in group “os-release”
error: Key file does not have key “VERSION_ID” in group “os-release”
There must be some other step I'm missing here. Any advice? Likewise, any chance this timestamping feature could be added to the nu script for the os-release module?
Solution:
So | tee /etc/os-release instead
Jump to solution
4 Replies
Luke Skywunker
Luke Skywunker2mo ago
You're using > /etc/os-release which overwrites the file entirely. I'd suggest piping through tee to see what's being put into the file
Solution
Luke Skywunker
Luke Skywunker2mo ago
So | tee /etc/os-release instead
Yokai
YokaiOP2mo ago
Ah, you're right that tee is the correct way to do this here. I wasn't aware of how the > redirect will truncate the target file first before running the sed operation, effectively nuking the file. Thanks for the help.
Yokai
YokaiOP2mo ago
I really should have tested this on a local file for inplace overwrites first, instead of writing it to another file and doing a diff locally.

Did you find this page helpful?