How to upgrade routerOS from command line (ssh) and local routeros-7.18.2-arm64.npk file?

Hello,

Today I have got two new CCR2116-12G-4S+ routers however they have been delivered with an older routerOS-7.16.1.
The current recommended one is routerOS-7.18.2

Until now I did not find any description how to upgrade the firmware locally from the command line within an offline environment.
Is it possible at all? (to copy the firmware .npk file to the router and to upgrade the firmware there from the command line)

Thank you in advance for your hints.

Best regards
Mark

Copy the NPK to the root of the router’s file storage and then reboot:


scp routeros-7.18.2-arm64.npk 192.168.88.1:
ssh 192.168.88.1 ':execute {/system reboot}'

Your client machine will need to be on the same 192.168.88.0/24 network set up in the CCR2116’s default configuration.

The slightly-clever reboot command syntax is needed only if you have to do this via a script, reliably, without an interactive terminal. It might suffice to say “ssh 192.168.88.1 /system/reboot” instead, but depending on the versions installed, it might ask if you’re really, really sure and not do the reboot unless you actively tell it “yes, really.” That said, the simpler command did reboot a 7.19rc2 box here without a prompt.

I suppose they are now detecting that the SSH session is non-interactive and skipping the prompt, but what matters in your situation is whether the factory version also does that. If you have to upgrade first, the new behavior is of no help to you.

Also: when uploading upgrade packages (NPKs) manually, it’s your responsibility to upload all the required packages. For many devices, uploading single file (named e.g. routeros-7.18.2-arm.npk) is enough, some require additional packages (such as wifi driver pack). Those package files are distributed in all_packages ZIP archive (named e.g. all_packages-arm-7.18.2.zip). You have to extract necessary package files (NPKs) and upload those to device as well … before executing reboot command. If not all package files, required to upgrade already installed ones, are present on the router when rebooted, upgrade will fail (and appropriate log entries will be recorded). Device will be rebooted never the less, reboot itself doesn’t inicate sucess of upgrade.

You can get the list of currently installed packages by executing /system/package/print

Thanks a lot tangent and mkx.

Your hints are really great help for my first steps with MikroTik’s routers.
I have a linux machine connected to 1Gbit eth13 of the router using an IP within 192.168.88. network.
Originally I was expecting first do copy the .npk package to the router itself and upgrade routerOS from the console of the router itself (ssh login session) but did not know how.
Probably it will be a good idea to save current packages from the router (currently there is only default configuration).

I will check also all_packages-arm64-7.18.2.zip and compare the list of packages with the output of “/system/package/print”, thank you.

Best regards

Having an offline fallback option in case everything goes to pieces is one of the purposes behind my Linux netinstall setup. A small up-front setup cost buys a whole lot of chill in the face of adversity.

Ditto my backup scheme.

Thank you very much tangent. At the moment I can not really follow all details of your scripts. I will have to check them later.

I run all steps and both routers boot with the new routeros-7.18.2.
I wonder however a bit why the output of "system/routerboard/print " shows “current-firmware: 7.16.1” and not 7.18.2 (as stated further below # —)
Do I need to run some other commands to set the current-firmware to 7.18.2?

Do I need packages included in all_packages-arm64-7.18.2.zip? The default 7.16.1 did not have such ones.

Best regards

— After reboot

MikroTik RouterOS 7.18.2 (c) 1999-2025 https://www.mikrotik.com/


Press F1 for help

[admin@MikroTik] > system/routerboard/print
routerboard: yes
model: CCR2116-12G-4S+
revision: r2
serial-number: HHF0AFV2…
firmware-type: al64v3
factory-firmware: 7.16.1
current-firmware: 7.16.1
upgrade-firmware: 7.18.2
[admin@MikroTik] > system/package/
local-update apply-changes downgrade export print unschedule
update disable enable find uninstall

[admin@MikroTik] > system/package/print
Columns: NAME, VERSION, BUILD-TIME, SIZE

NAME VERSION BUILD-TIME SIZE

0 routeros 7.18.2 2025-03-11 11:59:04 12.3MiB
[admin@MikroTik] >

Yes:


/system/routerboard/upgrade

…and then reboot.

Alternately:


/system routerboard settings set auto-upgrade=yes

…and then reboot twice after each upgrade, once to upgrade RouterOS proper and any optional NPKs you have installed, then the second time to upgrade the firmware.

All of this is covered in the docs.

Again thank you very much tangent and mkx.

I have prepared a short summary. I guess that I do not need optional packages for CCR2116-12G-4S+ boxes (as I am not going to use them in a cloud environment, they do not have wireless etc.)

Best regards

Summary routerOS upgrade on the command line level for CCR2116-12G-4S+

scp routeros-7.18.2-arm64.npk admin@192.168.88.1:
ssh admin@192.168.88.1 ':execute {/system reboot}'



devops@dlx12x:~# slogin admin@192.168.88.1
[admin@MikroTik] > system/reboot



devops@dlx12x:~# slogin admin@192.168.88.1
[admin@MikroTik] > system/routerboard/upgrade    
[admin@MikroTik] > system/reboot



[admin@MikroTik] > system/routerboard/print   
       routerboard: yes            
             model: CCR2116-12G-4S+
          revision: r2             
     serial-number: HHF0AFV2...    
     firmware-type: al64v3         
  factory-firmware: 7.16.1         
  current-firmware: 7.18.2         
  upgrade-firmware: 7.18.2



[admin@MikroTik] > system/package/print 
Columns: NAME, VERSION, BUILD-TIME, SIZE
# NAME      VERSION  BUILD-TIME           SIZE   
0 routeros  7.18.2   2025-03-11 11:59:04  12.3MiB

* Remarks: Optional packages from all_packages-arm64-7.18.2.zip have not been installed

calea-7.18.2-arm64.npk
container-7.18.2-arm64.npk
dude-7.18.2-arm64.npk
extra-nic-7.18.2-arm64.npk
gps-7.18.2-arm64.npk
iot-7.18.2-arm64.npk
iot-bt-extra-7.18.2-arm64.npk
lora-7.18.2-arm64.npk
rose-storage-7.18.2-arm64.npk
tr069-client-7.18.2-arm64.npk
ups-7.18.2-arm64.npk
user-manager-7.18.2-arm64.npk
wifi-qcom-7.18.2-arm64.npk
wireless-7.18.2-arm64.npk
zerotier-7.18.2-arm64.npk

Sorry, I have to ask, as I don’t understand. :confused:
If you have “normal” Winbox/terminal access, why did you choose to go for ssh RoS update? :question:

For security reasons I do not use the Windows crap and just prefer Debian Linux and OpenBSD instead.

Best regards

There’s also a native Linux version of Winbox :smiley:

Yep :slight_smile: , but still, since it may be derived by source code that may have been stored in the same folder directory where the Windows files were, it may have been contaminated. :laughing: