I have this problem while using modem Quactel UC20G. It works when I run on resin host mmcli --scan-modems. But when docker image starts it disconnects and never connects again. Below is complete system log.
When I use the same setup with ZTE MF823 modem it works fine. I have commented out udev trigger in my entry.sh file. I have the following section in connection (with infinite retries) but that does not help with Quactel.
hey @llap . I have a Quectel EC20, which I think uses the same modemManager plugin. If you can point me to some code, even just a minimal example that causes the behaviour I am sure we can get to the bottom of it.
in fact it happens for any application - for instance for below. Just after flashing and boot - I see in dashboard both addresses ethernet and gsm. After the docker starts the gsm connection is gone.
Hey @llap, I finally found some time to work on this a bit. I managed reproduce the issue on my intel NUC with a Quectel EC20 (it should use the same modemManager plugin as far as I can tell). I used your gists to create a test project and sure enough it will kill the GSM modem everytime the container starts. One thing I do note however, is that this example you have posted does not explicitly disable the udevadm trigger in the entry.sh. In any case, I have created this project https://github.com/shaunmulligan/gsmTest
In the master branch I have adapted the project to use the official docker base images. With this adaption, I have been unable to get the modem to ever disconnect, both via multiple app restart, updates, etc. This version however has some obvious differences to your example:
it doesn’t have systemd init system anymore (this might be problematic to your code, depending on if you use systemd services or not.
I had to add ENV DEBIAN_FRONTEND noninteractive as base debian images don’t add that.
the image is slightly bigger than the resin based one, with a final build size of 797.54 MB
I will continue looking into getting a solid working example with the resin/intel-nuc-debian base image and follow up here.
Alright, So I have also identified the a way to get this working with the resin/intel-nuc-debian image. The following two things need to be done:
disable systemd init system in the container, i.e. you need to have ENV INITSYSTEM off in your dockerfile. It appears when systemd starts it also runs a udevadm trigger that replugs the modem and some modems never automatically reconnect.
second thin you need to do is remove the line udevadm trigger &> /dev/null from your entry.sh. This will disable the replaying of events on container start up.
I have created a branch called resin-base-image on the project: https://github.com/shaunmulligan/gsmTest/tree/resin-base-image . @llap can you please try this branch on your device with the Quectel UC20G and ensure that it no longer disconnects the modem at container start up?
@shaunmulligan Yes it does work with INITSYSTEM disabled and modified entry.sh. However, my application is interactive, on device with touch screen. I need access to devices and touch events. What could I do?
@llap, even with the initsystem disabled, the udevd daemon should still populate devices if they are added. Is the touch screen not working in your tests? I haven’t figured out a way around this yet, I unfortunately don’t yet have a good enough understanding of how systemd interacts with udev. I will check with some of my colleagues to see if they have any clever ideas of how to work around this issue.
@llap, according one of my colleagues, the best way forward here would be to work out which udev rules are needed for the modem and specific touch screen and get them added into the resinOS host system. This would then allow you to run the application without having to use udev in the container and everything should work.
So I guess the first step is identifying what udev rules we would need to add?
@shaunmulligan I have installed modemmanager on guest system (keeping initsystem on) and somehow it fixed the problem. I don’t fully understand implication of that though but it appears to work.