Frequent disconnection using Huawei MS2131i-8 3G USB dongle

Hi there,
I’m experiencing frequent disconnection when using a Huawei MS2131i-8 3G USB dongle on a Raspberry Pi 3 B+ installed with Resin OS 2.13.6+rev1.
Some times I’ve been able to recover from problems disabling the connection, removing the huawei_cdc_ncm kernel module, reloading it then enabling the connection again.
Other times I had to restart ModemManager on the host via a DBUS call.
Any ideas?
Regards,
Danilo

Hi. Can you provide the output of journalctl --no-pager -u NetworkManager when these disconnects happen please?

Sure. Here it is:

Sep 01 07:40:07 b651902 NetworkManager[716]: <info>  [1535787607.3850] policy: auto-activating connection 'h3g' (09d0ce75-bf1b-4bed-aea4-6d1890f47d61)
Sep 01 07:40:07 b651902 NetworkManager[716]: <info>  [1535787607.3927] device (ttyUSB2): Activation: starting connection 'h3g' (09d0ce75-bf1b-4bed-aea4-6d1890f47d61)
Sep 01 07:40:07 b651902 NetworkManager[716]: <info>  [1535787607.3946] device (ttyUSB2): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Sep 01 07:40:07 b651902 NetworkManager[716]: <info>  [1535787607.4014] device (ttyUSB2): state change: prepare -> need-auth (reason 'none', sys-iface-state: 'managed')
Sep 01 07:40:07 b651902 NetworkManager[716]: <info>  [1535787607.4117] device (ttyUSB2): state change: need-auth -> prepare (reason 'none', sys-iface-state: 'managed')
Sep 01 07:40:07 b651902 NetworkManager[716]: <info>  [1535787607.4215] modem["ttyUSB2"]: modem state changed, 'registered' --> 'connecting' (reason: user-requested)
Sep 01 07:40:07 b651902 NetworkManager[716]: <info>  [1535787607.4357] modem["ttyUSB2"]: modem state changed, 'connecting' --> 'registered' (reason: user-requested)
Sep 01 07:40:07 b651902 NetworkManager[716]: <warn>  [1535787607.4362] modem-broadband[ttyUSB2]: failed to connect modem: Couldn't connect: cannot keep data port open.Could n
ot open serial device ttyUSB0: it has been forced close
Sep 01 07:40:07 b651902 NetworkManager[716]: <info>  [1535787607.4365] device (ttyUSB2): state change: prepare -> failed (reason 'unknown', sys-iface-state: 'managed')
Sep 01 07:40:07 b651902 NetworkManager[716]: <warn>  [1535787607.4402] device (ttyUSB2): Activation: failed for connection 'h3g'
Sep 01 07:40:07 b651902 NetworkManager[716]: <info>  [1535787607.4417] device (ttyUSB2): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')

Thanks for the logs, we’re aware of similar problems.
What is the SIM type you are using? Is it a special SIM or a regular one from a mobile carrier?

It’s a regular SIM. Actually a data-only Super Internet PRO 30 GB from Wind Tre here in Italy.

BTW, do you think that trying with a different SIM may solve the problem??

I have now two Raspberry Pi 3 B+ using a MS2131i-8 modem. Both suffer frequent disconnection.
The strange thing is that is always work on one board only, while the other also seems to need to be rebooted some times.

The code is this (the reboot is not included, but it is done via HTTP communication via the Supervisor):

try:
    tlshoot.network.connection.connectionDisable( modemconnection )
    time.sleep( 5 )
    modules.rmmod( 'huawei_cdc_ncm' )
    time.sleep( 5 )
    modules.modprobe( 'huawei_cdc_ncm' )
    time.sleep( 5 )
    tlshoot.network.connection.connectionEnable( modemconnection )
    time.sleep( 5 )
except Exception as exception:
    syslog.syslog( syslog.LOG_ERR, "can't reset modem: {}".format( str( exception ) ) )
try:
    import dbus
    bus = dbus.bus.BusConnection( 'unix:path=/host/run/dbus/system_bus_socket' )
    systemdmanagerproxy = bus.get_object( 'org.freedesktop.systemd1', '/org/freedesktop/systemd1' )
    systemdmanager = dbus.Interface( systemdmanagerproxy, 'org.freedesktop.systemd1.Manager' )
    job = systemdmanager.RestartUnit( 'ModemManager.service', 'fail' )
except Exception as exception:
    syslog.syslog( syslog.LOG_ERR, "can't reset network: {}".format( str( exception ) ) )

Regards,
Danilo

We have observed this kind of problem on particular SIM cards. If you can use a SIM card from a different provider for a while to test this, it would be great.

Ok, I’m going to try with 3 different SIMs/operators in the next days.

Have you got any suggestion to get out of troubles by resetting/restarting/clearing something within the container or the host OS? Something different from turning off and on again the Raspberry or detaching and attaching again the 3G dongle. That is, something that may stay within the code.

I’m trying with three different options:

  1. Reloading the huawei_cdc_ncm kernel module via rmmod/modprobe within the container
  2. Restarting the ModemManager Systemd unit via DBUS on the host from the container
  3. Rebooting the system via Supervisor using curl on the container

I believe that I have still not found the root cause, because the first action may be sufficient some times, while other times I also need to reboot. Also, just rebooting may work… or not!

Also, is there any data/log/whatever I can obtain from within my container as long as I detect a network outage for debugging?
E.g. Is there any way to obtain the NetworkManager/ModemManager logs from the host OS from within the container?

You can see this sample project https://github.com/resin-io-playground/resin-nmcli and user nmcli to inspect and to try and bring the connection down and up again with it.

Have you managed to try with different SIMs? I am interested in the test results with SIMs from other mobile carriers

I’ve activated 3 more SIM from Ho Mobile (Vodafone), Kena Mobile (TIM) and Iliad here in italy.
The first two are under testing right now.

Have you any suggestion about wath to look for with nmcli?
Is there any way a can “save” the journal for the NetworkManager unit from the host OS or get it via the container?

Hi. We are testing a fix currently. Will come back to you in a few days when we have had enough time to confirm the modem stability with the changes we did

Great!
By now, I’m experiencing the same problem on all the new SIMs. Maybe one of them is giving the error less frequently.
Also, most important, I’m experiencing the problem even if the Raspberry Pi is also connected to my network via Ethernet!

Hi @floion!
Is there any issue I can follow on GitHub or something else can would allow me to “partecipate”?
As said before, now I have some new Raspberry Pi 3 B+ with Resin OS 2.13.6+rev1 on board for testing and all of them are disappearing from time to time. The problem pesistes even if the boards are connected to an Ethernet network, non only with the 3G dongle. Also, just reboot does not always work!

@daghemo we have merged the modem fix so this will be available in the next OS release (due in about 1 week).
Also, for the WiFi disconnect problems, can you try to replicate that on the latest OS versions available? (2.15.1+rev1)

Ethernet disconnect problems, not WiFi.
Is there any issue/article/whatelse than I can look at? Or, in other words, what was the problem?

As of yesterday I switched from 2.13.6+rev1 to 2.15.1+rev1.

As you may remember I have 3 Raspberry Pi 3 B+ with both Ethernet and 3G USB dongle connected (no WiFi).
The SIM are from different operators.
After updating to 2.15.1+rev1 the problem still remains. Some hours ago I disconnected the 3G USB dongles from the first 3 boards and the problem seems to have disappeared. That is, just having the 3G USB dongle configured and connected creates problems, even if the boards have their default gateway on the Ethernet!

I have other boards with 2.17.7+rev1 and they do not present the same problem.

Hi. The fix for this was https://github.com/resin-os/resin-raspberrypi/pull/242

This fix has not made it into 2.15.1+rev1. It will be present in the next 2.15 release which is due in the next few days.

Thank you @floion! BTW, I was trying 2.15.1 just because of your other post here above.

Do you think that deleting 77-mm-huawei-net-port-types.rules from within /mnt/sysroot/{active,inactive} on the host OS will work in the meantime? I’m going to try in the next few hours.

@daghemo that is exactly what YOU SHOULD NOT DO.
You actually need to add

# Airtel branded E3372h-607, using huawei-cdc-ncm driver but with unresponsive cdc-wdm port
ATTRS{idVendor}==“12d1”, ATTRS{idProduct}==“1506”, ENV{ID_MM_HUAWEI_NDISDUP_SUPPORTED}=“1”

to /lib/udev/rules.d/77-mm-huawei-net-port-types.rules just before this line

LABEL=“mm_huawei_port_types_end”

Well, you are obviously right. :slight_smile:
I’ve added that line and will test on 2.15.1 for some days.