[systemd-devel] MulticastDNS Responder Hostname in Early Boot

Justin Brown Justin.Brown at fandingo.org
Mon Apr 29 06:15:43 UTC 2024


Hello,

I'm having some trouble the resolved as a multicast DNS responder in early
boot. I'm trying to setup a headless system with full disk encryption, and
I need to connect remotely (currently using tinyssh) to unlock sysroot and
other volumes before the boot continues. I use networkd to setup the dhcp
interface, which works fine. The problem is that resolved won't use the
value in /etc/hostname, and I can't find a resolved or networkd option to
specify a hostname. I double-checked to ensure that the hostname file is
correctly being included in the initramfs image, and it is. The multicast
DNS responder does work, but only for the fallback hostname set during
compilation: -Dfallback-hostname=archlinux for my test system.

Once the volumes are unlocked, and the system boots, resolved starts using
the correct value. The only thing that stands out is that I don't have dbus
running in the initramfs. (I was originally planning to use avahi, but
didn't want to compile a specific no-dbus binary along with a couple other
things, or the extra complexity of setting up dbus to run in the initramfs.
I turned to resolved because it was a single config line change to the
network unit.)

Here's some command excerpts from the initramfs:

=> cat /etc/hostname
testvm

=> grep -v '^#\|^$' /etc/systemd/network/initrd-network.network
[Match]
Name=eth*
[Network]
DHCP=yes
MulticastDNS=true
[DHCP]
UseHostname=true

=> journalctl -u systemd-resolved.service
Apr 29 05:53:25 testvm systemd-resolved[109]: Positive Trust Anchors:
Apr 29 05:53:25 testvm systemd-resolved[109]: . IN DS 20326 8 2
e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d
Apr 29 05:53:25 testvm systemd-resolved[109]: Negative trust anchors:
home.arpa 10.in-addr.arpa 16.172.in-addr.arpa 17.172.in-addr.arpa
18.172.in-addr.arpa 19.172.in-addr.arpa 20.172.in-addr.arpa
21.172.in-addr.arpa 22.172.in-addr.arpa 23.172.in-addr.ar>
Apr 29 05:53:25 testvm systemd-resolved[109]: Defaulting to hostname
'archlinux'.

=> systemd-resolve --status
sd_bus_open_system: No such file or directory

I can connect to this system with `ssh root at archlinux.local` but not the
expected `ssh root at testvm.local`.

Thanks,
Justin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20240429/9fb76d05/attachment.htm>


More information about the systemd-devel mailing list