Bug 2037338 - systemd-hostname service not started in initrd
Summary: systemd-hostname service not started in initrd
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: dracut
Version: 37
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: dracut-maint-list
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-01-05 13:19 UTC by Ian Dall
Modified: 2022-12-17 10:58 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: ---
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)
dracut config dropin file (430 bytes, text/plain)
2022-01-05 13:19 UTC, Ian Dall
no flags Details
Path (1.69 KB, patch)
2022-01-05 13:24 UTC, Ian Dall
no flags Details | Diff
Patch to enable systemd-hostnamed. (1.33 KB, patch)
2022-11-21 05:37 UTC, Ian Dall
no flags Details | Diff

Description Ian Dall 2022-01-05 13:19:10 UTC
Created attachment 1849026 [details]
dracut config dropin file

Description of problem:
Even when dracut is configured with systemd-network-management, which includes systemd-hostnamed, hostnamed is not started

Version-Release number of selected component (if applicable):
dracut-055-6.fc35.x86_64

How reproducible:
Always

Steps to Reproduce:
1.Configure dracut to use systemd-hostnamed
2.Create initrams
3.Boot in a dhcp enviroment with parameter rd.break
4.In emergency shell type journal -u systemd-network

Actual results:
There is a "Could not set hostname" error. Journalctl logs all messages with the default hostname "fedora". journalctl -u systemd-hostnamed shows the hostnamed never ran.

Typing hostnamectl results in Failed to connect to bus: Connection refused


Expected results:

Log shows Hostname set to <hostname> (transient)


Additional info:

This happens because systemd-hostnamed is not in in /etc/group and dbus.socket is included but not enabled, so systemd-hostnamed, which is dbus activated, never runs.

The systemd-hostnamed is not in the hosts /etc/group so the the method of extracting the group from the hosts /etc/group and putting it in the inird /etc/group doesn't work.

This group name is placed in a sysusers conf file (systemd-hostname-dracut.conf), but systemd-sysusers is included in initramfs but never started. There seems little point in arranging systemd-sysusers to run in initrd when it could just as well run  on the host, which is what I have done in the attached patch. Note that it requires arranging for the systemd-sysusers module to be run last (after any modules which install configuration files in sysusersconfdir).

Comment 1 Ian Dall 2022-01-05 13:24:50 UTC
Created attachment 1849028 [details]
Path

This patch requires 01systemd-sysusers be renamed to 99systemd-sysusers

Comment 2 Ian Dall 2022-11-21 05:37:09 UTC
Created attachment 1926022 [details]
Patch to enable systemd-hostnamed.

As of Fedora36, systemd-hostnamed is not started in initrd. Now there is an attempt to create the systemd-hostnamed group, but it fails. Also a link to enable dbus activation is missing.

Create required link so systemd-hostnamed can be started via dbus so
that, for example hostnamectl works.

Remove GECOS field from the entry for systemd-hostname as it is not
understood by systemd-sysusers and this group is required for the
systemd-hostnamed service to run.

Comment 3 Ben Cotton 2022-11-29 17:36:08 UTC
This message is a reminder that Fedora Linux 35 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 35 on 2022-12-13.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '35'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 35 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.


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