# BalenaOS ModemManager

**URL:** <https://forums.balena.io/t/balenaos-modemmanager/370701>\
**Category:** balenaOS\
**Created:** [June 11, 2024, 12:59pm UTC](https://forums.balena.io/t/balenaos-modemmanager/370701 "2024-06-11T12:59:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![berkayg](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@berkayg](https://forums.balena.io/u/berkayg)\
**Post date:** [June 11, 2024, 12:59pm UTC](https://forums.balena.io/t/balenaos-modemmanager/370701/1 "2024-06-11T12:59:43Z")

</div>

Hi all,

I run a container that provides 4g connectivity. I would like to update this container with its new features. But I believe that my container is tainted by ModemManager or NetworkManager during the update causes it to lose connection. I should be able to update devices from remote.

Any ideas about how to do this update smoothly? Maybe disabling modem manager completely? Can I somehow disable modemManager to mess around with my modem?

---

<div class="post-metadata">

**Author:** ![mpous](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mpous/32/4742_2.png) [@mpous](https://forums.balena.io/u/mpous)\
**Post date:** [June 11, 2024, 1:40pm UTC](https://forums.balena.io/t/balenaos-modemmanager/370701/2 "2024-06-11T13:40:22Z")

</div>

Hello @berkayg could you please share any logs?

What device type are you using? What OS version?

---

<div class="post-metadata">

**Author:** ![berkayg](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@berkayg](https://forums.balena.io/u/berkayg)\
**Post date:** [June 12, 2024, 2:14pm UTC](https://forums.balena.io/t/balenaos-modemmanager/370701/3 "2024-06-12T14:14:30Z")

</div>

I use photon-nano CTI board with a Sierra Wireless, Incorporated EM7421 modem. BalenaOS version is 4.0.9

I tried add following UDEV rules in config.json on /mnt/boot.

```auto
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1199", GOTO="mm_sierra_generic"
GOTO="mm_sierra_end"
LABEL="mm_sierra_generic"
SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", ENV{.MM_USBIFNUM}="$attr{bInterfaceNumber}"
ATTRS{idVendor}=="1199", ATTRS{idProduct}=="9091", ENV{.MM_USBIFNUM}=="00", SUBSYSTEM=="tty", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="1199", ATTRS{idProduct}=="9091", ENV{.MM_USBIFNUM}=="00", SUBSYSTEM=="tty", ENV{ID_MM_PORT_IGNORE}="1"
ATTRS{idVendor}=="1199", ATTRS{idProduct}=="9091", ENV{.MM_USBIFNUM}=="00", SUBSYSTEM=="tty", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
ATTRS{idVendor}=="1199", ATTRS{idProduct}=="9091", ENV{.MM_USBIFNUM}=="01", SUBSYSTEM=="tty", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="1199", ATTRS{idProduct}=="9091", ENV{.MM_USBIFNUM}=="01", SUBSYSTEM=="tty", ENV{ID_MM_PORT_IGNORE}="1"
ATTRS{idVendor}=="1199", ATTRS{idProduct}=="9091", ENV{.MM_USBIFNUM}=="01", SUBSYSTEM=="tty", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
ATTRS{idVendor}=="1199", ATTRS{idProduct}=="9091", ENV{.MM_USBIFNUM}=="02", SUBSYSTEM=="tty", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="1199", ATTRS{idProduct}=="9091", ENV{.MM_USBIFNUM}=="02", SUBSYSTEM=="tty", ENV{ID_MM_PORT_IGNORE}="1"
ATTRS{idVendor}=="1199", ATTRS{idProduct}=="9091", ENV{.MM_USBIFNUM}=="02", SUBSYSTEM=="tty", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
GOTO="mm_sierra_end"
LABEL="mm_sierra_end"

```

My final config.json was something like this. I used commands on here [GitHub - balena-os/meta-balena: A collection of Yocto layers used to build balenaOS images](https://github.com/balena-os/meta-balena?tab=readme-ov-file#udevrules:)

```auto
{
  ...
  "developmentMode": true,
  "deviceType": "photon-nano",
  "os": {
    "udevRules": {
      "70-mm-sierra": "SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"1199\", GOTO=\"mm_sierra_generic\"\nGOTO=\"mm_sierra_end\"\nLABEL=\"mm_sierra_generic\"\nSUBSYSTEMS==\"usb\", ATTRS{bInterfaceNumber}==\"?*\", ENV{.MM_USBIFNUM}=\"$attr{bInterfaceNumber}\"\nATTRS{idVendor}==\"1199\", ATTRS{idProduct}==\"9091\", ENV{.MM_USBIFNUM}==\"00\", SUBSYSTEM==\"tty\", ENV{ID_MM_DEVICE_IGNORE}=\"1\"\nATTRS{idVendor}==\"1199\", ATTRS{idProduct}==\"9091\", ENV{.MM_USBIFNUM}==\"00\", SUBSYSTEM==\"tty\", ENV{ID_MM_PORT_IGNORE}=\"1\"\nATTRS{idVendor}==\"1199\", ATTRS{idProduct}==\"9091\", ENV{.MM_USBIFNUM}==\"00\", SUBSYSTEM==\"tty\", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}=\"1\"\nATTRS{idVendor}==\"1199\", ATTRS{idProduct}==\"9091\", ENV{.MM_USBIFNUM}==\"01\", SUBSYSTEM==\"tty\", ENV{ID_MM_DEVICE_IGNORE}=\"1\"\nATTRS{idVendor}==\"1199\", ATTRS{idProduct}==\"9091\", ENV{.MM_USBIFNUM}==\"01\", SUBSYSTEM==\"tty\", ENV{ID_MM_PORT_IGNORE}=\"1\"\nATTRS{idVendor}==\"1199\", ATTRS{idProduct}==\"9091\", ENV{.MM_USBIFNUM}==\"01\", SUBSYSTEM==\"tty\", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}=\"1\"\nATTRS{idVendor}==\"1199\", ATTRS{idProduct}==\"9091\", ENV{.MM_USBIFNUM}==\"02\", SUBSYSTEM==\"tty\", ENV{ID_MM_DEVICE_IGNORE}=\"1\"\nATTRS{idVendor}==\"1199\", ATTRS{idProduct}==\"9091\", ENV{.MM_USBIFNUM}==\"02\", SUBSYSTEM==\"tty\", ENV{ID_MM_PORT_IGNORE}=\"1\"\nATTRS{idVendor}==\"1199\", ATTRS{idProduct}==\"9091\", ENV{.MM_USBIFNUM}==\"02\", SUBSYSTEM==\"tty\", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}=\"1\"\nGOTO=\"mm_sierra_end\"\nLABEL=\"mm_sierra_end\"\n"
    }
  },
}

```

This created a 77-mm-sierra.rules file under /etc/udev/rules.d . However, when I run mmcli -L on HostOS I still see modem as

```auto
mmcli -L
    /org/freedesktop/ModemManager1/Modem/0 [Sierra Wireless, Incorporated] EM7421

```

EDIT:  
dmesg | grep usb log for modem:

```auto
[1.768777] usb 1-2.2: new high-speed USB device number 4 using tegra-xusb
[1.790427] usb 1-2.2: config 1 has an invalid interface number: 8 but max is 3
[1.790438] usb 1-2.2: config 1 has no interface number 1
[1.791496] usb 1-2.2: New USB device found, idVendor=1199, idProduct=9091
[1.791506] usb 1-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[1.791513] usb 1-2.2: Product: Sierra Wireless EM7421 Qualcomm\xc2\xae Snapdragon\xe2\x84\xa2 X16 LTE-A
[1.791520] usb 1-2.2: Manufacturer: Sierra Wireless, Incorporated
[1.791527] usb 1-2.2: SerialNumber: 8G2324201704B128
[16.664568] usbcore: registered new interface driver qcserial
[16.664596] usbserial: USB Serial support registered for Qualcomm USB modem
[16.664644] usbcore: registered new interface driver btusb
[16.667802] usb 1-2.2: Qualcomm USB modem converter now attached to ttyUSB0
[16.671877] rtk_btusb: Realtek Bluetooth USB driver ver 3.1
[16.675728] usbcore: registered new interface driver rtk_btusb
[16.681299] usbcore: registered new interface driver cdc_wdm
[16.687477] usb 1-2.2: Qualcomm USB modem converter now attached to ttyUSB1
[16.689063] usb 1-2.2: Qualcomm USB modem converter now attached to ttyUSB2

```

I also fixed the syntax error in my udev rule above. Checked with udevadm test /dev/ttyUSB0  
cmd to test it. It reads the rule but still mmcli -L returns me the modem.

Any ideas how to make ModemManager to IGNORE this modem? @mpous

edit 2:

Running udevadm info /dev/ttyUSB[0-1-2] shows similar results as here:

```auto
udevadm info /dev/ttyUSB2
P: /devices/70090000.xusb/usb1/1-2/1-2.2/1-2.2:1.3/ttyUSB2/tty/ttyUSB2
N: ttyUSB2
L: 0
S: serial/by-path/platform-70090000.xusb-usb-0:2.2:1.3-port0
S: serial/by-id/usb-Sierra_Wireless__Incorporated_Sierra_Wireless_EM7421_Qualcomm®_Snapdragon™_X16_LTE-A_8G2324201704B128-if03-port0
E: DEVPATH=/devices/70090000.xusb/usb1/1-2/1-2.2/1-2.2:1.3/ttyUSB2/tty/ttyUSB2
E: DEVNAME=/dev/ttyUSB2
E: MAJOR=188
E: MINOR=2
E: SUBSYSTEM=tty
E: USEC_INITIALIZED=16904549
E: ID_VENDOR=Sierra_Wireless__Incorporated
E: ID_VENDOR_ENC=Sierra\x20Wireless\x2c\x20Incorporated
E: ID_VENDOR_ID=1199
E: ID_MODEL=Sierra_Wireless_EM7421_Qualcomm®_Snapdragon™_X16_LTE-A
E: ID_MODEL_ENC=Sierra\x20Wireless\x20EM7421\x20Qualcomm®\x20Snapdragon™\x20X16\x20LTE-A
E: ID_MODEL_ID=9091
E: ID_REVISION=0006
E: ID_SERIAL=Sierra_Wireless__Incorporated_Sierra_Wireless_EM7421_Qualcomm®_Snapdragon™_X16_LTE-A_8G2324201704B128
E: ID_SERIAL_SHORT=8G2324201704B128
E: ID_TYPE=generic
E: ID_BUS=usb
E: ID_USB_INTERFACES=:ffffff:ff0000:
E: ID_USB_INTERFACE_NUM=03
E: ID_USB_DRIVER=qcserial
E: ID_PATH=platform-70090000.xusb-usb-0:2.2:1.3
E: ID_PATH_TAG=platform-70090000_xusb-usb-0_2_2_1_3
E: ID_MM_DEVICE_IGNORE=1
E: ID_MM_PORT_IGNORE=1
E: ID_MM_CANDIDATE=1
E: DEVLINKS=/dev/serial/by-path/platform-70090000.xusb-usb-0:2.2:1.3-port0 /dev/serial/by-id/usb-Sierra_Wireless__Incorporated_Sierra_Wireless_EM7421_Qualcomm®_Snapdragon™_X16_LTE-A_8G2324201704B128-if03-port0
E: TAGS=:systemd:
E: CURRENT_TAGS=:systemd:

```

I see that ID\_MM\_PORT\_IGNORE=1 and ID\_MM\_DEVICE\_IGNORE=1. But mmcli -L still returns modem list. Are these ports ignored by mm or not I am confused 😮

---

<div class="post-metadata">

**Author:** ![berkayg](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@berkayg](https://forums.balena.io/u/berkayg)\
**Post date:** [June 13, 2024, 2:52pm UTC](https://forums.balena.io/t/balenaos-modemmanager/370701/4 "2024-06-13T14:52:06Z")

</div>

I am also okay with deleting the mmcli so that it doesn’t start on boot. But the mmcli binary seems to be in read-only partition. Anyways to remove it completely? I should be able to delete it for production images as well.

I am already trying to disable using d-bus inside a running container but that is not seem to be effective.

---

<div class="post-metadata">

**Author:** ![TJvV](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@TJvV](https://forums.balena.io/u/TJvV)\
**Post date:** [June 14, 2024, 7:52am UTC](https://forums.balena.io/t/balenaos-modemmanager/370701/5 "2024-06-14T07:52:55Z")

</div>

Hi,

According to some posts, it’s possible that ModemManager ignores specific udev tags when its filter policy is set to `strict`, which should be the default.

According to the [man pages](https://www.mankier.com/1/mmcli), there should be commands `mmcli --modem=0 --inhibit` and `mmcli --inhibit-device=[UID]`; maybe you can try your luck with that?  
Note that both of these are blocking commands, so you might want to run them in the background.

Something like

```auto
mmcli --modem=0 --inhibit &
PID=$!

./my_update_script.sh

kill $PID

```

If all else fails, you could always try a `kill $(pidof ModemManager)`.
