Help..... Startlegato.sh dissappeards from /etc/init.d

Hi, I have my own cwe file based on 16.10.1.m3 (FX30s) that generally runs well. I have a custom startlegato.sh file that checks a for a 3rd script and runs it if present…

I have one country/network where modems seem to stop connecting (we’d sent a replacement modem which did exactly the same). Finally haven gotten a modem back to check, and digging through the files, I see that startlegato.sh has dissapeared from /etc/init.d and legato is not running.

What can cause this to happen in the field? It runs OK for a few weeks then suddenly stops uploading and since legato is no longer running I have no way of restarting it…

legato status shows the image is “good” but legato is not running…

Why would startlegato vanish… After starting legato manually, it seems to have put back startlegato.sh into the correct place, but its my custom one…

Any ideas?

UPDATE
The way I set up these devices, is to flash my own CWE file and then run a few scripts, one of which updates/copies in my startlegato.sh file into /etc/init.d… so I am wondering if there is a situation (like system reset of some sort), that would replace all the files and therefore overwrite that folder thereby removing my file? If that is the case, then how to I go about including startlegato.sh in the cwe images?

I should add that these devices are connected to AirVantage and various commands can be run from there… but I don’t believe the FW was replaced…

Thanks,
Karl

Only this file disappears?

is your own 3rd script files still there?

Hi @jyijyi, thanks for the reply.

Yes it is the only file I have spotted to have dissappeared.

My script file (the 3rd script I refer to) is in the home directory is created on the fly when I want to change some config (APN details in this case) remotely.

i.e. my app received my request to change the APN (via SMS). The app puts the script into the home directly and restart the module. On start up the startlegato.sh script in the init.d directory does its usual thing, but also checks if this script is there and runs it if it is… and then deletes it…

So that “3rd” script was not there… but that does not mean it was removed? Other files in the home directly remain…

Also

After starting legato manually, it seems to have put back startlegato.sh into the correct place, but its my custom one…

might be a misleading… as my application on start up checks startlegato.sh is in the init.d folder… but its a bit useless… as it only works if legato runs ;-/

Thanks,
Karl

could there be chance that power cut during you modify startlegato.sh ?

Hmmm… if it had happened once… I’d say possibly… but this has happened a few times to this modem, so unlikely I think… but you are suggestion something goes wrong in replacing the file? What would the timing of that need to be? i.e. would the faliure have to happen in the few micro seconds the file is written? Or is there a time delay after it is written where the failure/restart would need to happen?

Is it possible the FW “restored” itself because of some other failure and replaced the files? Although I’d then expect startlegato.sh to just be the default one?

if you are talking about rollback mechanism, i don’t quite think it happens.
As when you manually start the legato, your legato application are all there.

Ah yes good point… any ideas what else could cause this?

As your application will overwrite the startlegato.sh, I think this is the cause.
Do you need to overwrite this file in each boot up?

No it does not… this was bad design… For interest sake, what is the write cycle limit on the flash?

I will look at changing this… but I need to first re-create the problem repeatably to know I have fixed it…

I guess it is 100000

OK, I’ve made a little progress. I’ve managed to connect to the device in the field, via the customers PC and USB cable.

I see the following things.

  1. legato is not running as above
  2. the startlegato.sh file is not in /etc/init.d/ as above
  3. when I try can cp the file back in, I get the following error “input/output error linux” . I am able to cp the file in as startlegato1.sh… but when I try to rename it I get the same error.
  1. running dmesg I see the following towards the end of the log…aufs au_lkup_dentry:223:chmod[844]: I/O Error, both of real entry and whiteout found, startlegato.sh, err -5

I am not a linux expert… so not sure what this points at… any thoughts?

Maybe you need to use swiflash to recover the module

Hi @jyijyi thanks for the response.

I’ve tried reflashing the mcu…xxxxxx.cwe and my legato.cwe using fwupdate. The re-flashing worked… but it has not restored the startlegato.sh file in /etc/init.d

Is there a way to say format the file system and then re-flash it from Windows (the customer does not have a linux machine).

Factory Reset (using the pushbutton) did not manage to replace the file either.

Did you try swiflash tool to recover it?

Yes, but I think it needs to effectively rewrite all the linux and legato system files? i.e. re-install linux… or something. What is the most original state I can get the modem to?

I think swiflash has a recovery mode to back to default state

Thanks, but I think that is for Linux client. I only have a Windows machine available?

You can download the window version here

http://downloads.sierrawireless.com/tools/swiflash/swiflash.zip

Thanks, but the -reset option does not seem to replace system files? How do I get all system files to be replaced?

Seperately I was wondering if using something like fsck would help solve the problem… but I can’t get that to work as /etc is mounted. Can’t umount it, because it is use…

Any other thoughts?

can it recover the startlegato.sh file?