[systemd-devel] systemd and hostnamed (and nss-myhostname) - an alternative path

JB jerome at silentdome.com
Fri Jul 29 05:50:03 PDT 2011


I'm a happy Arch Linux user of systemd.  I want to share a few of my
thoughts about systemd's interaction with the system hostname.

Here's my understanding of how systemd currently sets the hostname
     * hostnamed is included in the systemd package

     * During early boot systemd makes a call to hostnamed and the 
hostname is
     set to the value in /etc/hostname

My proposal for systemd's interaction with the hostname
     * hostnamed & nss-myhostname are packaged together in a 'hostnamed' 
package

     * systemd requires this new package

     * A 'Set Hostname' unit is distributed with systemd.  Users and 
distros are
     free to override the unit if needed

     * (Wishlist/Off topic) Has any thought been given to having the 
various ttys
     and syslogs listen via dbus for a hostname changed signal so they can
     immediately change the hostname displayed and their log messages.  
Are there
     any other apps/daemons that could benefit from doing this?

My reasoning
     * I have a use case where I need to change the hostname on each 
boot at boot
     time.  I'm able to do this with a custom 'Set Hostname' unit but my 
logs
     always show the hostname from the previous boot because systemd 
sets it to
     the value in /etc/hostname before I can change it.  I also loose 
time at
     boot because hostname is being set twice.  If I could just set an
     ExecStartPre on a systemd provided 'Set Hostname' unit my isues 
would be
     solved.

     * There is absolutely nothing systemd specific about hostnamed 
(Correct me if
     I'm mistaken).  Non-systemd distros/users can benefit from 
hostnamed without
     hassle if it's maintained outside of the systemd tree

Downside to my method
     * Hostname is set a few milliseconds later in the boot process

Upsides
     * Flexibility to support my and yet to be forseen use cases for a 
dynamic
     hostname change at boot without effectively setting the hostname twice
     and having an incorrect hostname in syslog messages

     * Non-systemd distros get to easily share in the greatness of hostnamed

I've been thinking about this issue for awhile but this email was 
sparked when I
noticed an item on the TODO for systemd that mentions an intent to
pull nss-myhostname into systemd.

Sorry for such a long first mail but please share your thoughts.

-Jerome


More information about the systemd-devel mailing list