Re: DHCP6 client failing when /etc is mounted as overlayfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 1, 2021, 19:42 Alessandro Tagliapietra <tagliapietra.alessandro@xxxxxxxxx> wrote:
Thanks for helping Mantas,

What I saw is:
 - before first boot /etc/machine-id is empty (and I think that's expected)
 - right after boot, /etc/machine-id isn't writable because the root fs is mounted as readonly from fstab
 - after the /etc overlay is mounted /etc/machine-id should still be the one from the underlying filesystem and at this point is also writable, however it's still empty

During boot I see:

[    3.577477] systemd[1]: Initializing machine ID from random generator.
[    3.584284] systemd[1]: Installed transient /etc/machine-id file.

however /etc/machine-id shouldn't be writable at that point, what should I do?

If it's not writable at that point, systemd will *mount* a temporary writable file on top of it, and will generate an ID that's temporary for that boot.

It's possible that your overlay goes on top of that and provides its own empty machine-id file again...

Make our overlay mount unit depend on whatever service is generating machine-id and make sure our mount happens before the generation of machine-id?

That might work, and would allow the machine-id and thus the DUID to be persistent.

As an alternative you could tell networkd to use DUID-LLT (?), which doesn't need the machine-id and just uses the MAC address, but there may be other things which use the machine-id anyway...


Thanks

--
Alessandro Tagliapietra


On Tue, Jun 1, 2021 at 12:13 AM Mantas Mikulėnas <grawity@xxxxxxxxx> wrote:
On Tue, Jun 1, 2021 at 10:07 AM Alessandro Tagliapietra <tagliapietra.alessandro@xxxxxxxxx> wrote:
Hello everyone,

I'm using yocto to create a custom linux image for a raspberry pi.
We have an "agent" that writes /etc/systemd/network/20-eth.network when the final user wants to have a static IP address and we remove the file when they switch back to DHCP.

After creating/deleting the file above we run `networkctl reload && networkctl reconfigure eth0`.
We mount the overlayfs with a custom .mount unit.

We've noticed that DHCP works fine if systemd-networkd starts before we mount the overlayfs but it doesn't if systemd-networkd is restarted/reconfigured after the folder is mounted or started after the overlay .mount unit.

Every interface DHCP fails with:

DHCPv6 CLIENT: Failed to set DUID-EN: No medium found
eth0: DHCP6 CLIENT: Failed to set DUID: No medium found

My guess is that it's related to /etc/machine-id somehow becoming inaccessible, since networkd's DUID-EN (DUIDType=vendor) is based on that.

--
Mantas Mikulėnas
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux