codexctl icon indicating copy to clipboard operation
codexctl copied to clipboard

"codexctl restore" fails on RM2 3.20.0.92

Open daisyUniverse opened this issue 5 months ago • 7 comments

I recently picked up a used RM2 which arrived with the latest firmware, I wanted to explore some of the cool projects people have made, so I wanted to downgrade in order to explore, to this end I followed the instructions depicted in #95

Downloading the target firmware...

$ ./codexctl download --out . 3.11.2.5 --hardware rm2

Extracting the firmware...

$ ./codexctl extract --out 3.11.2.5.img 3.11.2.5_reMarkable2-qLFGoqPtPL.signed
/private/var/folders/0b/xbwnxg6x0ml13nwwl2qxbn940000gn/T/onefile_80808_1752867910_64129/codexctl/analysis.py:26: RuntimeWarning: Public key missing

I noticed the warning, but it DID create a .img of substance, so I risked it and moved forward...

% ssh [email protected]
% mount
/dev/mmcblk2p3 on / type ext4 (rw,relatime)
% dd if=/home/root/3.11.2.5.img of=/dev/mmcblk2p2
552960+0 records in
552960+0 records out

After this I exited back to my local computer...

$ ./codexctl restore
Would you like to use a password to connect? (Y/n): Y
Enter RM SSH password: [[ REDACTED ]]
Success: Connected to device
Device restored to previous version [True]
Traceback (most recent call last):
  File "/private/var/folders/0b/xbwnxg6x0ml13nwwl2qxbn940000gn/T/onefile_80848_1752868372_230637/main.py", line 12, in <module>
  File "/private/var/folders/0b/xbwnxg6x0ml13nwwl2qxbn940000gn/T/onefile_80848_1752868372_230637/codexctl/__init__.py", line 480, in main
  File "/private/var/folders/0b/xbwnxg6x0ml13nwwl2qxbn940000gn/T/onefile_80848_1752868372_230637/codexctl/__init__.py", line 221, in call_func
AttributeError: 'DeviceManager' object has no attribute 'reboot_device'

I had a bad feeling, but hoped that the mechanism for restarting had maybe become depricated, so I noted the IP and PW and rebooted it myself, it thankfully DID come back on, but the firmware was unchanged

% ./codexctl status    
Would you like to use a password to connect? (Y/n): Y
Enter RM SSH password: [[ REDACTED ]]
Success: Connected to device

Current version: 3.20.0.92
Old update engine: True
Beta active: Release
Version id: 20250613122401

I also tried to manually use switch on the remarkable itself, but as I've read it's simply not on the system in this version... So, is there a way to downgrade such a new version? or has the upgrade mechanism changed so much that it's no longer an option? Or does restoring from the fallback partition now explicitly require the use of the pogo pin / jumper method as detailed in https://github.com/ddvk/remarkable2-recovery ?

daisyUniverse avatar Jul 18 '25 20:07 daisyUniverse

This appears to be a duplicate issue of #123 are you sure you are running the latest build?

Eeems avatar Jul 18 '25 22:07 Eeems

Interesting, I should mention that I'm running this on an M1 Mac, which I did download the latest build from releases, but when you mentioned that I had a suspicion that might have been an older build.. I tried installing codexctl via pip instead, and the first error I got about a missing public key went away, although after attempting to use this to run restore, it gave me a slightly different error ( both with sudo and without )

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/opt/homebrew/lib/python3.13/site-packages/codexctl/__main__.py", line 4, in <module>
    main()
    ~~~~^^
  File "/opt/homebrew/lib/python3.13/site-packages/codexctl/__init__.py", line 479, in main
    man.call_func(args.command, vars(args))
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.13/site-packages/codexctl/__init__.py", line 221, in call_func
    remarkable.reboot_device()
    ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'DeviceManager' object has no attribute 'reboot_device'

This is not really specifically relevant to this issue, but I also tried running a backup (although, I have some doubts that backups would even work on this version even under normal conditions)

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/opt/homebrew/lib/python3.13/site-packages/codexctl/__main__.py", line 4, in <module>
    main()
    ~~~~^^
  File "/opt/homebrew/lib/python3.13/site-packages/codexctl/__init__.py", line 479, in main
    man.call_func(args.command, vars(args))
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.13/site-packages/codexctl/__init__.py", line 159, in call_func
    rmWeb.sync(
    ~~~~~~~~~~^
        localFolder=args["local"],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        overwrite=not args["no_overwrite"],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/opt/homebrew/lib/python3.13/site-packages/codexctl/sync.py", line 206, in sync
    documents = self.__get_docs(remoteFolder, recursive)
  File "/opt/homebrew/lib/python3.13/site-packages/codexctl/sync.py", line 104, in __get_docs
    return self.__get_documents_recursive(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        folderId=folderId, currentLocation=folderName
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/opt/homebrew/lib/python3.13/site-packages/codexctl/sync.py", line 48, in __get_documents_recursive
    for item in data:
                ^^^^
TypeError: 'NoneType' object is not iterable

I think my next step will be to try and run this from my linux laptop to see if this is a system issue... Will edit again once I've done so

daisyUniverse avatar Jul 18 '25 23:07 daisyUniverse

it's not clear to me why it's failing to find the method, as it was added when resolving #123

The latest build does seem to be out of date though as the build pipeline has been failing to produce builds for a little while and will need to be resolved.

Have you tried running from source to see if for some reason the latest build is missing the fix, even though the github action succeeded?

Eeems avatar Jul 18 '25 23:07 Eeems

I just tested both the compiled version on Linux and i got the same results, but! Running it from source did actually seem to restart the device properly! (though, the version stayed the same after the reboot. Baby steps)

Update, running it as sudo made it actually finish!

daisyUniverse avatar Jul 19 '25 02:07 daisyUniverse

Interesting. Well I'll poke at the build process and see if I can get it fixed.

Eeems avatar Jul 19 '25 02:07 Eeems

I've fixed the build process, there will be a new release in an hour or so. Please test it when you can.

Eeems avatar Jul 19 '25 16:07 Eeems

@daisyUniverse have you had a chance to test yet?

Eeems avatar Sep 14 '25 05:09 Eeems