Reseting mobile connection - Librem 5

That’s strange… I dunno, seems like the modem should be able to handle minutes of not doing anything. If you were to set it to 5 second pings at, say, 1400, when would you say the modem ends up suspending? Is it some minutes later?

Sorry to say: Telekom.

No, it is not only the provider. I didn’t really look into it, but there is an issue with a lot of information around concerning this problem: https://source.puri.sm/Librem5/linux/-/issues/303

When I set it to do a ping every 5 seconds, then it will suspend every time, and then resume when it is time for the ping. So it repeats the suspend+resume operation every 5 seconds then. And it almost always works, it is just rarely that the modem gets reset.

When I was testing that, with different ping scenarios to make it resume, I was hoping to at least be able to trigger the problem more often, to make it more reproducible. But it seems like no matter what I do, the probability per hour of the modem being reset is about the same, the problem seems to happen about once a day on average. Except if I do pings often enough so that it never suspends, then the problem does not happen.

It’s a difficult thing to debug because it happens so rarely. You have to wait many hours, sometimes several days, for the next time it happens.

If there was a way to provoke it to happen more frequently, that would make it much easier to debug.

1 Like

Ok so if Telekom is the problem what network is recommended? I’m leaning towards Aldi Talk myself.

I reworked my solution to reset the modem automatically when it vanishes and had this package build: https://source.puri.sm/ChriChri/bm818-tools/-/jobs/400857/artifacts/file/debian/output/bm818-watchmodem_0.5+librem5ci79321.a023ad4_arm64.deb

I’m actually testing it and so far it seems to do the same as my former manually installed version.

If you’d like to join the test… :wink:

4 Likes

Sure! Could you walk me through cleaning up the service I manually added?

From memory (do not have the stuff installed anymore :face_with_raised_eyebrow:):

  • Remove what you added to /etc/sudoers or /etc/sudoers.d/ by using visudo to uncomment/delete it
    • if you had the changes in its own file under /etc/sudoers.d/ it is save to delete it after uncommenting its content using visudo.
  • sytemctl --user stop watchmodem (or whatever you called the users service to watch the journal
  • delete the systemd service file in ~/.config/systemd/user/
  • systemctl --user daemon-reload to let systemd catch up with the missing file
  • remove the scripts recover-modem.sh and watch-modem.sh wherever you stored them - mine were in ~/bin/.

That should be all.

1 Like

done. Thanks! Got it installed. The installation should already start the service and enable it to auto start right?

I hope so. At least it happened in my L5.

If something isn’t working as before (with the manual install) any feedback would be very welcome!

1 Like

@chrichri A couple of improvement suggestions:

  1. ignore when modem hardware switch is toggled on or off - i think it should only watch for non user initiated disconnects,
  2. when toggling hardware switch it also tries to remount the sdcard when installed and unmounted, problem is when encrypted it now requires the user to enter the password when all the user wanted is enable modem, - can these actions be separated?
  1. maybe solved with 1.

Update:

Could you try https://source.puri.sm/ChriChri/bm818-tools/-/jobs/400904/artifacts/raw/debian/output/bm818-watchmodem_0.5+librem5ci79332.e96a15a_arm64.deb ?

2 Likes

see comments on source.puri.sm - so far no issues to report

Same here. No issues. Thanks for the efforts!

2 Likes

I wanted to test it again after having uninstalled it but after reinstall doesnt seem to work fyi:

sudo systemctl --user enable watchmodemFailed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=@.host --user to connect to bus of other user)

Mostly i had noticed a possible issue with the script where it would interfere possibly with the suspend-wakeup logic, the phone would end up not waking up properly after suspend (restart resolved the issue) bm818-tools uninstall or service stop also didnt cause wake from suspend to hang.

  • after installing the latest package the service should be enabled already and running
  • if you want to change it you need to sudo systemctl <command> without --user, because the service is now running as a --system service.

Thank you for the clarification. It appears not to be running as a service on my phone or maybe has a different name?

sudo systemctl --system enable watchmodem
[sudo] password for purism:
Failed to enable unit: Unit file watchmodem.service does not exist.

Correct. I aligned the name with the package name. Here’s how the package looks on my phone:

purism@pureos:~$ dpkg-query -W bm818-watchmodem 
bm818-watchmodem	0.5+librem5ci79332.e96a15a
purism@pureos:~$ dpkg -L bm818-watchmodem 
/.
/lib
/lib/systemd
/lib/systemd/system
/lib/systemd/system/bm818-watchmodem.service
/usr
/usr/bin
/usr/bin/bm818-watchmodem
/usr/sbin
/usr/sbin/bm818-recovermodem
/usr/share
/usr/share/doc
/usr/share/doc/bm818-watchmodem
/usr/share/doc/bm818-watchmodem/README
/usr/share/doc/bm818-watchmodem/changelog.gz
/usr/share/doc/bm818-watchmodem/copyright
/usr/share/sounds
/usr/share/sounds/bm818-watchmodem
/usr/share/sounds/bm818-watchmodem/alarm-clock-elapsed.wav
/usr/share/sounds/bm818-watchmodem/glass.wav
purism@pureos:~$ sudo systemctl status bm818-watchmodem.service 
[sudo] password for purism: 
● bm818-watchmodem.service - Watch Modem of Librem5
    Loaded: loaded (/lib/systemd/system/bm818-watchmodem.service; enabled; preset: enabled)
    Active: active (running) since Fri 2022-11-18 14:45:06 CET; 7h ago
  Main PID: 607 (bm818-watchmode)
     Tasks: 3 (limit: 3124)
    Memory: 50.8M
       CPU: 20.046s
    CGroup: /system.slice/bm818-watchmodem.service
            ├─607 /bin/bash /usr/bin/bm818-watchmodem
            ├─611 journalctl -f SYSLOG_IDENTIFIER=ModemManager
            └─612 /bin/bash /usr/bin/bm818-watchmodem

Nov 18 14:45:06 pureos systemd[1]: Started Watch Modem of Librem5.
Nov 18 15:57:31 pureos /usr/bin/bm818-watchmodem[2312]: found message indicating a problem with the modem in journal
Nov 18 21:19:29 pureos /usr/bin/bm818-watchmodem[3903]: found message indicating a problem with the modem in journal

Thank you for the explanation, now back to testing:

v 18 13:31:58 l5 systemd[1]: S>
lines 1-13/13 (END)…skipping…
● bm818-watchmodem.service - Wat>
Loaded: loaded (/lib/system>
Active: active (running) si>
Main PID: 15218 (bm818-watchm>
Tasks: 3 (limit: 3175)
Memory: 24.4M
CPU: 178ms
CGroup: /system.slice/bm818>
├─15218 /bin/bash />
├─15219 journalctl >
└─15220 /bin/bash />

Nov 18 13:31:58 l5 systemd[1]

1 Like

To follow up to this:

moved it here