On 4/14/22 03:17, Joakim Lotsengård wrote:
Possible bug when /var/lib/iwd is a symlink:
iwd assumes that it will create the storage directory on first start. So it
should never be a symlink. How/why are you creating the symlink in the first place?
I ran across a problem when the ending part of /var/lib/iwd is a symlink.
In my case it points to /mnt/persistent/iwd. We are an IoT device that runs
on UBIFS (+ tmpfs) and the entire rootfs partition of the NAND will be
updated on FOTA. Hence anything we want to save in an upgrade must be on a
persistent partition. Our target is a Freescale i.MX6 Ultralite module
running an ARM A7 core (if that matters).
Can you mount /var/lib/iwd directly?
Problem seems to be that the l_dir_watch_new() call in knownnetworks.c never
follows symlink. l_dir_watch_new() uses IN_DONT_FOLLOW in its call to
inotify_add_watch() in ell.
Right, along with some other flags that are on purpose for security reasons.
This will make the known network list misbehave. If one forgets a
known-network via iwctl, the list doesn't get updated. The same goes for
connecting to a not already known network. It is easy to reproduce. Just
symlink /var/lib/iwd to another location and run some connect + forget in
iwctl. One can also note that adding a new /var/lib/iwd/my_ssid.psk, by
manually creating the file, is not picked up by iwd automatically.
Looks like we do not check that the inotify watch creation failed. So we should
I've only tested this with iwd 1.17 and ell 0.43 due to the complexity to
build another version using Yocto. However, I've checked the source code
for iwd on master and they don't seem to handle the fact that /var/lib/iwd
is a symlink. I've tried to search the mailing-list and google, but can't
find anything about this. It seems I can change the /var/lib/iwd directory
during compilation by setting DAEMON_STORAGEDIR during configure/build.
However, that is a bit unflexible as my system is Yocto based, and hacking
the Yocto recipes for this seems wrong. Normally you symlink things in your
file tree in IoT devices to point to persistent storage areas.
I don't have a solution, but at least iwd should detect that /var/lib/iwd is
a symlink and warn the user. The implication is that the known-network list
doesn't work at all. The internal known-network list should work even if
I think iwd should fail to start if /var/lib/iwd is a symlink...
Perhaps also it should be allowed to change the default storage dir in
I think that is probably the best approach. Patches are always welcome of course.