Frequently disappearing of the modem status indicators

Take a look in the bugtracker for the most recent comments.

Btw, how many modem “dropouts” do you have per day?

I faced it today already three times. To recover the modem I do in a script:

sudo rmmod xhci_plat_hcd xhci_hcd
echo 0 | sudo tee /sys/class/leds/wwan_en/brightness
sleep2
sudo modprobe xhci_plat_hcd
sleep 5
echo 1 | sudo tee /sys/class/leds/wwan_en/brightness
sleep 5
sudo systemctl restart ModemManager

I got this from the issue https://source.puri.sm/Librem5/linux-next/-/issues/303
Waht I do not understand, is this echo 0 | sudo tee filename Why the author does not just use sudo echo 0 > filename?
I saw this also, IIRC, in hints from @dos . What is the side effect used by this construct?

Most of what that script is doing is unnecessary and will take out the SD card reader as well. All you need is to powercycle the modem.

sudo echo 0 > filename is exactly the same as echo 0 > filename. All it does is to run echo with elevated permissions, which is useless.

1 Like

So, what is the preferred cli command to only power cycle the modem? In addition, I would also like to add the command for toggling mobile data, which for me is sudo nmcli conn down [my mobile data apn] followed by sudo nmcli conn up [my mobile data apn].

Is sudo unnecessary with this command too?

And yes, I know this is a workaround waiting for the updated ModemManager stuff, but right now a crucial one as cellular indicators disappear up to 10x or more per day for me on my daily phone.

Does your phone ever suspend?

Yes, regularly, but the indicators usually come back when resuming from suspend. The disappearing mostly happens when the phone is not in suspend.

1 Like

So disable suspend for now and wait for updates to arrive in about a week.

1 Like

Alright, I will try that. Unfortunately that will require me to carry a battery pack around to make it last a day, but it is certainly better than losing cellular connection all the time.

For the record, we need updated ModemManager (already in its migration period - https://master.pureos.net/migrations/excuse/d485cfda-2fc3-4cef-a748-3ddd459b3076 ) and once that migrates, I’m going to make a release of librem5-base, at which point all of the recent suspend reliability improvements will be finally deployed.

The problem happens right after resume, but it takes some time for ModemManager to realize that QMI link is broken, at which point it reprobes into AT-only mode. Data link over AT is broken - it attempts to connect, but doesn’t succeed and leaves the port is broken state. At this point, after another suspend/resume cycle ModemManager tries to reprobe the modem, but fails to do so because the port that has been used for PPP before is now broken. It also takes it some time to give up, at which point the indicators disappear as MM decides that the modem isn’t operational.

There are several issues that compound on each other here at play, but the whole chain won’t be triggered anymore once quick suspend/resume support is enabled, as that seems to reliably resume QMI communication on system resume.

5 Likes

Thanks for explaining this and I apologize for not having patience as my best discipline :upside_down_face:. As has been the case in the past, Purism has been improving the software of the Librem 5 immensely, and I am looking forward (patiently) to the improvements that will arrive shortly.

1 Like

I now understand it and it is not the same :slight_smile:

in sudo echo 0 > file the redirection of STDOUT is (already) done as user purism and ofc prohibited. That’s why it must be echo 0 | sudo tee file.

1 Like

This has been discussed previously in this forum (and indeed in other Linux-related fora, since this is in no way specific to the Librem 5).

The problem is that ‘>’ is implemented in the original (shell) process before sudo, running in a different process, gets a chance to do anything.

So if you require root access in order to open (read, write) a file then what you suggest is just not going to work. You can’t use the shell I/O redirection features in this scenario.

This morning I faced again that the icons of the modem have been disappeared, but was to lazy to do anything and went to breakfast. Later I saw them again, but with the exclamation mark in the datamobile icon. I just restarted the MM and all was fine:

May 05 05:31:46 pureos ModemManager[697]: <error> [modem9] port ttyUSB1 timed out 10 consecutive times, marking modem as invalid
...
May  5 08:39:03 pureos systemd[1]: Stopped Modem Manager.
May  5 08:39:03 pureos systemd[1]: ModemManager.service: Consumed 58.498s CPU time.
May  5 08:39:40 pureos systemd[1]: Starting Modem Manager...
...
May  5 08:39:53 pureos ModemManager[37987]: <info>  [modem0/bearer1] QMI IPv4 Settings:
May  5 08:39:53 pureos ModemManager[37987]: <info>  [modem0/bearer1]     address: 10.144.103.214/30
May  5 08:39:53 pureos ModemManager[37987]: <info>  [modem0/bearer1]     gateway: 10.144.103.213