Modem with roaming SIM unnecessarily searches for operators
When using an MVNO SIM that can roam on different networks, once a modem has registered on a network, the network registration info (PLMN, RAT, etc) is cached on the SIM. On subsequent reconnections (such as power cycling the modem), this cached network information should allow the modem to reconnect to the same network quickly without rescanning for available operators, provided that the network operator is still available.
However, when ModemManager is restarted (either by systemctl restart
or simply restarting the host device), or upon reinsertion of the modem, the modem is unnecessarily put into network search mode, which prevents IP connectivity throughout the duration of the scan. Depending on the modem, the cellular connection is not available for several minutes until the scan is complete.
- Host device: Raspberry Pi 3B with Rapberry Pi OS Lite (Buster 2020-05-27)
- Linux raspberrypi 5.4.51-v7+
- mmcli 1.10.0
- nmcli tool, version 1.14.6
- Modems tested: Quectel EC25-J, EG25-G, EC25-E
Before each test, we first checked that the modem has successfully registered on a local network to ensure that network information was properly cached on the SIM (in other words, there is no change of SIM or modem that would cause the modem to initiate a network rescan by itself).
Test 1:
- Reboot device with modem unplugged.
- Check that MM has started successfully (no modem detected).
- Insert modem and wait for MM to detect it. There is a short delay of a few seconds between when the modem is detected by the system (and
/dev/ttyUSBx
ports are enumerated) and when MM detects the modem. During this short window, the modem successfully registers to the cached network, andAT+CREG?
returns0,5
as expected. - MM detects the modem and initializes it for use with a NetworkManager connection profile. The modem's 3GPP registration status changes to
roaming
, andAT+CREG?
returns0,2
. During this time, NM assumes the connection is ahctive, but all packets are lost since the modem is busy searching for available networks. - After the modem completes the network scan,
AT+CREG?
finally returns to0,5
again, the 3GPP registration status changes tohome
, and IP connectivity is established.
Test 2:
- From a connected state, keep the modem plugged in, but restart MM (using
systemctl stop
andsystemctl start
). - Steps 3 and onward above are the same, with the same observed behavior.
Test 3:
- From a connected state, keep MM running but unplug and replug the modem.
- Steps 3 and onward above are the same, with the same observed behavior.
We repeated each of the tests above with several SIMs across several MNOs and could reproduce this behavior consistently:
- SIM with MCCMNC 29505 is allowed to roam on MNO 44010. Network search occurs, which blocks IP connectivity for several minutes.
- SIM with MCCMNC 29510 is allowed to roam on MNO 44051. Network search occurs, which blocks IP connectivity for several minutes.
- SIM with MCCMNC 50212 is allowed to roam on MNO 44020. Network search occurs, which blocks IP connectivity for several minutes.
- SIM with MCCMNC 44010 connects to home network MNO 44010. Network search does not occur.
- SIM with MCCMNC 44051 connects to home network MNO 44051. Network search does not occur.
As a control, we also tested each combination without ModemManager, and insteaad setting up IP connectivity using WvDial (pppd). In each "roaming" situation, the modem immediately registers to the roaming network (AT+CREG?
returns 0,5
), no network rescanning occurs, and WvDial is able to create a ppp0 connection without any delay.
Attached ModemManager and NetworkManager debug logs from Test 1 above. Modem goes into network scan mode around 1596438064 (when 3GPP Registration state changes to roaming
), and IP connectivity is finally reestablished around 1596438199 (when 3GPP Registration state changes to home
).
We have anecdotally also seen this behavior with some u-blox modems, and are also currently testing this behavior against Simcom, Huawei, and some other devices.
Greatly appreciate your insight if there is some udev hint or possibly DBus setting that can suppress the network rescan as it should not occur unless the modem specifically cannot find the cached operator.