Retrieve kindle keys to use with DeDRM - walkthrough step-by-step (Dec 2022) #229
cmc302a
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
Thanks for the write-up. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
After having spent the best part of the last 5 days tinkering with calibre for linux and the DeDRM plugins, to have my kindle books available in calibre for my own peruse, I decided to post a walkthrough for newbies (mostly). The most difficult part was getting DeDRM to retrieve the necessary kindle decryption keys from a Kindle installation (under wine). Wine is a pre-requisite, since there is no native Kindle for Linux package.
I used winetricks (as provided by my distro - KDE neon), since I found it useful to change wine settings, launch installer/uninstaller, and launch command line prompts. Wine is a pre-requisite, since there is no native Kindle for Linux package.
1.- Install calibre 6 in linux (NOT in wine bottle)
2.- Install DeDRM plugin (as instructed elsewhere) in calibre plugins
3.- Download Kindle for PC (I used version 26-55076, worked nice... after lots of trial and error), have it ready at hand
4.- Download python 3 for windows installer (I used python-3.9.6), have it at hand also
5.- Open winetricks, create 32-bit wine bottle (create new wineprefix --» architecture 32-bit --» name it as you wish)
6.- Select "change settings" --» look for "win81" --» select and OK.
7.- Just to be sure, select "Run winecfg" and check that the windows version is 8.1
8.- Select "run uninstaller" --» Click "Install..." button --» browse and find kindle for PC installer (from step 3) --» OK --» This will start the installation of Kindle for PC in the newly created wine prefix
9.- At this point, kindle will auto-launch. It may happen, that it closes unexpectedly.... My workaround (as found in the WineHQ website) was to create the following folder structure into the new wine prefix:
/drive_c/users//AppData/Local/Amazon/Kindle/crashdump/
10.- Attempt to run Kindle and login through Amazon login prompt that displays. (at this point, if you find the "no internet / no connection" error, please refer to common issue cited in DeDRM github, it is a matter of a missing certificate)
11.- In the Kindle preferences, uncheck "Automatically download updates". THIS HAS TO BE DONE IMMEDIATELY AFTER LOGIN IN KINDLE
12.- At this point you might want to download a few of your kindle books (and also check the location of "My Kindle Content" folder... this is where kindle stores the ebooks in its own proprietary tree structure and formats")
13.- Return to the winetricks installer, click "Install..." once again.
14.- This time, browse to the python3 installer (from step 4) and install it. At this point, be sure that the python installation concludes successfully. If, for some reason, installation is NOT succesful, try "advanced installation" or "custom install" and DESELECT "Create shortcuts". This did the trick for me (as a matter of fact, I deselected also the tests and the documentation), but be sure to keep the "Add to path" option, and to select "Install for all users", AND "Install PIP" options.
15.- Return to winetricks. Select "Run a commandline shell (for debugging)". This will open a linux shell terminal.
16.- Type "wine cmd". This will change the prompt into a DOS cmd.
17.- Type "pip install pycryptodome". This installs said library INTO THE WINE BOTTLE. By completing these steps, you will have what Calibre requires IN THE WINE PREFIX to retrieve the kindle keys. Close the terminal window.
18.- Next, launch Calibre. Navigate to "Plugins", select the DeDRM plugin, click on "Configure plugin" button (might be called something else, my calibre is in Spanish, sorry)
19.- Click on "Kindle for Mac/PC ebooks" button
20.- In the window that pops-up, there is a textbox called "WINEPREFIX:". You should type the route TO THE NEWLY CREATED WINE PREFIX (~/.local/share/wineprefixes/<name_of_new_wine_prefix>/).
21.- Click on the green "+" sign button on top right... This causes calibre to invoke the python script (which is newly installed in the wine bottle) that retrieves the kindle keys. A message appears that a key is found, you can rename it if you please, click OK.
22.- The newly retrieved key is shown in the list to the left. You can click on the small "disk" icon to the right to make a backup of the key.
Import any kindle book into calibre (from the "My Kindle content" folder). Convert it to epub before attempting to read it. Profit.
As you may conclude now, if you might want to keep this system of downloading kindle books and finally having them converted to epub, YOU SHOULD ONLY USE THE KINDLE APP THAT LIVES IN YOUR WINE BOTTLE, because this key is linked to this specific installation. If you provide kindle files from any other kindle installation, you might not be able to open or convert them with calibre, even if you have your kindle key. Also, DO NOT VOID OR CANCEL the registration for your Kindle for PC installation on the Amazon website. And, finally, my suggestion is to keep Python3 installed into the bottle... It doesn't hurt, and there's a chance the DeDRM might require it again...
Thanks to promeneur and ElleKayEm for their useful posts, they guided me through the maze.
Beta Was this translation helpful? Give feedback.
All reactions