Announcement

Collapse
No announcement yet.

Linux To Introduce The Ability To Set The Hostname Before Userspace Starts

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Linux To Introduce The Ability To Set The Hostname Before Userspace Starts

    Phoronix: Linux To Introduce The Ability To Set The Hostname Before Userspace Starts

    While the hostname on Linux systems is widely relied upon for different applications, setting the hostname is usually left up to user-space by the init system at boot. However, should any user-space processes try to read the system hostname prior to it being set, it could lead to unintended results. So now finally in 2022 there is a kernel parameter working its way upstream with "hostname=" should you want to ensure the hostname is set before user-space is started...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite

  • #2
    hosrtname?

    Comment


    • #3
      Is there any chance that this is going to be backported?

      Comment


      • #4
        Originally posted by rshpount View Post
        hosrtname?


        Its a real syscall to the Linux kernel. Yes you ask for hostname out the Linux kernel it returns nodename that is really settable value. It is possible to build a Linux install that after the system is booted you cannot change nodename once you are in usermode. Basically if the PID 1 process drops the capability to to change the hostname/nodename after that point you cannot change it. So I can understand some people wanting this backported for making locked system images but you want to be able to start the system images with different hostname values for identify self to network.

        Comment


        • #5
          Originally posted by oiaohm View Post
          Originally posted by rshpount View Post
          hosrtname?

          Its a real syscall to the Linux kernel.
          I think his point was the typo - "With mdadm it relies upon hosrtname matching..."

          Interesting info about locking the hostname after early init (or potentially even earlier now), though. That had never occurred to me.

          Comment


          • #6
            Originally posted by molletts View Post

            I think his point was the typo - "With mdadm it relies upon hosrtname matching..."

            Interesting info about locking the hostname after early init (or potentially even earlier now), though. That had never occurred to me.
            This is not typical in the desktop world, where you can leave a few millisecond before the hostname is set. But it's an important part of the very early init on many servers and on many embedded devices. This is something I dreamt of multiple times - being able to feed the hostname directly from the uboot command line is a big plus for me.

            So kudoes to Andrew for this!

            Comment


            • #7
              It's been possible to give a kernel a custom hostname since ages ago.
              CONFIG_DEFAULT_HOSTNAME. By default it's "(none)" iirc.
              So it's not like the kernel won't answer with a hostname.

              It will. But not a cmdline dynamic one.

              Comment


              • #8
                how important. Surely this will finally make it the year of the Linux desktop! ;-)

                Comment


                • #9
                  Originally posted by oiaohm View Post
                  So I can understand some people wanting this backported for making locked system images but you want to be able to start the system images with different hostname values for identify self to network.
                  Yeah, I can imagine this would be useful for two cases in particular — network boot and virtual machines. It's the kind of thing you want for running datacentres, where all this stuff is handled by some orchestration infrastructure rather than local configuration.

                  Comment


                  • #10
                    Originally posted by CochainComplex View Post
                    Is there any chance that this is going to be backported?
                    To what?
                    Stable trees? unlikely.
                    Your distribution's kernel? Pretty much up to them.

                    Comment

                    Working...
                    X