Wrong hostname since #3922
mkosi commit the issue has been seen with
main
Used host distribution
Fedora 42
Used target distribution
Fedora 42
Linux kernel version used
6.16.10-200.fc42.x86_64
CPU architectures issue was seen on
x86_64
Unexpected behaviour you saw
Since #3922 my machines have the transient hostname fedora set instead of the one I configured using Hostname=. This is likely because the hostname is no longer propagated to the default initrd and thus not saved in DEFAULT_HOSTNAME= in /etc/os-release. I assume this needs an updated SettingScope though I am unsure which one to use
Used mkosi config
mkosi output
It would be SettingScope.inherit but I'm unsure if it's the right behavior to have all subimages inherit the locale, root password, hostname and other firstboot settings.
Hostname is unique in that regard as it is the only setting not actually handled by the firstboot service
But the same worry still applies that propagating it into every subimage might not be applicable.
Could also introduce a new settings scope but that seems like unnecessary complexity just for this setting
I'm inclined to just say that if you want your initrd to have the same hostname then you'll have to define a custom initrd subimage and set it there.
The problem are usr-only images where /etc/hostname is lost. In that case the hostname just gets set to "fedora" in the initrd (or whatever is set in the initrd's os-release) and not updated when transitioning to the proper rootfs
I don't get the issue? If you add a custom initrd subimage and set Hostname= there it'll be included in the initrd as before.
Yes sure that works, as would setting systemd.hostname= on the cmdline, however, this is very unintuitive for usr-only images and one more thing to stumble upon and figure out why it does not work if one does not find this discussion