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", It might be that for your device profile #1 is considered the EPS initial bearer. > > 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? 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