Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to rollback from 3.11? #71

Closed
Trisk3lion opened this issue May 7, 2024 · 29 comments
Closed

Any way to rollback from 3.11? #71

Trisk3lion opened this issue May 7, 2024 · 29 comments

Comments

@Trisk3lion
Copy link

Hello!

Sorry for noob-ish question but I wonder if there are any way, today, to rollback my Remarkable 3.11.2 to something like 3.3?
As I understand from the Readme codexctl can't so it automatically but are there any any other way? Or am I stuck there for the moment?

Realised a little to late that I would very much like to have Toltec and other nice stuff

@Eeems
Copy link
Collaborator

Eeems commented May 7, 2024

From https://github.com/Jayy001/codexctl?tab=readme-ov-file#please-read-before-using

You can still use the other functions like downloading the image files and then manually extracting it, using dd to write to the other partition and then using the switch command.

@besselfunct
Copy link
Contributor

I would also like to do this. I think I understand what you're indicating should be done, but given the "nuclear" nature of the dd command, I'm hesitant to just YOLO it. Can you provide anymore detail on the procedure?

I'm assuming that you have to create a mount point for the new OS version, then dd if old_remarkable_version.signed of /mnt/old and then switch /mnt/old?

@Eeems
Copy link
Collaborator

Eeems commented May 7, 2024

#95 (comment) has instructions that go into further detail. Please refer to it instead


  1. Download the upgrade file with codexctl.
  2. Extract the raw ext4 image from the upgrade file (for now use the python tool that comes with remarkable-update to do so, extract is currently broken in codexctl)
  3. Transfer the image to the device.
  4. Determine which partition is the fallback partition.
  5. dd if=path/to/image.img of=/dev/mmc... where mmc... is the fallback partition
  6. Use codexctl restore to make the fallback partition active.
  7. Reboot device.

@Captain-Barge
Copy link

I'm in a similar boat. Got a new reMarkable 2 today mainly for 3rd party software and was super disappointed to learn that 3.11 stops me in my tracks.

A few questions:

  • Are the 3.11 issues something that might get sorted out in ~weeks? If so it might be best to wait (right?)
  • Would this codexctl switch option need to be 'unwound' at a future date to free the fallback partition back up? Is there any downside to doing this?
  • Finally, when I run fdisk -l on the reMarkable 2 I get the following output. How do I tell which is the fallback partition?

Disk /dev/mmcblk2: 7456 MB, 7818182656 bytes, 15269888 sectors
238592 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/mmcblk2p1 32,0,1 671,3,16 2048 43007 40960 20.0M 83 Linux
/dev/mmcblk2p2 672,0,1 95,3,16 43008 595967 552960 270M 83 Linux
/dev/mmcblk2p3 96,0,1 543,3,16 595968 1148927 552960 270M 83 Linux
/dev/mmcblk2p4 544,0,1 1023,3,16 1148928 15269887 14120960 6895M 83 Linux

@Eeems
Copy link
Collaborator

Eeems commented May 8, 2024

Are the 3.11 issues something that might get sorted out in ~weeks? If so it might be best to wait (right?)

By issues, do you mean the new update mechanism that needs new development to support? Or do you mean for third party software? If that's the case, I would recommend looking at toltec-dev/toltec#820 instead of asking here.

Would this codexctl switch option need to be 'unwound' at a future date to free the fallback partition back up? Is there any downside to doing this?

You would just update like normally.

Finally, when I run fdisk -l on the reMarkable 2 I get the following output. How do I tell which is the fallback partition?

mmcblk2p2 and mmcblk2p3 would be your root partitions. The fallback would be the one not currently mounted. Check mount to see which one is currently in use.

@Captain-Barge
Copy link

I ran mount and see one line saying /dev/mmcblk2p3 on / type ext4 (rw,relatime) and nothing about mmcblk2p2. So mmcblk2p2 must be my fallback.

Thanks again for the help! I rarely have to use dd, but when I do I get really nervous.

@Trisk3lion
Copy link
Author

  1. Download the upgrade file with codexctl.
  2. Extract the raw ext4 image from the upgrade file (for now use the python tool that comes with remarkable-update to do so, extract is currently broken in codexctl)
  3. Transfer the image to the device.
  4. Determine which partition is the fallback partition.
  5. dd if=path/to/image.img of=/dev/mmc... where mmc... is the fallback partition
  6. Use codexctl switch to make the fallback partition active.
  7. Reboot device.

Thanks for the instructions @Eeems, this was exactly what I was looking for!

@Captain-Barge
Copy link

Captain-Barge commented May 8, 2024

I've followed the directions above but at the last step codexctl switch I get an error saying that switch is not a valid CLI option.

reMarkable: ~/ ./codexctl.bin switch
usage: Codexctl app [-h] [--debug] [--rm1] [--auth AUTH] [--verbose]
{install,download,backup,extract,mount,upload,status,restore,list} ...
Codexctl app: error: argument command: invalid choice: 'switch' (choose from 'install', 'download', 'backup', 'extract', 'mount', 'upload', 'status', 'restore', 'list')

I must be misunderstanding something?

UPDATE: Looking closely at codexctl/__init__.py it appears that switching the active root partition functionality is contained within RESTORE_CODE, which is invoked with do_restore() which is triggered by the "restore" CLI argument. So should I run codexctl restore and not codexctl switch to switch to the fallback partition?


Unrelated aside (just FYI): When I ran the codexctl extract <filename> step from my Ubuntu 22.04 laptop I got an error (below). This was on the 2024-05-08 01:42 release of codexctl. As suggested in the strikethrough text in the instructions above I was able to workaround the issue by extracting with remarkable-update's extractor script.

Traceback (most recent call last):
File "/tmp/onefile_74378_1715172312_590096/codexctl.py", line 4, in
File "/tmp/onefile_74378_1715172312_590096/codexctl/init.py", line 733, in main
File "/tmp/onefile_74378_1715172312_590096/codexctl/init.py", line 565, in do_extract
File "/tmp/onefile_74378_1715172312_590096/remarkable_update_fuse/init.py", line 1, in
File "/tmp/onefile_74378_1715172312_590096/remarkable_update_fuse/fuse.py", line 14, in
File "/tmp/onefile_74378_1715172312_590096/remarkable_update_fuse/image.py", line 14, in
File "/tmp/onefile_74378_1715172312_590096/remarkable_update_fuse/update_metadata_pb2.py", line 6, in
ImportError: cannot import name 'descriptor' from 'google.protobuf' (/tmp/onefile_74378_1715172312_590096/google/protobuf/init.py)

@besselfunct
Copy link
Contributor

While I understand that this should be marked as completed because the issue is solved, I would argue that there should be a change to the main Readme.md file to make this solution more accessible. Either the instructions given here should be put in the Readme.md, or a link to this issue should be added.

@Eeems
Copy link
Collaborator

Eeems commented May 8, 2024

While I understand that this should be marked as completed because the issue is solved, I would argue that there should be a change to the main Readme.md file to make this solution more accessible. Either the instructions given here should be put in the Readme.md, or a link to this issue should be added.

You are welcome to open a pull request

@Eeems
Copy link
Collaborator

Eeems commented May 8, 2024

Unrelated aside (just FYI): When I ran the codexctl extract <filename> step from my Ubuntu 22.04 laptop I got an error (below). This was on the 2024-05-08 01:42 release of codexctl. As suggested in the strikethrough text in the instructions above I was able to workaround the issue by extracting with remarkable-update's extractor script.

Traceback (most recent call last):
File "/tmp/onefile_74378_1715172312_590096/codexctl.py", line 4, in
File "/tmp/onefile_74378_1715172312_590096/codexctl/init.py", line 733, in main
File "/tmp/onefile_74378_1715172312_590096/codexctl/init.py", line 565, in do_extract
File "/tmp/onefile_74378_1715172312_590096/remarkable_update_fuse/init.py", line 1, in
File "/tmp/onefile_74378_1715172312_590096/remarkable_update_fuse/fuse.py", line 14, in
File "/tmp/onefile_74378_1715172312_590096/remarkable_update_fuse/image.py", line 14, in
File "/tmp/onefile_74378_1715172312_590096/remarkable_update_fuse/update_metadata_pb2.py", line 6, in
ImportError: cannot import name 'descriptor' from 'google.protobuf' (/tmp/onefile_74378_1715172312_590096/google/protobuf/init.py)

Please open a new issue to track this

@Captain-Barge
Copy link

  • Regarding the codextl extract error: I've opened a new issue
  • Regarding instructions for downgrading from 3.11: I'll volunteer to create a PR to add instructions to the readme once I get it working myself. I still haven't gotten it working yet because of the codexctl switch step (mentioned above). I see breadcrumbs which suggest that the step should maybe be codexctl restore instead, but I'm nervous to try on my own device without a more experienced person's thumbs up. @Eeems, what do you think?

@Eeems
Copy link
Collaborator

Eeems commented May 8, 2024

  • Regarding the codextl extract error: I've opened a new issue
  • Regarding instructions for downgrading from 3.11: I'll volunteer to create a PR to add instructions to the readme once I get it working myself. I still haven't gotten it working yet because of the codexctl switch step (mentioned above). I see breadcrumbs which suggest that the step should maybe be codexctl restore instead, but I'm nervous to try on my own device without a more experienced person's thumbs up. @Eeems, what do you think?

The --help output does seem to indicate that is the actual command. I generally just use https://github.com/ddvk/remarkable-update/blob/main/switch.sh on my device.

@ClashTheBunny
Copy link

Restore didn't work for me, as it complained about fw_printenv and fw_setenv not being in the path, but copy-pasting the bash snippet into a script and running with bash worked. There's something about the PATH environment variable not being passed into that subprocess.

@Eeems
Copy link
Collaborator

Eeems commented May 8, 2024

Restore didn't work for me, as it complained about fw_printenv and fw_setenv not being in the path, but copy-pasting the bash snippet into a script and running with bash worked. There's something about the PATH environment variable not being passed into that subprocess.

#66

@Trisk3lion
Copy link
Author

Let's keep the issue open until we got the PR for the instructions then.

@Trisk3lion Trisk3lion reopened this May 8, 2024
@Eeems
Copy link
Collaborator

Eeems commented May 8, 2024

Let's keep the issue open until we got the PR for the instructions then.

Already merged

@Eeems Eeems closed this as completed May 8, 2024
@andrewjensen
Copy link

andrewjensen commented May 23, 2024

EDIT: corrected the extract step

In case this is helpful for anyone else in the short term, I was able to get things working with the following steps on MacOS 13.6 and a reMarkable 2, OS version 3.11.x:

On my laptop:

# Clone repos
git clone https://github.com/Jayy001/codexctl.git
git clone https://github.com/ddvk/remarkable-update.git

# Download the latest toltec-compatible image to my Downloads folder
cd /path/to/codexctl
pip3 install -r requirements.remote.txt
python3 codexctl.py download 2.15.1.1189

# Extract the image
cd /path/to/remarkable-update/extractor
pip3 install -r requirements.txt
mv ~/Downloads/2.15.1.1189_reMarkable2-wVbHkgKisg-.signed ./
extractor.py 2.15.1.1189_reMarkable2-wVbHkgKisg-.signed # will create a raw image file called `out`

# Copy the image to the reMarkable
# (I already have a DHCP reservation for `remarkable-dev` but you can substitute an IP address here)
scp ./out root@remarkable-dev:/home/root/remarkable-2.15.1.1189.img

# Copy the remarkable-update repo to the reMarkable, so we can run the `switch.sh` script
# (You can also just copy the contents of that one file)
scp -r /path/to/remarkable-update/ root@remarkable-dev:~/remarkable-update

Then after SSHing into the device:

# Make sure the image is where I expect it
cd /home/root
ls -al

# List disk partitions
fdisk -l

# Figure out the active and fallback partitions (they are the digits at the end of /dev/mmcblk2p[NUM])
fw_printenv active_partition
fw_printenv fallback_partition

# My fallback partition was 2, so copy the image to that partition
dd if=/home/root/remarkable-2.15.1.1189.img of=/dev/mmcblk2p2

# Switch the active and fallback partitions
/home/root/remarkable-update/switch.sh

# Now reboot the device through the GUI (Menu > Settings > General > Restart)

I know the maintainers are doing an awesome job keeping these utilities updated to work with the newer reMarkable OS versions, but I wanted to post this in case it helps anyone in the meantime.

@Eeems
Copy link
Collaborator

Eeems commented May 23, 2024

Is there a reason you aren't using the pre-compiled version of codexctl instead of manually running the source?

EDIT: Actually, this should not have worked for you, codexctl extract does not work on macOS: #63
Did you modify requirements.txt before doing this? The required module just doesn't exist as it will only install on linux.

@andrewjensen
Copy link

Is there a reason you aren't using the pre-compiled version of codexctl instead of manually running the source?

Honestly, I forgot it was an option 😀 I was an hour or so into diving through the various linked issue convos and trying things over SSH that I thought to myself, "right, let's see how far I can get by running things from my own machine and copying them over."

EDIT: Actually, this should not have worked for you, codexctl extract does not work on macOS: #63
Did you modify requirements.txt before doing this? The required module just doesn't exist as it will only install on linux.

Oops, I mis-remembered that step. I tried to modify requirements.txt and it didn't work, so in the end I actually called /path/to/remarkable-update/extractor/extractor.py and that succeeded. I'll update my message above to correct that.

@bennyandresen
Copy link

In case this is helpful for anyone else in the short term, I was able to get things working with the following steps on MacOS 13.6 and a reMarkable 2, OS version 3.11.x:

I want to confirm that this was helpful on Linux. I followed you steps almost exactly and it worked. Thanks for writing it down and for all the people that contributed to the tools that allowed for the downgrade from 3.11.

@besselfunct
Copy link
Contributor

I recently tried to downgrade my Remarkable 1 using the procedure outlined in andrewjensen's post. I ran into an error with dd where there wasn't enough room in the partition for the .img file.

root@reMarkable:~# dd if=/home/root/remarkable-2.15.1.1189.img of=/dev/mmcblk1p2
dd: error writing '/dev/mmcblk1p2': No space left on device
488321+0 records in
488320+0 records out

It looks like there's an extra byte in the image file? I followed the steps in downloading and extracting the file exactly, so I'm not sure where the error was introduced.

@Eeems
Copy link
Collaborator

Eeems commented Jun 7, 2024

You likely downloaded a rM2 image instead of a rM1 image. codexctl --rm1 download 2.15.1.1189 will get you the rM1 image.

@besselfunct
Copy link
Contributor

That was it exactly. Thanks for the help!

@mduckham
Copy link

In case this is helpful for anyone else in the short term, I was able to get things working with the following steps on MacOS 13.6 and a reMarkable 2, OS version 3.11.x:

Thank you, this worked perfectly.

@JCarnon
Copy link

JCarnon commented Jun 24, 2024

  1. Download the upgrade file with codexctl.
  2. Extract the raw ext4 image from the upgrade file (for now use the python tool that comes with remarkable-update to do so, extract is currently broken in codexctl)
  3. Transfer the image to the device.
  4. Determine which partition is the fallback partition.
  5. dd if=path/to/image.img of=/dev/mmc... where mmc... is the fallback partition
  6. Use codexctl restore to make the fallback partition active.
  7. Reboot device.

Would it be possible to go in a little more detail please? I'm attempting to downgrade from 3.12.4.4, to v3.11.2.5 for rmhacks.
If you hadn't guessed, I'm a complete N00b.

  1. I've downloaded the .signed file for the FW I want 3.11.2.5 RM2 - "codexctl.exe download 3.11.2.5"
  2. Attempting to extract using the "codexctl.exe etract "firmwarename" command, throws an error.

image

After this process, I'm left with an "extracted" file, approx 280mb in size. I'm not 100% sure whether this file is now usable or not, given the public key error.

  1. Is there somewhere specific I should be placing the "signed"? or "extracted"? file on the device? Attempting to use WinSCP seems to time out around 30mb.
  2. I've determined the fallback_partition is 2. Current Running OS - /dev/mmcblk2p3
  3. I think is self explanatory, assuming I can upload the correct file. I'm guessing this command is to be run on the reMarkable, via SSH? - "dd if=root/extracted/.signed?? of=/dev/mmcblk2p2"
  4. Can you paste an example command for this?

Any help would be appreciated.

@Eeems
Copy link
Collaborator

Eeems commented Jun 24, 2024

  1. Attempting to extract using the "codexctl.exe etract "firmwarename" command, throws an error.

image

I don't see an error, just a warning. You can ignore the warning. It's just because 3.11 is the first version to have the new update mechanism, so the key file changed location. That's why it's a warning and not an error.

After this process, I'm left with an "extracted" file, approx 280mb in size. I'm not 100% sure whether this file is now usable or not, given the public key error.

This would be the extracted raw partition image that you would use in the further steps.

  1. Is there somewhere specific I should be placing the "signed"? or "extracted"? file on the device? Attempting to use WinSCP seems to time out around 30mb.

Somewhere on the data directory, so under /home/root.

  1. I think is self explanatory, assuming I can upload the correct file. I'm guessing this command is to be run on the reMarkable, via SSH? - "dd if=root/extracted/.signed?? of=/dev/mmcblk2p2"

dd if=/home/root/extracted of=/dev/mmcblk2p2 Assuming you placed the extracted file at /home/root/extracted.

@JCarnon
Copy link

JCarnon commented Jun 25, 2024

  1. Attempting to extract using the "codexctl.exe etract "firmwarename" command, throws an error.

image

I don't see an error, just a warning. You can ignore the warning. It's just because 3.11 is the first version to have the new update mechanism, so the key file changed location. That's why it's a warning and not an error.

After this process, I'm left with an "extracted" file, approx 280mb in size. I'm not 100% sure whether this file is now usable or not, given the public key error.

This would be the extracted raw partition image that you would use in the further steps.

  1. Is there somewhere specific I should be placing the "signed"? or "extracted"? file on the device? Attempting to use WinSCP seems to time out around 30mb.

Somewhere on the data directory, so under /home/root.

  1. I think is self explanatory, assuming I can upload the correct file. I'm guessing this command is to be run on the reMarkable, via SSH? - "dd if=root/extracted/.signed?? of=/dev/mmcblk2p2"

dd if=/home/root/extracted of=/dev/mmcblk2p2 Assuming you placed the extracted file at /home/root/extracted.

Awesome. Thanks for your assistance. Managed to successfully roll it back to v3.11.2.5. Now for rmhacks.

@JCarnon
Copy link

JCarnon commented Jun 25, 2024

For anyone else looking for more detailed steps, here they are.

Run codexctl.exe from the downloads folder (C:\users\username\downloads\codexctl.exe), with the download argument.

Example - "C:\users\username\downloads\codexctl.exe download 3.11.2.5"

Once downloaded, use the extract argument to extract the raw image. You should be presented with a file called "extracted"

Example - "C:\users\username\downloads\codexctl.exe extract 3.11.2.5_reMarkable2-qLFGoqPtPL.signed"

Copy "extracted" file to reMarkable

Example - "scp "C:\users\username\downloads\extracted" [email protected]:/home/root/"

Verify file is in correct directory using WinSCP

SSH to reMarkable. Run these commands to verify the ACTIVE Partition

rootdev = /dev/mmcblk2p3 (Partition 3 is active)
fw_printenv active_partition = active_partition=3

Run these commands to verify the FALLBACK Partition

fw_printenv fallback_partition = fallback_partition=2

Use DD Command to copy downloaded (extracted) FW image to the Fallback Partition

Example - dd if=/home/root/extracted (location of fw image on device) of=/dev/mmcblk2p2 (fallback partition)

Run codexctl.exe restore argument.

Example - C:\users\username\downloads\codexctl.exe restore

Reboot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants