RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1918681 - Transient hostname is lost upon systemd-hostnamed restart
Summary: Transient hostname is lost upon systemd-hostnamed restart
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: systemd
Version: 8.3
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: 8.0
Assignee: systemd-maint
QA Contact: Frantisek Sumsal
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-01-21 11:06 UTC by Renaud Métrich
Modified: 2024-03-25 17:56 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-01-21 14:55:54 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1918676 0 medium CLOSED Modifying the hostname is not being applied immediately 2024-03-25 17:55:58 UTC

Description Renaud Métrich 2021-01-21 11:06:28 UTC
Description of problem:

When changing the Transient hostname through using the following command:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# hostnamectl --transient set-hostname <newhostname>
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

The hostname is lost upon systemd-hostnamed stopping and restarting.

Is that expected? If so what is this Transient hostname stuff about?


Version-Release number of selected component (if applicable):

systemd-239-41.el8_3.1.x86_64


How reproducible:

Always

Steps to Reproduce:
1. Modify the transient hostname

# hostnamectl --transient set-hostname vm-gui83-renamed
# hostnamectl | grep vm-gui83
   Static hostname: vm-gui83
Transient hostname: vm-gui83-renamed


2. Wait for systemd-hostnamed to become inactive (~30 seconds)

# while systemctl is-active systemd-hostnamed; do sleep 10; done
active
inactive

3. Check hostname again (which starts systemd-hostnamed)

# hostnamectl | grep vm-gui83
   Static hostname: vm-gui83

Actual results:

   Static hostname: vm-gui83
(Transient hostname lost)

Expected results:

   Static hostname: vm-gui83
Transient hostname: vm-gui83-renamed

Comment 1 Renaud Métrich 2021-01-21 11:12:20 UTC
I would expect Transient hostname to apply to /proc/sys/kernel/hostname only, but it's not the case.

Comment 2 David Tardon 2021-01-21 14:44:44 UTC
(In reply to Renaud Métrich from comment #1)
> I would expect Transient hostname to apply to /proc/sys/kernel/hostname
> only, but it's not the case.

It does, but only if static hostname (/etc/hostname) is not set. Don't ask me what's the reasoning behind this...

Comment 3 David Tardon 2021-01-21 14:55:06 UTC
(In reply to Renaud Métrich from comment #0)
> # hostnamectl --transient set-hostname vm-gui83-renamed
> # hostnamectl | grep vm-gui83
>    Static hostname: vm-gui83
> Transient hostname: vm-gui83-renamed

This is actually a small bug in systemd-hostnamed: the internal data are never updated. In this case, the passed transient hostname was not written into /proc/sys/kernel/hostname because static hostname exists, but the internal transient hostname entry still contains the value passed by hostnamectl.

Comment 4 David Tardon 2021-01-21 14:55:54 UTC
Closing as this works as specified, even if it's a bit weird.


Note You need to log in before you can comment on or make changes to this bug.