Skip to content

Instantly share code, notes, and snippets.

@MichaelDimmitt
Last active November 17, 2023 00:07
Show Gist options
  • Save MichaelDimmitt/90985a542f4ce117e28d2fe159d2082d to your computer and use it in GitHub Desktop.
Save MichaelDimmitt/90985a542f4ce117e28d2fe159d2082d to your computer and use it in GitHub Desktop.
Finding my epub book and notes by ssh-ing into my remarkable2 device.

My epub book and notes dissappeared!

This gist documents my journey:

To find my epub book and notes by ssh into my remarkable2 device.


TLDR: (I found the book)

The .metadata file was blank! I copied another epub's .metadata file and renamed the title!

Read below for the full writeup!

What Happened?

My epub book disappeared along with all of my notes and tags.

Two things that were happening when I lost the book:

  1. tablet ran out of battery while viewing the book
  2. I had added over 200 tags to the ebook also I added 3 new pages

Steps taken to find and fix the epub ebook that went missing from Remarkable2

  1. Learn how to ssh into remarkable2: https://remarkable.guide/guide/access/ssh.html
  2. remarkable2 uses a busybox linux distro.
  3. search for where the find command is located to find what is installed on this on this box: "find / -name find"
  4. find / -name '*Programming*' - I was searching for a folder name but this (Did not work).
  5. find / -name '*.pdf' - returned some pdf results (8 results).
    a. looking at that folder all of the files have this content.
         fa438554-9ce8-427e-86d3-bf906fcdeed9
         fa438554-9ce8-427e-86d3-bf906fcdeed9.content
         fa438554-9ce8-427e-86d3-bf906fcdeed9.local
         fa438554-9ce8-427e-86d3-bf906fcdeed9.metadata
         fa438554-9ce8-427e-86d3-bf906fcdeed9.pagedata
         fa438554-9ce8-427e-86d3-bf906fcdeed9.pdf
         fa438554-9ce8-427e-86d3-bf906fcdeed9.thumbnails
         fbca10b7-5d30-4278-81ed-9cf767bdd3ab.tombstone 
  1. use scp to copy those files back to my mac to look at these pdfs.

  2. search for ebooks next.
    a. find / -name '*.epub' | rev | cut -c 5- | rev | xargs -I {} echo {}content | xargs cat
    b. find / -name '*.epub' | rev | cut -c 5- | rev | xargs -I {} echo {}content

  3. use scp to copy the epub back to the mac computer.

  4. It worked and I was able to find the epub ... and also my notes from the thumbnail sections as pngs.

  5. Time to figure out how remarkable or the android software connects with these hashes
    a. maybe I can add back the entry that somehow got removed
    b. find / -name remarkable
    c. /.config/remarkable/

  6. go back to comparing the good and bad ebook files: a. find / -name '*.epub'

/home/root/.local/share/remarkable/xochitl/5c5d7efe-02e2-4d2a-8072-2bbde1abd43c.epub
/home/root/.local/share/remarkable/xochitl/3b3b7668-63b5-4dc1-9cf1-5505e63a1735.epub
  1. make a tmp folder and move the two epubs to the same folder for comparison:
{
cd ~;
mkdir tmp; 
cd /home/root/.local/share/remarkable/xochitl;
cp -rf 5c5d7efe-02e2-4d2a-8072-2bbde1abd43c* 3b3b7668-63b5-4dc1-9cf1-5505e63a1735* ~/tmp
cd ~;
}
  1. ls on one line to visually compare: ls -l
drwxr-xr-x    2 root     root          4096 Nov 16 20:36 3b3b7668-63b5-4dc1-9cf1-5505e63a1735
-rw-r--r--    1 root     root        300485 Nov 16 20:36 3b3b7668-63b5-4dc1-9cf1-5505e63a1735.content
-rw-------    1 root     root      20638998 Nov 16 20:36 3b3b7668-63b5-4dc1-9cf1-5505e63a1735.epub
-rw-r--r--    1 root     root         74474 Nov 16 20:36 3b3b7668-63b5-4dc1-9cf1-5505e63a1735.epubindex
-rw-r--r--    1 root     root             4 Nov 16 20:36 3b3b7668-63b5-4dc1-9cf1-5505e63a1735.local
-rw-r--r--    1 root     root           423 Nov 16 20:36 3b3b7668-63b5-4dc1-9cf1-5505e63a1735.metadata
-rw-r--r--    1 root     root           654 Nov 16 20:36 3b3b7668-63b5-4dc1-9cf1-5505e63a1735.pagedata
-rw-r--r--    1 root     root      35561442 Nov 16 20:36 3b3b7668-63b5-4dc1-9cf1-5505e63a1735.pdf
drwxr-xr-x    2 root     root          4096 Nov 16 20:36 3b3b7668-63b5-4dc1-9cf1-5505e63a1735.thumbnails
drwxr-xr-x    2 root     root          4096 Nov 16 20:36 5c5d7efe-02e2-4d2a-8072-2bbde1abd43c
-rw-r--r--    1 root     root        511784 Nov 16 20:36 5c5d7efe-02e2-4d2a-8072-2bbde1abd43c.content
-rw-------    1 root     root       3318995 Nov 16 20:36 5c5d7efe-02e2-4d2a-8072-2bbde1abd43c.epub
-rw-r--r--    1 root     root         13640 Nov 16 20:36 5c5d7efe-02e2-4d2a-8072-2bbde1abd43c.epubindex
-rw-r--r--    1 root     root             4 Nov 16 20:36 5c5d7efe-02e2-4d2a-8072-2bbde1abd43c.local
-rw-r--r--    1 root     root           419 Nov 16 20:36 5c5d7efe-02e2-4d2a-8072-2bbde1abd43c.metadata
-rw-r--r--    1 root     root           629 Nov 16 20:36 5c5d7efe-02e2-4d2a-8072-2bbde1abd43c.pagedata
-rw-r--r--    1 root     root       5155189 Nov 16 20:36 5c5d7efe-02e2-4d2a-8072-2bbde1abd43c.pdf
drwxr-xr-x    2 root     root         40960 Nov 16 20:36 5c5d7efe-02e2-4d2a-8072-2bbde1abd43c.thumbnails
  1. using cat on each of the file I spotted that the missing book had an empty .metadata
cat tmp/5c5d7efe-02e2-4d2a-8072-2bbde1abd43c.metadata
cat tmp/3b3b7668-63b5-4dc1-9cf1-5505e63a1735.metadata
  1. Notice that the metadata file has a parent node that points to the folder it is located in the only other value that looks to matter in the metadata file is the title.
 cat tmp/3b3b7668-63b5-4dc1-9cf1-5505e63a1735.metadata 
{
    "createdTime": "0",
    "deleted": false,
    "lastModified": "1680157688028",
    "lastOpened": "1700161533461",
    "lastOpenedPage": 32,
    "metadatamodified": true,
    "modified": true,
    "parent": "7fa2cefb-1bce-43cf-a74d-685f5ce2d6b5",
    "pinned": false,
    "synced": false,
    "type": "DocumentType",
    "version": 0,
    "visibleName": "Graphic Design Rules: 365 Essential Design Dos and Don’ts"
}
  1. get the title of the book using cat on the content file:
cat tmp/5c5d7efe-02e2-4d2a-8072-2bbde1abd43c.content | grep title 
  1. copy the other metadata file to get the right info pointing to the same parent folder as the other ebook.
cp tmp/3b3b7668-63b5-4dc1-9cf1-5505e63a1735.metadata tmp/5c5d7efe-02e2-4d2a-8072-2bbde1abd43c.metadata
  1. modify the metadata file using vim to have the new title name: (may not be required.)
vi tmp/5c5d7efe-02e2-4d2a-8072-2bbde1abd43c.metadata

<ESC>:wq<ENTER> to save out of vim.

{
    "createdTime": "0",
    "deleted": false,
    "lastModified": "1700165291499",
    "lastOpened": "1700165121073",
    "lastOpenedPage": 422,
    "metadatamodified": true,
    "modified": true,
    "parent": "7fa2cefb-1bce-43cf-a74d-685f5ce2d6b5",
    "pinned": false,
    "synced": false,
    "type": "DocumentType",
    "version": 0,
    "visibleName": "Property-Based Testing with PropEr, Erlang, and Elixir"
}
  1. update the original file with this tmp file we just created:
cd /home/root/.local/share/remarkable/xochitl;
cp ~/tmp/5c5d7efe-02e2-4d2a-8072-2bbde1abd43c.metadata 5c5d7efe-02e2-4d2a-8072-2bbde1abd43c.metadata;
cd ~;
  1. Go back to the tablet. Restart your remarkable2 from the general tab in settings just to be safe.
  2. Look for your book and it should now exist with all your notes back!
  3. At this point I downloaded the book back on my computer just to be safe. I use the USB web interface. With the download succeeding I recieve a pdf with my notes intact!

USB web interface: Screenshot 2023-11-16 at 3 53 51 PM

SUCCESS! Screenshot 2023-11-16 at 3 54 59 PM


If you know anything about remarkable 2, feel free to chime in with any comments and questions.
Being an outsider of the company I know nothing currently of most of this works under the hood.

Cheers! Michael Dimmmitt


Proof! Some of my note pages: (expand to see pages)

Summary/Takaway page

049e2209-6abb-4607-84d5-dba14aee52cf

I spent a day doodling a drawing about types and super types unrelated to the book!

e32b045f-a41b-4962-960a-5dc63c5c41ef

Random page with notes from the book:

662c6703-ce41-43ce-a070-e55743e82ee7

The book is back! after fixing the .metadata file.

Notice the property based testing book on the left!

IMG_4891

@MichaelDimmitt
Copy link
Author

TODO; (write scripts to make this easier for people)

  1. check the device for manifest files that are empty
  2. list which manifest files are folders.
  3. fix the broken manifest folders using one of the folders that has a working manifest file.

These will be 3 separate scripts, the 3rd one will use the output from the first two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment