Mobile Data always gets reenabled on reboot
Originally reported in #133 (comment 413998):
Unfortunately, [the mobile data toggle] is not completely fixed: The setting is not remembered when I restart the phone! So it always starts connecting to the mobile data, which means that things running on startup, such as the PackageKit/Discover refresh, can consume mobile data without me being able to do anything about it.
The first time, it was even worse: Not only did it connect to the mobile data, but the toggle claimed that mobile data was "not available" and did not let me disable it. I was not able to reproduce that one though: I retried twice and then it showed up as enabled and let me disable it. (But that is still not what should happen: if I restart the phone with mobile data disabled, it should stay disabled!)
Yikes, this is what I worried about
So what should happen is that all NM device should have autoconnect turned off when the mobile data is off, could you please use
nmclito check the state/settings of the NM modem device before and after reboot?
"Not Available" shows up only if a NM modem device is not found, or there is no SIM reported on the NM modem device... I'm not sure how you would've been able to have mobile data without a SIM being reported
So I answered:
Before the reboot:
cdc-wdm0: disconnected "cdc-wdm0" 6 connections available gsm (qmi_wwan, option), autoconnect, hw, mtu 1500
After the reboot:
cdc-wdm0: connected to Internet "cdc-wdm0" gsm (qmi_wwan, option), hw, iface wwan0, mtu 1500 inet4 10.82.171.84/29 route4 10.82.171.80/29 metric 700 route4 default via 10.82.171.85 metric 700
Disabling it from the toggle brings me back to the previous state.
The weird thing is that it always says "autoconnect", even if I explicitly
nmcli d set ifname cdc-wdm0 autoconnect off.
As for where the 6 connections come from, they are a leftover from ofono times that might be part of the mess: There are 3 copies of each connection because ofono loved renaming the modem device between wwan0, wwan1, and wwan2, and for each device, there is a
DEFAULT connection that would always get created and that did not work, for which I had set autoconnect to off, and an
Internet connection which uses the correct APN, for which I had set autoconnect to on. (And the autoconnect setting on the connections is still the same, which is strange, because your loop should leave only one connection set to autoconnect.)
As for the "Not Available" state, I have no idea how that happened, and I was unable to reproduce it.
I guess there is some NM behaviour that is different from anticipated... So the thing is when mobile data is disabled, I have the device set to not autoconnect, but I set the active connection to autoconnect (so that we can "remember" which profile/APN to reactivate). Perhaps at boot it ignores the device settings and has the active connection reconnect? If that's the case, then I'd have to persist the profile to reconnect somewhere else...
To confirm this, set all connections associated with the modem to not autoconnect after you turn off mobile data and reboot.
Could you please create a fresh new issue for this, putting the details you have here? I will try my best to get to it during April or sooner (when I have extended time to be able to test mobile data).
Hence, I am filing this new issue. I will add more information as soon as I have it.