sipeed / NanoKVM

NanoKVM: Affordable, Multifunctional, Nano RISC-V IP-KVM
GNU General Public License v3.0
2.81k stars 35 forks source link

Can't Update from 2.0.4 to 2.0.6 #42

Open teedoff087 opened 1 month ago

teedoff087 commented 1 month ago

I receive the message that an update is available:

image

I click Confirm to update and it acts like it's updating:

image

It operates for about 10-15 seconds then boots me back to the login screen, but checking the version and it's still 2.0.4.

Is there a way to update this through SSH?

SimHat commented 1 month ago

Same issue here.

cascaabreu commented 1 month ago

Was on 2.0.6, got the notification for 2.0.7... After 15/30 seconds it was back online at the login screen.

Now it is back in version 2.0.4, notifying 2.0.7 is available but still does not work. Tailscale lost its connection when it rolled back to 2.0.4, had to login again into my tailnet.

ajorg commented 1 month ago

Same problem here (2.0.4 to 2.0.6).

What's happening here is related to #23.

When the app looks for an update, it's getting https://cdn.sipeed.com/nanokvm/latest which is just a text file that's supposed to say 2.0.7 but says 2.0.6 still because Sipeed hasn't been able to completely invalidate the cache on the CDN.

When the app tries to update, what it's really doing is downloading https://cdn.sipeed.com/nanokvm/latest.zip which actually contains the 2.0.4 version. So the update succeeds, but has no useful effect (unless you're on a version earlier than 2.0.4, and looks like it's failing.

If you're lucky enough to get a notification for 2.0.7 that means your CDN endpoint has at least that nanokvm/latest object updated, but since your CDN endpoint still has 2.0.4 you can actually get downgraded.

I haven't quite figured out how to update manually. It looks just slightly more complicated that unzipping that .zip file into /tmp.

An improvement that would be wise would be to store the app .zip files at nanokvm/app-<version>.zip (in addition to latest.zip to support older clients) so that at the very least you'd always get the version you were trying to get, and you'd be able to downgrade if you had to I guess.

Another improvement might be to add a ?nocache=<random-string> to the nanokvm/latest URL, to bypass the CDN cache, at least optionally. It's possible it's intentional that the CDN rolls out the update incrementally, so you might not want to always bypass it.

wj-xiao commented 1 month ago

Could you try checking for updates again? I just refreshed the file cache.

@ajorg Thanks for your suggestion.

An improvement that would be wise would be to store the app .zip files at nanokvm/app-.zip (in addition to latest.zip to support older clients) so that at the very least you'd always get the version you were trying to get, and you'd be able to downgrade if you had to I guess.

The latest version includes incompatible changes. Updating from the new version to an older one might cause issues.

Another improvement might be to add a ?nocache= to the nanokvm/latest URL, to bypass the CDN cache, at least optionally. It's possible it's intentional that the CDN rolls out the update incrementally, so you might not want to always bypass it.

In the latest version (2.0.7), a URL parameter has been added to bypass the cache. But you'll need to update to this version first. :(

I recommend executing the update through the web. But if you can't access the latest version, I'll provide an update script.

wj-xiao commented 1 month ago

update-nanokvm.py.zip

Use this script to manually update the NanoKVM.

  1. Download the file and unzip it
  2. Execute python update-nanokvm.py
  3. Wait for the update to complete

Note: NanoKVM will automatically reboot after the update, please wait.

cedartinkerer commented 1 month ago

I just tried again and it reports 2.0.7 is ready but it still is staying at 2.0.4

Running the script it says it updated to 2.0.7 though the toggles I saw in 2.0.6 are gone and it still has check marks next to Virtual Network and USB. So not sure if that is indicative to anything.

UPDATE: Log out and log back in fixed the toggle issues / front end still looking like 2.0.4. Odd.

wj-xiao commented 1 month ago

Maybe the browser has cache. You can try to force refresh the web page.

Or disable browser cache:

  1. Open the browser Developer Tools(F12);
  2. Go to the Network tab;
  3. Check Disable cache option;
  4. Refresh the page.
CrazyCoder commented 1 month ago

Updating via the update-nanokvm.py worked for me.

teedoff087 commented 1 month ago

Updating via the update-nanokvm.py worked for me.

Same here.

geerlingguy commented 1 month ago

Ditto with the built-in autoupdate, it showed I could go from 2.0.4 to 2.0.7, but after going through the update, it was still on 2.0.4. Trying update-nanokvm.py next.

Edit: update-nanokvm.py worked, I'm on 2.0.7 now. Thanks! Hopefully the CDN / caching issues can be resolved with newer firmware better busting through the caches.

cedartinkerer commented 1 month ago

I think the logout / login back in must have refreshed the screen as it took 2x then the UI showed correctly for 2.0.7.

So the script worked great just took more cycles for the UI to show the features of 2.0.7

ajorg commented 1 month ago

The script did seem to work for me too. Thanks!

junglemusic commented 1 month ago

I had the same problem. When i got told me that it wanted to update and never did until a day or two later. It got downgraded today. Wanted to update it again and it didn't work. Managed to nuke the webserver by pulling the plug when i tried it again on the third or fourth try. Fortunatley i was able to ssh into the shell and updated via the script above.

TheSp1der commented 1 month ago

It should be noted that you can't use the web-shell interface to run this script. One of the first things the script does is shutdown the web-interface, killing your session. SSH directly to the NanoKVM to run the script. I had to force a reboot of the NanoKVM after the upgrade process was completed, but I'm now at the latest version. Thanks @wj-xiao for providing the upgrade script!

bfayers commented 3 weeks ago

update-nanokvm.py.zip

Use this script to manually update the NanoKVM.

  1. Download the file and unzip it
  2. Execute python update-nanokvm.py
  3. Wait for the update to complete

Note: NanoKVM will automatically reboot after the update, please wait.

This script does not work on my NanoKVM Lite. Exploring an SD Card image taken from a full NanoKVM had a different value in /device_key and putting that ID on my device temporarily allowed the update to work fine.

With my key the endpoint for download_lib responds with:

{
    "code": -2,
    "msg": "encrypt failed"
}

It seems like not all device_keys are on the sipeed server side...

wj-xiao commented 2 weeks ago

It seems like not all device_keys are on the sipeed server side...

Please refer to #49 .

selten commented 2 weeks ago

I'm currently facing while running the update-nanokvm.py

download lib...
update failed
HTTPSConnectionPool(host='maixvision.sipeed.com', port=443): Max retries exceeded with url: /api/v1/nanokvm/encryption?uid=[device-id] (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x3ff58d9a90>, 'Connection to maixvision.sipeed.com timed out. (connect timeout=None)'))

Was my own mistake, it was caused by my network settings.

colemickens commented 2 weeks ago

I cannot wait for the kernel sources to get released so a proper distribution, with proper update mechanisms can be ported.

MetalSamurai99 commented 1 week ago

Still a problem with 4 brand new NanoKVMs I just received.

Check for update. 2.0.7 -> 2.0.9 An update is available. Are you sure to update?

Confirm

Update started. Please wait...

Update failed. Please retry.

...And repeat endlessly.

The Python update script successfully updates to 2.0.9.