You are not logged in.
Ok, that seems to be NM specific (or maybe related to your NM config, I see no reason at all why NM would implicitly unblock the radio, maybe some dispatcher script?)
What about connman?
(mind the iwd configuration!)
Offline
connman connects if iwd service is active. But the error with connman_iwd service persists, and the airplane does not work.
wifi disconnects and I'm unable to reconnect. connmanctl gives "not registered" error.
These are the dispachers on my system:
$ ls /etc/NetworkManager/dispatcher.d/
10-ntpd no-wait.d pre-down.d pre-up.d wlan_auto_toggle_newer.sh.old
Last edited by Strangiato (2023-03-22 14:12:50)
Offline
the airplane does not work
Please don't paraphrase, https://bbs.archlinux.org/viewtopic.php?id=57855
=> updated journal?
These are the dispachers on my system:
The filenames won't really help all that much…
Offline
# cat 10-ntpd
#!/bin/bash
case "$2" in
up)
systemctl start ntpd.service
;;
down)
systemctl stop ntpd.service
;;
esac
# cat wlan_auto_toggle_newer.sh.old
#!/bin/sh
if [ "$1" = "enp1s0" ]; then
case "$2" in
up)
nmcli radio wifi off
;;
down)
nmcli radio wifi on
;;
esac
elif [ "$(nmcli -g GENERAL.STATE device show enp1s0)" = "20 (unavailable)" ]; then
nmcli radio wifi on
fi
These directories are empty:
no-wait.d pre-down.d pre-up.d
Offline
# cat wlan_auto_toggle_newer.sh.old
#!/bin/sh
if [ "$1" = "enp1s0" ]; then
case "$2" in
up)
nmcli radio wifi off
;;
down)
nmcli radio wifi on
;;
esac
elif [ "$(nmcli -g GENERAL.STATE device show enp1s0)" = "20 (unavailable)" ]; then
nmcli radio wifi on
fi
Is this supposed to be some elaborate joke?
Offline
Offline
That's great and everything, but you're facing a situation where NM immediately reverts an rfkill and you've a dispatcher script around that conditionally flips the radio and that didn't give you any pause? You didn't feel like mentioning the fact?
Move that script away (*really* away, idk what NM will actually execute) and see what that does to "tHe aIrPlAnE MoDe dOeS NoT WoRk wItH NeTwOrKmAnAgEr"
Offline
I used the dispatcher without any problem with airplane mode for quite a while. At some point the airplane mode stopped working, that's why I renamed the dispatcher file to .old
I have just deleted the dispatcher file, now the airplane mode works with NM + iwd at least.
The error with connman_iwd service persists when connman is active but I don't care anymore.
Why is networking manager executing a .old file?
Last edited by Strangiato (2023-03-22 16:18:16)
Offline
The name doesn't matter, each executable file is executed.
As it reads that elif will simply get triggered no matter what on any kind of callback into the dispatcher and will activate the radio if it doesn't see a LAN cable attached. You probably want to expand that condition so that it does not turn the radio on when the device went down intentionally
Online
The name doesn't matter, each executable file is executed.
Thanks for the info.
You probably want to expand that condition so that it does not turn the radio on when the device went down intentionally
Exactly. How to do it?
Offline
elif [ ! ( "$1" = "wlan0" -a "$2" = "down" ) -a "$(nmcli -g GENERAL.STATE device show enp1s0)" = "20 (unavailable)" ]; then
...
or so I'd guess.
Generally if this script "used to work". Did it stop working when you installed iwd? as that will enforce a change to the old names you'll likely need to check for eth0 rather than enp1s0
Online
Thanks, V1del. Possibly the dispathcer stopped working after installing iwd. I'm not sure.
I have created this file:
/etc/NetworkManager/dispatcher.d/wlan_auto_toggle.sh
#!/bin/sh
if [ "$1" = "enp1s0" ]; then
case "$2" in
up)
nmcli radio wifi off
;;
down)
nmcli radio wifi on
;;
esac
elif [ ! ( "$1" = "wlan0" -a "$2" = "down" ) -a "$(nmcli -g GENERAL.STATE device show enp1s0)" = "20 (unavailable)" ]; then
nmcli radio wifi on
fi
Ran:
$ sudo chmod +x /etc/NetworkManager/dispatcher.d/wlan_auto_toggle.sh
$ sudo systemctl restart NetworkManager
The airplane mode is still working but the wifi remains connected after connecting the network cable.
Connman is connecting, so I'm going to mark this topic as solved.
Thank you very much, seth and V1del.
And sorry for wasting your time, seth.
Offline
There's no waste - in the end the situation got solved.
Just next time try to come up with possibly relevant details a bit earlier
Offline
Nice. Thanks again, seth.
I have just found a script to automatically enable and disable WiFi based on Ethernet connection.
/etc/NetworkManager/dispatcher.d/70-wifi-wired-exclusive.sh
#!/bin/bash
export LC_ALL=C
enable_disable_wifi ()
{
result=$(nmcli dev | grep "ethernet" | grep -w "connected")
if [ -n "$result" ]; then
nmcli radio wifi off
else
nmcli radio wifi on
fi
}
if [ "$2" = "up" ]; then
enable_disable_wifi
fi
if [ "$2" = "down" ]; then
enable_disable_wifi
fi
Then run
sudo chown root:root /etc/NetworkManager/dispatcher.d/70-wifi-wired-exclusive.sh
sudo chmod 744 /etc/NetworkManager/dispatcher.d/70-wifi-wired-exclusive.sh
sudo systemctl restart NetworkManager
source: https://blog.christophersmart.com/2021/ … rkmanager/
Now the wifi is disabled when connecting the cable, and re-enabled when disconnecting it.
Edit:
But then the airplane mode stops working again. lol
Looks like I have to choose between working airplane mode and automatically enabling and disabling WiFi based on Ethernet connection. lol
Last edited by Strangiato (2023-03-22 20:40:46)
Offline