Setting APN Details
Mark Corbin
mcorbin at lunarenergy.com
Mon Jul 28 16:26:46 UTC 2025
On Sat, 26 Jul 2025 at 16:47, Dan Williams <dan at ioncontrol.co> wrote:
>
> On Wed, 2025-07-23 at 15:29 +0100, Mark Corbin wrote:
> > Hello
> >
> > I'm using ModemManager together with NetworkManager to control a
> > Quectel BG95 modem. We have 2 versions of SIM with different APNs.
> > When trying to update from the old APN to the new APN I've come
> > across an issue where the modem PDP context doesn't get updated.
> >
> > Where we have modems that report:
> > +CGDCONT: 1,"IP","OldAPN","0.0.0.0",0,0,0
> > they don't get updated by MM to 'NewAPN'.
> >
> > If the modem reports:
> > +CGDCONT: 1,"IP","","0.0.0.0",0,0,0
> > or
> > +CGDCONT: 1,"IP","","0.0.0.0",0,0,0
> > +CGDCONT: 2,"IP","OldAPN","0.0.0.0",0,0,0
> > then MM adds the 'NewAPN' PDP context to the end of the list and
> > everything works.
>
> It might have to do with the initial EPS bearer context ID. When you
> are running with --debug, do you see these messages at all?
>
> mm_obj_dbg (self, "initial EPS bearer context cid found: %u", min_cid);
>
> and also:
>
> mm_obj_dbg (self, "context definition format: minimum %d, maximum %d",
I can't see any messages like that in the debug output.
>
> It might be that for your device profile #1 is considered the EPS
> initial bearer.
I'm beginning to think that profile #1 is the EPS initial bearer and
needs to be 'blank' to work. It seems that because we have previously
overwritten it with the old APN entry it now won't work/update to the
new APN.
>
> >
> > Looking at the debug logs it seems that the modem needs to be
> > registered to the network before MM will add the new context for the
> > new APN (I guess that this is what the +CGDCONT:
> > 1,"IP","","0.0.0.0",0,0,0 is allowing to happen). Is this correct?
> > And will a 'blank' entry always allow you to register to a network?
>
> When asked to connect, MM waits until the modem is registered with the
> network before doing the APN configuration and starting the data
> connection. The APN configuration doesn't actually affect network
> registration itself, but does affect bearer creation after.
>
> The modem and network will usually auto-activate the EPS initial bearer
> and use an APN that is either specified in the CGDCONT configuration
> manually or if empty uses the default APN from the network. Which
> profile # the initial bearer uses can be different depending on the
> modem firmware and vendor.
>
> >
> > I was hoping to upgrade systems in the field just by updating the
> > 'apn=...' entry in the NetworkManager 'nmconnection' file, but it
> > looks like I will also have to manually delete the existing PDP
> > contexts and add a blank one too.
>
> You shouldn't have to. When the APN is specified in the configuration,
> MM is supposed to look for an existing profile/context that matches the
> configuration (including APN) and use that, otherwise create a new one
> to use. If MM is not using the APN you give, that's a bug.
>
> Would you be able to provide (privately, if you prefer) the --debug
> logs from ModemManager during an activation where the problem occurs?
>
Please see the attached log files as follows:
1) mm-wrong-context-not-registering.log
Modem starts with the wrong APN configured in the first profile
(+CGDCONT: 1,"IP","eapn1.net","0.0.0.0",0,0,0) and it never registers
or updates the APN to 'wlapn.com'.
2) mm-blank-context-registers.log
Modem starts with an empty APN in the first profile (+CGDCONT:
1,"IP","","0.0.0.0",0,0,0) and it registers, updates and connects.
Thanks
Mark
> Thanks,
> Dan
>
> >
> > Thanks
> >
> > Mark
> > --
> > ModemManager is v1.18.8
> > NetworkManager is v1.36.2
> >
> > --
> >
> > Mark Corbin
> > Senior Software Engineer |
> > lunarenergy.com | LinkedIn | Instagram
> > Lunar Energy Logo
> >
> > C2:Restricted unless otherwise stated.
> >
> > Lunar Energy Limited is a company registered in England and
> > Wales, authorised and regulated by the Financial Conduct Authority
> > under reference number 767876. Company registration number: 05631091.
> > Registered office: 55 Baker Street, London, England, W1U 7EU
>
--
Mark Corbin
Senior Software Engineer | lunarenergy.com | LinkedIn | Instagram
--
C2:Restricted unless otherwise stated.
--
Lunar Energy Limited is a company registered in England and Wales,
authorised and regulated by the Financial Conduct Authority under reference
number 767876. Company registration number: 05631091. Registered office: 55
Baker Street, London, England, W1U 7EU
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mm-blank-context-registers.log
Type: application/octet-stream
Size: 200389 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/modemmanager-devel/attachments/20250728/a7def03a/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mm-wrong-context-not-registering.log
Type: application/octet-stream
Size: 244857 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/modemmanager-devel/attachments/20250728/a7def03a/attachment-0003.obj>
More information about the ModemManager-devel
mailing list