Running Modem Manager inside container

We’re trying to use Modem Manager from within a container in order to run AT commands (future blog post!) on cellular modems
This can be quite useful as with AT commands, we can find things like IMSI of the SIM card, signal strengh…etc…

testing out mmcli from within a container, we get the following:

# mmcli -m 0
error: couldn't get bus: Could not connect: No such file or directory

I’m guessing that necessary interfaces aren’t exposed in the container, would be great if this is something that could be configured or added as a resin feature

1 Like

Dear @eblex, I think you didn’t get my private messages. Please try to share with us the version and platform you are using information. In addition the mounted and devices lists as you see within the container.

Tomorrow we will have the whole team on board and we will be able to troubleshoot things better. Please, let us also know if we can connect to your device and see further.

Thank you for your patience.

Hello @yossi, sure, here’s my reply from the private message:
You can also check in with @shaunmulligan, we did the initial testing together

On ResinOS 2.2, using dashboard / app
In Docker file, we do:

FROM resin/%%RESIN_MACHINE_NAME%%-node:6-slim
RUN apt-get update && apt-get install -yq screen modemmanager

Once that’s deployed, we try to run the commands:

# mmcli -m 0
error: couldn't get bus: Could not connect: No such file or directory

and with AT command (to check IMSI)

# mmcli -m 0 --command=AT+CIMI
error: couldn't get bus: Could not connect: No such file or directory

both are failing as mmcli doesn’t seem to have access to its daemon running outside of Docker

Hey @eblex , I haven’t tested this from the container yet, but my guess is that mmcli can’t find the hostOS dbus socket, so one thing to try is to run export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket before running the mmcli commands.

Looks like the above works correctly, so you should be able to run AT commands. One thing that I would also recommend is that if you are running systemd in the container, then you should probably also disable and mask the ModemManager service so it doesn’t automatically run in the container and try manage the modems. you can do this using:

systemctl disable ModemManager
systemctl mask ModemManager

1 Like

@eblex did this issue get resolved, it seems to have gone quiet for a little while, so we’ll assume so, but if this is wrong just chirp up!

Thank you for the follow-up @shaunmulligan and @Sqweelygig
Just got around to testing this and it worked perefctly, I’ll write a more detailed blog post on this setup so that this can be used by other people.

we can close this forum topic.

As a note, I’ve now published a sample project on Github:

1 Like

Nice work!