Linux 6.0 Allows Setting The Hostname Via New "hostname=" Parameter

Written by Michael Larabel in Linux Kernel on 9 August 2022 at 04:30 AM EDT. 10 Comments
LINUX KERNEL
A patch coming about earlier this year allows setting the system's hostname before user-space starts by way of the hostname= kernel parameter. That patch has now landed as part of Andrew Morton's accumulated changes for Linux 6.0.

The intent with this patch is for setting the hostname before the user-space starts with the behavior up to now relying upon user-space setting the hostname. However, the issue that was raised is that in the case of mdadm for managing RAID arrays it relies upon the hostname for determining if a disk is local or foreign to the system. But if bringing up the RAID array prior to the init system having set the hostname, unexpected results could occur.

So for mdadm and other niche use-cases that may be wanting to know the system hostname prior to user-space having set it, passing the value via the hostname= parameter can now be achieved with Linux 6.0+.


While the patch was ready ahead of the v5.19 merge window, it was only sent in now for Linux 6.0 by way of Andrew Morton's "non-MM" updates. That patch along with various other changes can be found via this pull. One other big in that pull request worth calling out is implementing readahead support for SquashFS.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week