adding the SIM card pin automatically after every reboot

Asked by Jack

Hello,

I am trying to use a Sim card with PIN enabled in my Ubuntu 20.04 system via Network Manager.

I am using the following command to check the status of my 4g module as well as the state of my inserted SIM card:

edge@edge:~$ sudo mmcli -i 0 --pin=8809
successfully sent PIN code to the SIM

edge@edge:~$ sudo nmcli c add con-name ltemodem type gsm ifname cdc-wdm0 apn e-ideas
Connection 'ltemodem' (5026f878-65bd-4781-ab08-5ef578c3910b) successfully added.

edge@edge:~$ sudo nmcli c up ltemodem
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)

edge@edge:~$ nmcli connection show
NAME UUID TYPE DEVICE
ltemodem 5026f878-65bd-4781-ab08-5ef578c3910b gsm cdc-wdm0

IT seems to be all good here and by this point i would have setup the mobile connection:
edge@edge:~$ sudo mmcli -m 0
  -----------------------------------
  General | path: /org/freedesktop/ModemManager1/Modem/0
           | device id: 2a28bc9abeec0be1ed6b18f524613ffbdbb8282a
  -----------------------------------
  Hardware | manufacturer: QUALCOMM INCORPORATED
           | model: QUECTEL Mobile Broadband Module
           | firmware revision: EG25GGBR07A08M2G
           | carrier config: ROW_Generic_3GPP
           | carrier config revision: 05010820
           | h/w revision: 10000
           | supported: gsm-umts, lte
           | current: gsm-umts, lte
           | equipment id: 860195052080444
  -----------------------------------
  System | device: /sys/devices/pci0000:00/0000:00:15.0/usb1/1-5
           | drivers: option, qmi_wwan
           | plugin: quectel
           | primary port: cdc-wdm0
           | ports: cdc-wdm0 (qmi), ttyUSB0 (qcdm), ttyUSB1 (gps),
           | ttyUSB2 (at), ttyUSB3 (at), wwan0 (net)
  -----------------------------------
  Status | lock: sim-pin2
           | unlock retries: sim-pin (3), sim-puk (10), sim-pin2 (3), sim-puk2 (10)
           | state: connected
           | power state: on
           | access tech: lte
           | signal quality: 91% (cached)

I can ping www.google.com and do anything as connected online now.

However, when I reboot my system then the Mobile network appears to be disconnected from the Internet. Upon checking, it seems that the SIM is locked again:

edge@edge:~$ sudo mmcli -m 0
  -----------------------------------
  General | path: /org/freedesktop/ModemManager1/Modem/0
           | device id: 2a28bc9abeec0be1ed6b18f524613ffbdbb8282a
  -----------------------------------
  Hardware | manufacturer: QUALCOMM INCORPORATED
           | model: QUECTEL Mobile Broadband Module
           | firmware revision: EG25GGBR07A08M2G
           | carrier config: ROW_Generic_3GPP
           | carrier config revision: 05010820
           | h/w revision: 10000
           | supported: gsm-umts, lte
           | current: gsm-umts, lte
           | equipment id: 860195052080444
  -----------------------------------
  System | device: /sys/devices/pci0000:00/0000:00:15.0/usb1/1-5
           | drivers: option, qmi_wwan
           | plugin: quectel
           | primary port: cdc-wdm0
           | ports: cdc-wdm0 (qmi), ttyUSB0 (qcdm), ttyUSB1 (gps),
           | ttyUSB2 (at), ttyUSB3 (at), wwan0 (net)
  -----------------------------------
  Status | lock: sim-pin
           | unlock retries: sim-pin (3), sim-puk (10), sim-pin2 (3), sim-puk2 (10)
           | state: locked
           | power state: on
           | signal quality: 0% (cached)

It seems that i need to delete the connection, then add back the connection using the SIM Pin again, then bring up the connection one more time to make it work.

Is there anyway to just key in 1 time the SIM Pin and the system remembers it so that i do not need to repeat the whole procerss everytime the system is being rebooted?

I tried following the steps in this link: https://ubuntu.com/core/docs/networkmanager/configure-cellular-connections but it doesnt work as the PIN was not recognized as part of the command in the final section of the guide:

edge@edge:~$ sudo nmcli c add type gsm ifname cdc-wdm0 con-name ltemodem apn e-ideas pin 8809
Error: invalid <setting>.<property> 'pin'.

Appreciate if anyone can guide me a little on this. Thanks!

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

Don't confuse the mmcli and nmcli commands. As far as I know only the mmcli command accepts a pin option, but not the nmcli command.

Have you considered disabling the PIN (although insecure)?

Can you help with this problem?

Provide an answer of your own, or ask Jack for more information if necessary.

To post a message you must log in.