How to configure networking using systemd in Yocto Project

To whome it may concern: My problems from above seem to have been because I was running thud. I just upgraded to zeus which broke my network config. Changing back to your filename for the conf file worked.

So everthing worked for me on thud using the filename “wpa_supplicant-wlan0.conf” and now it works on zeus with filename “wpa_supplicant-nl80211-wlan0.conf”.

Hi Hub Members,
According to Variscite (http://variwiki.com/index.php?title=Static_IP_Address):
ConnMan is the default Yocto network manager.
Systemd-networkd will conflict with it.
Do you recommend to use it and turn off ConnMan? Why? How?
Thank You
Israel

This is really going to be driven by your products requirements as to what you need and which gives you what you need. :slight_smile:

Personally i use Systemd-networkd (on variscite products as well custom ones) as i have to use it so heavily for others parts of my headless embedded products, local and cloud corporate servers. I had no need for anything else. But as i mentioned your requirements may differ.

@drewmoseley,
I found your excellent slides that can be helpful for this page’s visitors.

Thanks for finding that. It slipped my mind.

I didn’t realize that connman was the default but my local setups mostly use systemd-networkd. connman and NetworkManager may be better for devices that are going to be used in more dynamic situations as systemd-networkd doesn’t have any good frontends that I am aware of and mainly require editing config files.

Drew

10 posts were split to a new topic: Issues with systemd-networkd

How does this work when I am using a read only root file system. And I have to modify my .network file?

You’ll need to arrange for the .network file to be moved to the data partition and replaced with a symlink. Alternatively, if the changes are static, you can simply modify it in the Yocto build.
Drew

If I do that. I have restart systemd-networkd service after boot.

Well normally these kind of changes will be done in the Yocto build rather than on the target to avoid such issues. Do you have a requirement where it must be done on the target?
Drew

Well the requirement is to change wired.network as I have to switch between static and dynamic profile.

I am not an expert on yocto. I am still learning it
Do you mean instead of getting creating a separate recipe I need to create a bbappend file of that system recipe ?

Yes, that is the right approach.

I tried it with a systemd-conf bbappend file. That did not work. I am now trying to use systemd bbappend file

I would recommend searching the yocto workdir for the wired file to see which recipe installed it, just in case you are trying to extend the wrong recipe.

To give a brief context. I had added that file by creating a bbappend file for systemd-conf. That was before mender integration and r/w rootFile system.

So that’s the reason I tried systemd-conf_%.bbappend file but that did not work. But I will check out my work dir

Edit1:
Sorry. I will re-attach my systemd-conf file. I am having some issues while running it in bitbake

Edit2:
My systemd-conf_%.bbappend file

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

SRC_URI+= "\
	file://wired.network \
	"

FILES_${PN} += " \
	/data/network/wired.network \
	"

do_install_append() {
	install -d ${D}${sysconfdir}/systemd/network
	install -d ${D}/data/network
	install -m 0644 ${WORKDIR}/wired.network ${D}/data/network
	ln -s /data/network/wired.network ${D}${sysconfdir}/systemd/network/wired.network
}

when you say its not working, are you saying the symlink isnt appearing where you expect it?

the symlink appears. But for some reason I have to always restart the service(systemd-networkd) to get it work.

On every bootup. This started happening only after I moved .network file to my persistent data.

Check that networkd is not running before data partition is mounted

Assuming you have systemd-analyze installed
run ‘systemd-analyze plot > services.svg’
copy the svg to your machine and open in your image viewer (chrome will open it nicely and make it searchable)
and see if data.mount is happening later than systend-networkd

please give me a few minutes. I have to install systemd-analyze