How do I roll back Legato from 17.6 to 16.10.3?

Hi,
a few days ago I downloaded the source code for Legato 17.6, compiled it and installed it on my WP7502.
All is fine. If I check the version from the prompt I get:
root@swi-mdm9x15:~# legato version
17.06.0_3f583b010088377e8d21254015057b3e

Now, I want to roll back to Legato 16.10.3, that is: FW package Release 14.
On The Source (https://source.sierrawireless.com/resources/legato/wpfirmwarerelease/) it is written:
"Images now include carrier PRI, module FW, MCU, Yocto, and Legato in a single file"
I downloaded the file WPx5xx_Release14_GENERIC_SPK.spk, which should contain Legato 16.10.3.
I used ‘swiflash’ to install it:

swiflash -m “WP750X” -i WPx5xx_Release14_GENERIC_SPK.spk
This seemed successful:
Detecting USB of the target
DONE
Communicating with the target
INFO: no pri file presents : (0xe803)
DONE
Switching to firmware download mode

Firmware Not Downloaded
break wait for download mode loop
Downloading the firmware
DONE
Firmware Download SUCCESS

but in the end the legato version is still:
root@swi-mdm9x15:~# legato version
17.06.0_3f583b010088377e8d21254015057b3e

Then I tried:
acal@acal-Latitude-E6430:~/WP_IMAGES$ fwupdate download WPx5xx_Release14_GENERIC_SPK.spk 192.168.2.2
Connecting to service …
Connecting to service …
Download started …
Download successful
acal@acal-Latitude-E6430:~/WP_IMAGES$ fwupdate query 192.168.2.2
Connecting to service …
Firmware Version: SWI9X15Y_07.12.09.00 r34123 CARMD-EV-FRMWR1 2017/04/26 23:34:19
Bootloader Version: SWI9X15Y_07.12.09.00 r34123 CARMD-EV-FRMWR1 2017/04/26 23:34:19
Linux Version: 3.14.29ltsi-961ca71325_ab5094eade #2 PREEMPT Thu Apr 27 02:17:10 PDT 2017

but again the Legato version is the same:
root@swi-mdm9x15:~# legato version
17.06.0_3f583b010088377e8d21254015057b3e

I even tried with Windows EXE file. Same result.

What do I do wrong?
BR
Luigi

Hi, Luigi,

Short Answer

After you’ve installed the new firmware image, delete /legato/mntLegatoVersion and reboot.

root@swi-mdm9x15:~# rm /legato/mntLegatoVersion
root@swi-mdm9x15:~# reboot

Or: After you’ve installed the new firmware image, stop Legato, delete everything under /mnt/flash/legato and reboot.

root@swi-mdm9x15:~# legato stop
Stopping Legato... 
DONE.
root@swi-mdm9x15:~# rm -rf /mnt/flash/legato/*
root@swi-mdm9x15:~# reboot

Long Answer

Your module (and other Qualcomm 9x15-based modules by Sierra Wireless) have 2 places where Legato systems are installed:

  • On the writeable flash file system mounted at /mnt/flash, under the legato directory (which is also bind-mounted at /legato). This can hold up to two Legato systems at the same time (one “good” and one “trying”), and is where the files are kept that indicate the statuses of the installed systems, among other things.
  • On a read-only flash file system mounted at /mnt/legato.

When you install a firmware image “containing Legato”, it replaces your /mnt/legato system.

Every time you boot, the init scripts will run the start program in /mnt/legato. This program will check to make sure that /mnt/flash/legato (aka /legato) is set up properly before launching /legato/systems/current/bin/supervisor.

If you have nothing in /mnt/flash/legato yet, then the start program will create a new /mnt/flash/legato/ directory and create a bunch of symlinks pointing to the files it needs on /mnt/legato. When this is all set up, it will copy /mnt/legato/system/version to /mnt/flash/legato/mntLegatoVersion (you’ll see why in a minute) before starting /mnt/flash/legato/systems/current/bin/supervisor.

At this point, if you were to reboot, the start program can see that /mnt/legato/system/version is the same as /mnt/flash/legato/mntLegatoVersion, so it knows that it doesn’t have to install that system into /mnt/flash/legato this time.

Later, when you use the update tool to install a new system, it will be installed into /mnt/flash/legato and Legato will shut down. The start program sees that Legato shut down cleanly due to an update, selects this new system to be the “current” system, and runs it.

Again, if you were to reboot now, the start program can see that /mnt/legato/system/version is the same as /mnt/flash/legato/mntLegatoVersion, so it knows that it doesn’t have to install that version of Legato into /mnt/flash/legato. This ensures that your new updated version of Legato doesn’t get replaced with whatever is in /mnt/legato on reboot.

If you were to now replace /mnt/legato with a different Legato system and reboot, the start program would see that /mnt/legato/system/version is different than /mnt/flash/legato/mntLegatoVersion and know that it has to install that new Legato system from /mnt/legato (finishing that by copying /mnt/legato/system/version to /mnt/flash/legato/mntLegatoVersion).

The problem you’re running into is that you’ve replaced /mnt/legato with exactly the same image you had in there before. So, when the start program runs, it sees that /mnt/legato/system/version is the same as /mnt/flash/legato/mntLegatoVersion, and it ignores /mnt/legato, keeping your “current” system at your 17.06-based version.

If you delete /mnt/flash/legato/mntLegatoVersion (or change it in any way, really) and reboot, the start program will see a mismatch between /mnt/legato/system/version and /mnt/flash/legato/mntLegatoVersion and will install the system from /mnt/legato (copying over configuration settings and other writeable files for apps that have not been removed between versions).

Of course, if you delete everything under /mnt/flash/legato, then this will be an even cleaner reset back to the old “factory” state, because any persistent app-specific settings will also be removed. But, don’t delete everything under /mnt/flash, because you could wipe out some other factory settings unrelated to Legato.

I hope this demystifies this a bit for you.

Cheers,

–Jen

2 Likes

Hi Jen,

thanks a lot for your answer.

Things are more complex than I initially thought.
It is good to know how Legato behaves when an update procedure is launched.
I will try out your solution.

BR
Luigi