Where are Amazon Kindle ebooks on my Linux PC after I download them for offline reading w/"Kindle Cloud Reader" Chrome app, & how to convert to PDF?

45,635

Solution 1

How to convert purchased Amazon eBooks to PDF format:

This is a hard problem. However, I have a solution, but Linux users (including myself) aren't going to like it.

First off, let me say: DON'T STEAL BOOKS OR ANYTHING ELSE! BUY THEM! PAY AUTHORS FOR THE THOUSANDS OF HOURS THEY PUT INTO THEIR CRAFT AND THEN WRITING ABOUT IT. I'm going to explain how to do some things but DON'T STEAL BOOKS. This assumes you have PURCHASED AN EBOOK and are just PISSED OFF THAT WITH THAT PURCHASE YOU DON'T HAVE THE FREEDOM TO READ IT AS A PDF (A FREEDOM WHICH I THINK YOU SHOULD HAVE).

Also, there are possibly other paths to accomplish what I'm about to describe. If I see a possible alternate path I'll mark it with the word "clue", so watch for those and head down those paths to write your own improved answer if you wish.

1) Get the eBook from Amazon onto your PC for "offline reading"

What you need is the Kindle App "for PC & Mac": https://www.amazon.com/kindle-dbs/fd/kcp. However, don't use this link to download it, because the current version as of 5 Mar. 2018 is 1.21 Build 48017, and all versions after Kindle for PC 1.17 use a new "KFX format" which is currently uncrackable.

Clue: go crack the KFX format. We will all thank you for it.

Now, turn off your Ubuntu computer and boot into Windows.

Clue: You may be able to do this using Wine or by installing Windows 10 for free into a virtual machine inside Ubuntu instead.

So, go download an old version of the "Kindle for PC" app here:

https://kindle-for-pc.en.uptodown.com/windows/old. You must use version 1.17 or earlier for this to work. I used 1.16 Build 44025.

Install the App. Log in with your Amazon account, right-click the ebook you want, and go to "Download."

This will save it on your PC for offline viewing. You'll now find your downloaded book as a ".azw" file in "C:\Users\MY_USERNAME\Documents\My Kindle Content". For ex: "C:\Users\MY_USERNAME\Documents\My Kindle Content\B08137WHQ_EBOK.azw".

Clue: later versions of the Kindle for PC app will give you a folder with that name containing several other files instead, such as ".azw", ".azw.md", and ".azw.res". Apparently this is the new, uncrackable "KFX" format. Go crack it!

Clue: There is also a Chrome App called "Kindle Cloud Reader." You can install it and download your book for offline viewing too, but it uses a different format too. See comments under my question. On Windows you can find its offline book contents under the hidden folder "C:\Users\MY_USERNAME\AppData\Local\Google\Chrome\User Data\Default\databases\https_read.amazon.com_0". It contains, for example, two files named "85" and "86", with no file extension, but one is clearly the book since it's a few MB, while the other is 44KB or so. On Linux you can do a find in your home directory to find this location with sudo find . -iname \*amazon\*. I found the folder in: "~/.config/google-chrome/Profile 1/databases/https_read.amazon.com_0".

2) Remove the "Digital Rights Management" (DRM) from the .azw file so you can read the eBook using non-Amazon software.

In short: DRM sucks. If you're an author, don't do that crap! Just sell digital PDFs on Gumroad instead (Update: LeanPub may be a better option instead!).

To remove the DRM from the file we are going to use "DeDRM Tools 6.5.5": https://apprenticealf.wordpress.com/2017/10/20/dedrm-tools-6-5-5-released/.

Download it from GitHub here: https://github.com/apprenticeharper/DeDRM_tools/releases. Notice that the release notes state: "This release does not include any support for the KFX format Kindle ebooks that are often downloaded when using Kindle for PC/Mac 1.19 or later."

Click the GitHub link to download "DeDRM_tools_6.5.5.zip", then extract the zip file so you can find the "DeDRM_calibre_plugin" folder it contains.

Now go install the Calibre ebook reader for Windows 64-bit:

https://calibre-ebook.com/download. I'm using "calibre-64bit-3.18.0.msi".

Clue: I'm actually using this in Windows, but maybe you can get it to work in Linux, since Calibre has a Linux installation page too. DeDRM also contains some good notes you are about to need to help you out if you want to pursue this. See the readme you just extracted above here: "DeDRM_calibre_plugin\DeDRM_plugin_ReadMe.txt". It contains a rather confusing section (for me at least) titled "Linux Systems Only".

Install the DeDRM plugin:

Once Calibre is installed, open it up. Then go to "Preferences" --> "Advanced" section --> Plugins. Choose "Load plugin from file" then find your DeDRM .zip file in the unzipped folder from above. You're looking for "DeDRM_calibre_plugin\DeDRM_plugin.zip". Choose this plugin then click "Open" and "Apply."

Now click "Add books" in Calibre and go find the .azw file we previously downloaded using Kindle for PC 1.16 (1.17 or earlier). It will import it and automatically use DeDRM to remove the DRM crap!

You should now be able to open the eBook in Calibre for reading. Double click the book in Calibre to verify it opens up properly and is readable. It it works, all is well so far.

Clue: If in Windows this works flawlessly. If in Linux you may have to fight it with the readme file above, to get Wine and Python and stuff to all work right--I couldn't figure it out in Linux.

Almost there!

3) Convert the de-DRM'ed eBook to PDF!

Select the book in Calibre and click "Convert books" at the top. Choose "PDF" in the "Output format" drop-down box at the top-right of the window that pops up. You may now click "Ok" to do the conversion, OR (optionally) change a few quick settings first--as described below!

Optional:

  • Select "Page setup" first and make sure "Input profile" is set to "Default Input Profile" and "Output profile" is set to "Default Output Profile".
  • Select "Structure detection" and delete all text from the "Insert page breaks before (XPath expression)" box if you'd like the PDF to take up fewer pages by not forcing page breaks between every section and sub-section in the ebook.

Click "Ok" to convert the ebook to PDF! This took ~2 min for me on an eBook ~100 pages in length and 3 MB in size.

Done! Your ebook PDF is now located in your "Calibre Library" folder here: "C:\Users\YOUR_USERNAME\Documents\Calibre Library\EBOOK_AUTHOR\EBOOK_TITLE\EBOOK_TITLE.pdf".

You'll also find a nice (de-DRMed I think) ".azw3" file in the same location as well, in case you want to use Calibre or other generic eBook readers to read the book instead!

Copy the PDF or .azw3 file to your Ubuntu machine, as desired, and voila!--use your favorite ebook reader (ex: Calibre) or PDF viewer (ex: FoxitReader) to view your ebook as a PDF!

Get Foxit Reader for taking notes inside digital PDFs:

Foxit Reader (click here then go to "Free Foxit Reader Download") is great because it has awesome highlighting and comment tools to underline things, highlight, or take notes, and it is cross-platform (Windows, Mac, Linux, & others) and free as in "no-cost" (but not free as in open source!).

AND REMEMBER: DON'T STEAL! Buy the book and give the authors their hard-earned money! Encourage authors to sell PDFs (ex: via Gumroad like I do) (Update: LeanPub may be a better option instead!) instead of DRMed garbage.
But if you steal you are ruining the system. DRM might suck, but you don't have to suck too!

Solution 2

if you don't have Windows or Mac available, but Linux

  1. use the Kindle Cloud Reader at https://read.amazon.com in Chrome or Chromium to see your books and right-click, Pin&Download
  2. find the stored file with code provided above by Gabriel Staples: sudo find . -iname \*amazon\*
  3. use the tool provided at https://github.com/d10r/kindle-fetch (you need nodejs)
  4. it will provide you a huge html file of the whole book in some splitseconds

Solution 3

If you owned a physical Kindle device (i.e., not just a PC/smartphone app) at one point and it is still listed in your account, then there's a simpler way to download and convert Amazon ebooks:

  1. Login to your Amazon account in a browser
  2. Navigate to "Manage Your Content and Devices"
  3. Find the serial number for your Kindle
  4. Download and extract latest DeDRM plugin from: https://github.com/apprenticeharper/DeDRM_tools/releases/
  5. Install Calibre from the Ubuntu Software app
  6. In Calibre, select Preferences > Plugins > Load plugin from file and select the zip file in the DeDRM_calibre_plugin extracted in Step 4
  7. Select the DeDRM plugin (under File Type Plugins) and click Customize Plugin
  8. Select eInk Kindle ebooks and add the serial number you got in Step 3
  9. Connect your Kindle to the PC via USB and go to Step 10(A) skipping 10(B). If you no longer have the physical Kindle device but it is still listed in your Amazon account, skip 10(A) and go to Step 10(B).
  10. EITHER (A) On the main window of Calibre, click Device, select the books you wish to download and click Add books. OR (B) From the "Manage Your Content and Devices" page of your Amazon account, click the "..." button next to the book you wish to download, select "Download and transfer via USB" and select the physical Kindle device. In Calibre, click "Add books" and locate the directory where you saved the files.
  11. You can now open it directly or convert it to another format (e.g., pdf, epub, etc.) 

Solution 4

Calibre has a Linux version, and the standard tool it supports for working with DRM now supports KFX.

You do need to have a version of Kindle for PC running on your computer, which depends on having Wine running. After various problems, there seems to be something about recent versions of kindle for PC, I got an older version running. Some as the original answer, Kindle v 1.16 Built 44025. I am running PlayOnLinux 4.2.12, Wine 3.0.2, in a 64bit virtual drive set to work as Windows 8.1, under Linux Mint 18.3 using Xfce.

So far, at least, I have not had any encounters with KFX files. but it's possible Amazon's use of that format could eventually force me to switch to a more recent Kindle version.

So, August 2018, the answer here works, the KFX encryption has been cracked, but I would like to have some assurance that some more recent version of Kindle for PC will work

Share:
45,635
Gabriel Staples
Author by

Gabriel Staples

Updated on September 18, 2022

Comments

  • Gabriel Staples
    Gabriel Staples almost 2 years

    Where are Amazon Kindle ebooks located on my Linux PC after I download them for offline reading with the "Kindle Cloud Reader" Chrome app, & how do I convert them to PDF format?

    For Windows this seems to be the answer:

    For MacOS this seems to be the answer:

    But for Linux there doesn't seem to be an answer. :(

    My aim is to convert the Kindle ebook to a PDF format (which I much rather prefer) for offline reading on any device. Enough of this proprietary "read through Kindle app only" garbage. I'm on Linux for Heaven's sake!


    Update: in ~/.config/google-chrome I have the following:

    gabriels:~/.config/google-chrome$ ls
    Avatars                       pnacl
    BrowserMetrics                Profile 1
    BrowserMetrics-active.pma     Profile 2
    BrowserMetrics-spare.pma      Safe Browsing
    Certificate Revocation Lists  Safe Browsing Channel IDs
    CertificateTransparency       Safe Browsing Channel IDs-journal
    Consent To Send Stats         Safe Browsing Cookies
    Crash Reports                 Safe Browsing Cookies-journal
    Dictionaries                  ShaderCache
    FileTypePolicies              SingletonCookie
    First Run                     SingletonLock
    Guest Profile                 SingletonSocket
    Local State                   SSLErrorAssistant
    NativeMessagingHosts          Subresource Filter
    OriginTrials                  System Profile
    PepperFlash                   Webstore Downloads
    
    • muru
      muru over 6 years
      What do you have in ~/.config/google-chrome?
    • Gabriel Staples
      Gabriel Staples over 6 years
      See above in question.
    • Gabriel Staples
      Gabriel Staples over 6 years
      Also, sudo find . -iname \*kindle\* in my home dir found nothing.
    • muru
      muru over 6 years
      Do either of those profile directories contain a databases directory? Since the Windows answer says the file is called https_read.amazon.com..., I'd look for something like that instead.
    • Gabriel Staples
      Gabriel Staples over 6 years
      sudo find . -iname \*amazon\* in my home dir revealed the location: /.config/google-chrome/Profile 1/databases/https_read.amazon.com_0. How what though? The files are named 3 (50 kB) and 4 (3 MB)...no extensions. Not what I was expecting. Not sure how to use them.
    • muru
      muru over 6 years
      Since the SO post for Windows says "Looking at the database in Sqlite Browser, it seems that the books are broken apart into thousands of fragments", I'm not sure what you were expecting. You might want to try the Kindle application on Wine, though I hear that it's not easy to get the books from recent versions of that either.
    • RonJohn
      RonJohn over 6 years
      To find epub files: find . -name '*epub'.
    • Alexey Ce
      Alexey Ce over 6 years
      generally you can just e-mail them to yourself: ebooks.stackexchange.com/q/7719/9853 it works quite well for PDF's. However, PDF's on the Kindle suck, in my experience. Better to try and get mobi or other format.
    • Gabriel Staples
      Gabriel Staples over 6 years
      Amazon ebooks cannot be emailed to yourself. There is a way to get more easy-to-use files to yourself if you own an actual Kindle, however, via the Amazon "Manage Your Content and Devices" page (amazon.com/mycd), but that requires owning an actual Kindle--and possibly even one of the older ones. Since I don't own a kindle, the answer I have posted (askubuntu.com/a/1012193/327339) I'm convinced is absolutely the only way to do it today. I have explicitly left "clues" however in my answer for the most dedicated individuals to follow in order to try alternate approaches.
  • Tom Mercer
    Tom Mercer about 6 years
    THIS WORKED! Thank you. It was a labyrinthine effort, to be sure.
  • Gabriel Staples
    Gabriel Staples about 6 years
    Glad it helped! I'm a determined guy so I figured this out almost all in one sitting. What a pain! UPDATE TO AUTHORS: Please sell your PDFs on LeanPub! (leanpub.com) Down with freedom-sucking DRM B.S.!
  • Gabriel Staples
    Gabriel Staples almost 6 years
    This looks like it may actually work. I'd have to try it.
  • Fabby
    Fabby almost 6 years
    Welcome to Ask Ubuntu1 :-) This looks like an answer and a question in one. For clarity, you can edit the existing answer with the new information, or edit your answer as, take out the last paragraph and ask a new question. (Sorry, this is a Q&A site, not a forum and we're a bit particular about this)
  • Ricardo Pietrobon
    Ricardo Pietrobon almost 6 years
    oops, just saw that @dave bell provided the same answer, my bad
  • chovy
    chovy over 5 years
    offline mode is disabled for me on read.amazon.com in Ubuntu 18.04 64-bit using chrome 71.
  • Gabriel Staples
    Gabriel Staples almost 5 years
    That's an interesting, albeit extremely non-ideal, solution. Any idea how long that might take to run? I encourage you to give it a shot and see how long it takes and how good it turns out.
  • Sharun
    Sharun almost 5 years
    I use it regularly to move important reference sections/formulas etc from phone to desktop. It's fast.
  • Aurovrata
    Aurovrata over 4 years
    offline mode can be enabled by installing the "Kindle Cloud Reader" app from the chrome extension repo.
  • nocibambi
    nocibambi over 4 years
    Based on this link, there is a way to convert kfx files... epubor.com/…
  • Ronny D'Hoore
    Ronny D'Hoore about 4 years
    I managed to de-DRM my ex-wife's Kindle ebooks just fine on Linux Mint, downloading Calibre and adding the plugin you mentioned. I had to enter the serial number of her old Kindle manually in the right place, but then importing them went blazing fast. And indeed I could open them in Calibre after that. So I can finally get them to her and delete them from my account. Thanks very much!!
  • Ronny D'Hoore
    Ronny D'Hoore about 4 years
    You don't need to still have the physical device. You simply need to have had it at one point, and it still needs to be listed in your Amazon account. The serial number is listed there as well. So step 9 is not needed, you can still download the ebooks using "Download and transfer via USB", you will get the file(s) just fine.
  • koyakun
    koyakun about 4 years
    @RonnyD'Hoore Thank you. I updated the answer, could you please confirm Step 10B? Could you also please confirm that DRM protected files can still be viewed in Calibre this way?
  • Ronny D'Hoore
    Ronny D'Hoore about 4 years
    You need to download each book one by one (there is no global "Download" button), and you do need to have the Kindle still listed on Amazon, because in order to be able to download any book, you need to select to which Kindle it is meant to go, and anything that is not a physical Kindle is grayed out. (At least, my Android phone is grayed out, so I'm assuming PC Kindle reader won't do either). But yes, apart from these two side notes, I did what you described in 10B, and could view them just fine.
  • koyakun
    koyakun about 4 years
    @RonnyD'Hoore Thank you for the confirmation. I've updated the instructions to make the points you mentioned clearer. Actually, before I learned about the DeDRM plugin, I had tried just downloading them from Amazon, but without DeDRM, of course I wasn't able to open the DRM-protected ones. It's interesting to know that had I installed DeDRM, I would have been able to open them without connecting my Kindle.
  • Gabriel Staples
    Gabriel Staples about 4 years
    @RonnyD'Hoore, glad to hear it!
  • Fabian Röling
    Fabian Röling about 3 years
    @Aurovrata That extension seems to no longer do anything, it only opens read.amazing.com when started and that's it.
  • Steven J Owens
    Steven J Owens over 2 years
    I just figured this out on my own, but an important detail that isn't quite emphasized in your answer: In step 10b), when you download from amazon.com, be sure to select that you're downloading for an EINK KINDLE DEVICE (that's the important bit). When I downloaded it for my Kindle Fire (which is where I actually wanted to read it, albeit on Aldiko instead of on the Kindle app), Calibre and DeDRM couldn't convert it. When I downloaded it for my eink kindle, Calibre and DeDRM converted it fine.