Workaround for broken network tray applet
I'll post about this problem here, and solution, as it eluded me
for some days. It has also hit other users of EasyOS in the
past...
What happens is you bootup, there is an ethernet or wifi
connection to the Internet, that you see in a notify window that
pops up at top-right of screen. Yet, the network tray icon remains
showing disconnected.
That's the problem. What happens is the binary-executable daemon
/usr/local/pup_event/pup_event_frontend_d is started by
/root/.xinitrd when Xorg has started, and that daemon waits for
network events, and updates, amount other things,
/tmp/pup_event_backend/network_ ...but the daemon misses the
network event.
Here is the source code for pup_event_frontend_d:
https://github.com/bkauler/woofq/blob/main/easyos/source/gcc/pup_event_frontend_d.c
...God, did I write that!!! I wrote it in 2019, and it is now
like trying to read a foreign language.
Anyway, got the gist of it. The daemon will detect a network is
"up" and write the interface, for example "wlan0", to
/tmp/pup_event_backend/network_
The network tray applet reads /tmp/pup_event_backend/network_ and
will display network connected if there is something in that
'network_' file.
However, sometimes it is empty. This can occur when /usr/bin/NetworkManager, which is started by /etc/init.d/rc.networkmanager (or in the latest Easy Excalibur, /etc/init.d/network-manager) makes a network connection before pup_event_frontend_d has started. So the latter misses out on detecting a network change.
...at least, that's what seems to be happening. Doesn't explain
why I never had this problem before (though others have reported
it).
The source code for the network-manager-applet can be found here:
http://distro.ibiblio.org/easyos/source/alphabetical/n/
...I'm using this one, with patch, not the .deb one available
from the Debian repository.
I was scratching my head for a few days, trying to recall how it
all hangs together. Back in 2019-2020, I did have some code to
trigger pup_event_frontend_d, let it know that a network status
has changed, in case it missed it. But that code is currently not
being used...
You can find this not-used code at the bottom of
/usr/sbin/delayedrun, and also in /usr/local/pup_event/netchg
Now, conducting an experiment...
I emptied /tmp/pup_event_backend/network_, made it a zero-size
file, and yes, the network tray applet immediately showed as
disconnected. Then did this in a terminal:
# ip link set lo down
# ip link set lo up
...nup. Tried this:
# echo change > /sys/class/net/wlan0/uevent
No joy either. So, what is happening in pup_event_frontend_d? I
thought it would detect those changes. Tried a couple of other
things, didn't trigger the daemon either. Hmmm...
OK, will cheat. In the delayedrun script, at the bottom, detect
if /tmp/pup_event_backend/network_ is empty, if so, run
'getlocalip' to find out which network interface is connected to
the Internet, then just directly write it, say "wlan0", to
/tmp/pup_event_backend/network_
...yes, network tray applet now working.
I'll put in that workaround, into /usr/sbin/delayedrun, this:
if [ -e /tmp/pup_event_backend/network_ ];then
if [ ! -s /tmp/pup_event_backend/network_ ];then
xIF="$(getlocalip | grep '^[we][lt]' | cut -f 1 -d ':' | head -n 1)"
if [ -n "${xIF}" ];then
echo -n "${xIF}" > /tmp/pup_event_backend/network_
fi
fi
fi
But really should study that pup_event_frontend_d daemon C code,
try and figure out why it isn't triggering.
EDIT:
Proper fix, see next blog post:
https://bkhome.org/news/202507/proper-fix-for-network-tray-applet.html
Tags: easy