[yocto] systemd-networkd

C. Handel opensource at macht-blau.org
Thu Aug 25 09:55:20 PDT 2016


   hi,

i'm trying to build an image with systemd that runs systemd-networkd to
initialize the network.

So far it boots, the interface goes up and it receives an IP via dhcp.

I now try to update my hostname from the one received by dhcp. As far as i
understand systemd, the systemd-networkd sends a dbus message, this will
trigger systemd-hostnamed. The setting of the hostname is protected by
polkit. This is all configured. I can see the message on the bus and is
also see the log entry of hostnamed. But the hostname does not change

Aug 25 16:29:08 genericx86-64 systemd-networkd[203]: enp0s3: Gained carrier
Aug 25 16:29:08 genericx86-64 systemd[1]: Starting Hostname Service...
Aug 25 16:29:08 genericx86-64 systemd[1]: Starting Authorization Manager...
Aug 25 16:29:08 genericx86-64 systemd-hostnamed[216]: Changed host name to
'vm009'


Did I miss anything?

Greetings
   Christoph



the bbappend for systemd

FILESEXTRAPATHS_append := "${THISDIR}/files:"
SRC_URI += "file://eth.network"

FILES_${PN} += "{sysconfdir}/systemd/network/*"

PACKAGECONFIG += "networkd resolved timesyncd hostnamed polkit myhostname"

# for version 230 yocto fixes this
# networkd requires a user
USERADD_PARAM_${PN} += "--system -d / -M --shell /bin/nologin
systemd-network;"
# resolved requires a user
USERADD_PARAM_${PN} += "--system -d / -M --shell /bin/nologin
systemd-resolve;"
# timesyncd requires a user
USERADD_PARAM_${PN} += "--system -d / -M --shell /bin/nologin
systemd-timesync;"

do_install_append() {
  install -d ${D}${sysconfdir}/systemd/network/
  install -m 0644 ${WORKDIR}/*.network ${D}${sysconfdir}/systemd/network/
}



and the eth.network


[Match]
Name=en*

[Network]
DHCP=ipv4

[DHCP]
UseDNS=true
UseNTP=true
UseHostname=true
UseDomains=true
UseRoutes=true
# otherwise a uuid is generated and we only assign via MAC address
ClientIdentifier=mac
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20160825/02acfbdb/attachment.html>


More information about the yocto mailing list