Linux To Introduce The Ability To Set The Hostname Before Userspace Starts
Dan Moulding posted the patch earlier this month to allow setting the Linux hostname before user-space starts. At least one real-world scenario where there is the possibility of running into problems with the current behavior is with the mdadm utility for managing RAID arrays. With mdadm it relies upon hostname matching for determining if a local or foreign disk array and taking different paths as a result. If mdadm tries to fetch the hostname prior to being read from the file-system and set by the init system, it could run into unexpected behavior.
It's somewhat surprising it took so long for such functionality to be implemented.
So the patch working its way toward mainline allows the "hostname=" kernel parameter if wanting to set the desired hostname early on in the kernel boot process prior to the file-system being mounted and user-space starting for getting onto the init system setting the hostname. It's sort of a stop-gap solution and an extra step to jump through for users/administrators wanting to ensure their hostname is set for such early boot scenarios, but it's going to become available for those who want it.
The patch adding this "hostname=" parameter was added to Andrew Morton's new kernel Git branch this week. As such it should be sent in as part of his patches for the Linux 5.19 merge window unless any issues arise.