Skip to contentSkip to conversation

systemd-conf: Allow systemd to manage QEMU wired networks

PATCH In review Joshua Watt 3 participants 4 messages Jan 15, 2021 – Mar 4, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 systemd-conf: Allow systemd to manage QEMU wired networks

Allows systemd to manage wired network interfaces just like on actual hardware. Systemd seems to be smart enough to not enable DHCP if the interface was assigned a IP address in the kernel (e.g. by runqemu), so the existing use cases should continue to work.

---
 meta/recipes-core/systemd/systemd-conf_247.2.bb | 3 ---
 1 file changed, 3 deletions(-)
meta/recipes-core/systemd/systemd-conf_247.2.bb +0 -3
index 944b56ff82..ea35e83f4f 100644
@@ -29,9 +29,6 @@ do_install() {
 # Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52
 do_install_append_qemuall() {
 	install -D -m0644 ${WORKDIR}/system.conf-qemuall ${D}${systemd_unitdir}/system.conf.d/01-${PN}.conf
-
-	# Do not install wired.network for qemu bsps
-	rm -rf ${D}${systemd_unitdir}/network
 }
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
Signature · 1 line
2.30.0
#1 lore raw
Quoted 21 lines · Joshua Watt

Allows systemd to manage wired network interfaces just like on actual hardware. Systemd seems to be smart enough to not enable DHCP if the interface was assigned a IP address in the kernel (e.g. by runqemu), so the existing use cases should continue to work.

---
 meta/recipes-core/systemd/systemd-conf_247.2.bb | 3 ---

 1 file changed, 3 deletions(-)
meta/recipes-core/systemd/systemd-conf_247.2.bb +0 -0
index 944b56ff82..ea35e83f4f 100644
@@ -29,9 +29,6 @@ do_install() {
  # Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52
  do_install_append_qemuall() {

  install -D -m0644 ${WORKDIR}/system.conf-qemuall ${D}${systemd_unitdir}/system.conf.d/01-${PN}.conf

meta/recipes-core/systemd/systemd-conf_247.2.bb +0 -3
-
-	# Do not install wired.network for qemu bsps
-	rm -rf ${D}${systemd_unitdir}/network
Quoted 1 line

 }

We did this for a reason. In testing we're seeing:

https://autobuilder.yoctoproject.org/typhoon/#/builders/110/builds/1831
https://autobuilder.yoctoproject.org/typhoon/#/builders/110/builds/1830

which I suspect could be related to this.

Cheers,

Richard

#2 lore raw

Hello Richard.

Quoted 26 lines · Richard Purdie
Quoted 15 lines · Joshua Watt

Allows systemd to manage wired network interfaces just like on actual hardware. Systemd seems to be smart enough to not enable DHCP if the interface was assigned a IP address in the kernel (e.g. by runqemu), so the existing use cases should continue to work.

---
  meta/recipes-core/systemd/systemd-conf_247.2.bb | 3 ---
  1 file changed, 3 deletions(-)
meta/recipes-core/systemd/systemd-conf_247.2.bb +0 -0
index 944b56ff82..ea35e83f4f 100644

meta/recipes-core/systemd/systemd-conf_247.2.bb do_install() { · line 32

Quoted 7 lines
meta/recipes-core/systemd/systemd-conf_247.2.bb +0 -3
@@ -29,9 +29,6 @@ do_install() {
  # Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52
  do_install_append_qemuall() {
  	install -D -m0644 ${WORKDIR}/system.conf-qemuall ${D}${systemd_unitdir}/system.conf.d/01-${PN}.conf
-
-	# Do not install wired.network for qemu bsps
-	rm -rf ${D}${systemd_unitdir}/network
  }

We did this for a reason. In testing we're seeing:

Quoted 4 lines

https://autobuilder.yoctoproject.org/typhoon/#/builders/110/builds/1831
https://autobuilder.yoctoproject.org/typhoon/#/builders/110/builds/1830

which I suspect could be related to this.

I looked into this a bit more. We started to use the network unit file for qemu as well, because we have a use case where it uses DHCP. That indeed broke the runqemu static IP configuration from the kernel commandline.

What we do here to cover both use cases is to skip the unit if we find the IP to be configured on the kernel commandline. The following in the match section does the trick for us:

KernelCommandLine=!ip

Joshua, do you want to update the unit file accordingly or me to send a patch superseding yours with this change integrated?

regards
Stefan Schmidt

#3 lore raw

Hello.

Quoted 34 lines · Stefan Schmidt

Hello Richard.

Quoted 26 lines · Richard Purdie
Quoted 17 lines · Joshua Watt

Allows systemd to manage wired network interfaces just like on actual hardware. Systemd seems to be smart enough to not enable DHCP if the interface was assigned a IP address in the kernel (e.g. by runqemu), so the existing use cases should continue to work.

---
  meta/recipes-core/systemd/systemd-conf_247.2.bb | 3 ---

  1 file changed, 3 deletions(-)
meta/recipes-core/systemd/systemd-conf_247.2.bb +0 -0
index 944b56ff82..ea35e83f4f 100644
@@ -29,9 +29,6 @@ do_install() {
   # Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52
   do_install_append_qemuall() {
Quoted 5 lines

      install -D -m0644 ${WORKDIR}/system.conf-qemuall ${D}${systemd_unitdir}/system.conf.d/01-${PN}.conf -
-    # Do not install wired.network for qemu bsps
-    rm -rf ${D}${systemd_unitdir}/network
  }

We did this for a reason. In testing we're seeing:

Quoted 4 lines

https://autobuilder.yoctoproject.org/typhoon/#/builders/110/builds/1831
https://autobuilder.yoctoproject.org/typhoon/#/builders/110/builds/1830

which I suspect could be related to this.

Quoted 7 lines

I looked into this a bit more. We started to use the network unit file for qemu as well, because we have a use case where it uses DHCP. That indeed broke the runqemu static IP configuration from the kernel commandline.

What we do here to cover both use cases is to skip the unit if we find the IP to be configured on the kernel commandline. The following in the match section does the trick for us:

KernelCommandLine=!ip

Joshua, do you want to update the unit file accordingly or me to send a patch superseding yours with this change integrated?

I went ahead and posted a patch that has the two changes and matches (sic) what we have in place in our layers.

I would expect this to pass the yocto autobuilder now, but if not I would need to get access to the test files to figure out what wen wrong.

regards
Stefan Schmidt