Update mechanism details

I’m setting up a private repository with a few specific RouterOS versions, to be used by our routers (half a dozen RB2011’s, about 40 hAP lites, and a few hAP ac’s.)

I’ve been reverse-engineering the mechanism behind the “/system package update” mechanism, and I’ve reached the point where my test router is downloading and installing the packages from my internal web server. However, even after rebooting into the new version, “/system package update check-for-updates” says that a new version is available, even though I haven’t changed anything on the web serer.

[admin@MikroTik] /system package update> print
            channel: current
  installed-version: 6.34.2
     latest-version: 6.34.2
             status: New version is available

The only thing I can figure is that the timestamp in the “/LATEST.6” file is being compared to a value embedded within one of the packages, and I don’t have the correct timestamp value within the “/LATEST.6” file.

Is there a way to find out what the correct value should be for each release? Obviously I have the correct value for 6.38, but that timestamp doesn’t seem to match up with anything obvious. Is there maybe a list of the correct values out there?

I figured it out … the four bytes at offset 0x0022 in each “system-*.npk” file are the value, in little-endian order.

For example, for version 6.38:

  • The four bytes in the file are “24 46 66 58” (for both “mipsbe” and “smips” architectures, I’m assuming this will be true for the other architectures as well)
  • 0x58664624 hex is 1483097636 decimal
  • Right now, http://upgrade.mikrotik.com/routeros/LATEST.6 contains “6.38 1483097636”.

After updating the “/routeros/LATEST.6” file on my internal web server…

[admin@MikroTik] /system package update> check-for-updates
          channel: current
  current-version: 6.34.2
   latest-version: 6.34.2
           status: System is already up to date

Nice infos, good work!

I just finished writing a more detailed write-up on how to build a private package update repository. It includes a shell one-liner to extract the necessary four bytes and format them as a decimal number.

https://www.jms1.net/mikrotik/Mikrotik%20Update%20Server.md