Lpac

lpac is a command line utility that can be used to manage eSIMs on a compatible device through a smart card reader. This page will summarize the main steps needed to use it with a JMP eSIM Adapter.

Getting Started

You’ll need a smart card or SIM reader that is detected by your computer. Windows may require installation of a driver. While most such readers should work, JMP sells one which works well.

Linux

You can use pcsc_scan on Linux to view the reader and see if it registers the card when inserted. Some desktop Linux distributions such as Fedora Silverblue come with pcscd installed, otherwise you’ll need to install that such as with apt on Debian and derivatives:

sudo apt install pcscd

Unless building with source, it’s probably quickest to download and extract lpac-linux-x86_64.zip from Releases · estkme-group/lpac · GitHub . Assuming you extracted the zip to ~/Downloads/lpac, open a terminal and run:

cd ~/Downloads/lpac

Managing Profiles

You’ll want to make sure you can see the eSIM adapter along with its test profile (do not delete the default profile):

./lpac profile list

Downloading an eSIM

If you received an activation string when purchasing an eSIM, extract the SM-DP+ address and activation code from it. If you received only a QR code, first scan it with a QR scanner to get the string. For example, LPA:1$example.tld$XX-YYYYYY-ZZZZZZZ:

./lpac profile download -s example.tld -m "XX-YYYYYY-ZZZZZZZ"

Enabling an eSIM profile

Only one profile can be enabled at a time. You can obtain the ICCID from the profile listcommand.

./lpac profile enable [ICCID]

Nicknaming an eSIM profile

./lpac profile nickname [ICCID] "My new eSIM"

Troubleshooting

If you get an error involving * SCardEstablishContext() * APDU **driver** init failed

Try installing a possible missing dependency ccid. Also enable the systemd pcscd.socket with a command like

systemctl enable --now pcscd.socket

Downloading an eSIM profile through a USB Modem without a second network device

Ironically, activating an eSIM requires an internet connection. Usually a USB modem is used in cases where another internet access isn’t available. So if you need to get a new eSIM, how can you download it? Let’s see how to download an eSIM profile on a USB modem without another network device. This requires having a working eSIM profile, but can help to download a new eSIM before an old eSIM expires. (A JMP eSIM is a great choice for a fallback eSIM because it doesn’t expire.)

Overview

  1. Stop ModemManager from accessing the USB modem

  2. Use qmicli to establish a temporary network connection via the USB modem

  3. Configure the temporary network connection

  4. Download the eSIM profile

  5. Restart ModemManager

Tip Instead of stopping ModemManager, an alternative is to add --device-open-proxy to all the qmicli commands below.

Instructions

  1. On a system with a functioning eSIM, stop the ModemManager from accessing the USB modem:

    •    sudo systemctl stop ModemManager
      

      The system will loose internet connectivity.

  2. Find the USB modem’s interface name:

    •    sudo qmicli --device=/dev/cdc-wdm0 --device-open-proxy --get-wwan-iface
      

      Keep this interface name handy and use it in place of wwp0 below.

  3. The following steps are only necessary if the file /sys/class/net/wwp0s20u1u4u2i4/qmi/raw_ipdoesn’t already contain “Y”

    •    sudo ip link set dev wwp0 down
         sudo sh -c "echo Y > /sys/class/net/wwp0/qmi/raw_ip"
      
  4. Bring up the interface

    •    sudo ip link set dev wwp0 up
      
  5. Next we’ll use qmicli to tell the modem to start a network connection using the example APN “myoldapn”. Substitute it with the APN for your existing eSIM.

    •    sudo qmicli --device=/dev/cdc-wdm0 --device-open-proxy --wds-start-network="ip-type=4,apn=myoldapn" --client-no-release-cid
      
  6. Check the modem’s network configuration

    •    sudo qmicli --device=/dev/cdc-wdm0 --device-open-proxy --wds-get-current-settings
      

      Record the IP address, gateway and DNS address

  7. Manually set the IP address of the interface. Substitute the IP address from above for 777.777.777.777

    •    sudo ip address add 777.777.777.777 dev wwp0
      
  8. Add a default route so network traffic is routed to the USB modem’s network interface

    •    sudo ip route add default dev wwp0
      
  9. Test the network by pinging the gateway’s IP address. Substitute the gateway address from above for 888.888.888.888

    •    ping -I wwp0 888.888.888.888
      
  10. Check whether DNS is working.

    •    curl wiki.soprani.ca
      

      This should output “301 Moved Permanently” or some HTML.

  11. If DNS isn’t working, first test the DNS address found above. Substitute the DNS address from above (i.e. --wds-current-settings) for 999.999.999.999

    •    dig @999.999.999.999 wiki.soprani.ca
      

      If this works but curl wiki.soprani.ca gives a name server error, we’ll need to configure DNS.

  12. Different linux distributions use different mechanisms for DNS (e.g. resolv.conf resolvectl and systemd-resolved). If your system uses systemd-resolved,

    1. edit the file /etc/systemd/resolved.conf

    2. find the line starting with DNS= or #DNS=

    3. remove the # and add the DNS address from above, for example

      •     DNS=999.999.999.999
        
    4. restart systemd-resolved

      •     sudo systemctl restart systemd-resolved
        
    5. verify DNS works

      •     curl wiki.soprani.ca
        
  13. Test that lpac can still access the modem

    •    output/lpac profile list
      
  14. Now return to the instructions for using lpac with a USB modem to download an eSIM profile using this network you just set up. After downloading the eSIM profile, restart ModemManager with

    •    sudo systemctl start ModemManager
      

See also Using your USB 4G LTE modem from the terminal (TPE-USB4G2US) | ThinkPenguin.com