On 30.04.20 10:43, Zbigniew Jędrzejewski-Szmek wrote: > On Mon, Apr 27, 2020 at 12:00:36PM +0200, Thomas HUMMEL wrote: >> On 4/27/20 11:51 AM, Mantas Mikulėnas wrote: >> >> Hello, thanks for your answer. >> >>> On Mon, Apr 20, 2020 at 6:17 PM Thomas HUMMEL >>> <thomas.hummel@xxxxxxxxxx <mailto:thomas.hummel@xxxxxxxxxx>> >>> wrote: >>> >>> 1. why does the transient hostname change while I stated --static only >>> while running hostnamectl ? >>> >>> 2. why does the change take some time to appear on dbus ? >>> >>> >> >>> Hostnamed does not implement receiving hostname change >>> notifications from the kernel, so it always reports you the same >>> hostname that it has seen on startup. >> >> That was my understanding as well. > > Lennart opened a PR to remove the caching: > https://github.com/systemd/systemd/pull/15624. > >>> You're only seeing changes because hostnamed /exits when idle/ -- >>> the next time you're actually talking to a brand new instance of >>> hostnamed, which has seen the new hostname. >> >> But this does not explain why the transient hostname is changed as I >> only changed the static one, does it ? Unless this new instance sets >> it from the static one when it starts ? I mean something has to call >> sethostname(2) to set the transient to the new static one, right ? > > The documentation is wrong. The code in hostnamed sets the kernel > hostname when setting the static one. This was changed in > https://github.com/systemd/systemd/commit/c779a44222: > > commit c779a44222161155c039a7fd2fd304c006590ac7 > Author: Stef Walter <stef@xxxxxxxxxxxxx> > Date: Wed Feb 12 09:46:31 2014 +0100 > > hostnamed: Fix the way that static and transient host names interact > > It is almost always incorrect to allow DHCP or other sources of > transient host names to override an explicitly configured static host > name. > > This commit changes things so that if a static host name is set, this > will override the transient host name (eg: provided via DHCP). Transient > host names can still be used to provide host names for machines that have > not been explicitly configured with a static host name. > > The exception to this rule is if the static host name is set to > "localhost". In those cases we act as if no > static host name has been explicitly set. > > We need to reconcile the code and the docs. I'd go for updating the docs > to match the code, because this is a long-standing behaviour and people > haven't been complaining about it. (I'm assuming you're not unhappy, just > confused by the unexpected results...). Opinions? I'd support that. Obviously I should have included a docs patch in my pull request :S Stef _______________________________________________ systemd-devel mailing list systemd-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/systemd-devel