Remove DRM from Amazon Kindle’s ebooks using Linux

August 20th, 2010 by
T4L

When you buy an ebook using your Kindle, there’s a 99% chance it’s a DRM file. That means you won’t be able to read it anywhere else but on your Kindle. And we won’t accept that. To be able to convert that file and remove its DRM protection, you need a set of Python scripts called MobiDeDRM.
Now open your Kindle and type 411 on the keypad. This will bring up a window containing information. Write down the 16-character alphanumeric Serial.
Through your computer, buy a book from Amazon.com and save it to your harddrive. The filename shoud be something like Book-Title.azw.
Be sure you have Python installed in Linux. In Ubuntu you can easily install it with sudo apt-get install python.
Extract de files from the MobiDeDRM.zip file and run one of them like this:

python kindlepid.py XXXXXXXXXXX

where XXXXXXXXXXXX is your 16-character Serial. The Terminal window will return something like

Mobipocked PID for Kindle serial# XXXXXXXXXXXXXXXX is Z1QFCDQ*74

That “Z1QFCDQ*74” string is what you need.
Now all you have to do to remove the DRM from the .AZW file is:

python mobidedrm.py Book-Title.azw Book-Title.mobi Z1QFCDQ*74

In a minute or so you should have a DRM-free MobiPocket book you can later convert in any other format you like. If that doesn’t work, try

It should work as long as you have that Kindle Serial and the book you downloaded is DRM-enabled. I own a Nook myself but didn’t buy any books with it yet since the B&N store doesn’t let me use my non-US credit card.

@jr: the link has been updated; the zip file should contain now what you need. My bad for not checking the archive earlier.
@Martin: breaking DRM is illegal in the US. I, on the other hand, don’t live in the US. Secondly, we’re Linux users. We know a thing or two about DRM, so it wasn’t necessary for me to specify it might be illegal.
@Don Marti: “Protection” was the first word to pop into my head. But you might be right there.

Looks like these instructions are out of date and won’t work anymore. I believe that the newest Kindle firmware uses pid which is tied both to the Kindle serial number and individual books. So the pid one gets with this method won’t work with kindle2 (as long as it has current firmware) or later. I would gladly be wrong — and the files in the archive could be updated to get the working pid for the latest firmware. But it does not look so based on the timestamps of the files in the archive.

I love this in principle because I have more than 5 devices (counting numerous computers, iPhones, and iPads) and I can only have my books on 5 of them, which is really annoying. Ownership should be mapped to users rather than to devices.

In any case, I’m wondering how I get the serial number for Kindle software running on my iPad so I can try this process.

Calibre only converts between ebook formats (epub, mobi, etc), it can’t remove drm. If you want to convert a kindle book to epub with calibre, you first have to figure out a way to remove the drm (such as with these mobidedrm scripts). Of course they don’t seem to work for me with the kindle 3, but I’ve only just started trying…

mjjzf: Calibre contains no de-drm abilities on its own for legal reasons.

There are now solutions for al these problems. A way to generate the per-book PID has been reverse engineered. A way to de-drm and extract the info in Topaz format ebooks has been found. And plug-ins for Calibre that remove DRM have been written.

Yoy can find full instructions and download links to all the tools (including the latest MobiDeDRM, version 0.24), at my blog:

This method obviously doesn’t work anymore, but a simple solution if you’re reading legitimately-purchased copies of books is to install the Amazon Kindle Reading App for Windows. It installs flawlessly in WINE (at least on Ubuntu) and gives you instant access to all your purchased titles.

According the latest court cases in the US, NO… It’s NOT illegal to break DRM to access what you’ve purchased. It IS illegal to break DRM, if you further use the cracked copy to do something else illegal. IOW, if you break security to either pirate or damage someone’s systems, breaking DRM is an additional charge against you. If you do it for access, it has been ruled (at least in one district court…second or fifth, I believe, and if you’re looking for the case, it was specifically dealing with software) legal, overturning that line of the Millennium Act. Of course, if you ask Amazon, they’ll try to tell you Millennium still stands.

I would be more sympathetic to the DRM issue, if it wasn’t so tied up with limiting competing e-readers from reading books from different providers (note that I said providers NOT publishers or authors). It is important to protect the creators of the work. However, I can’t bring myself to buy an e-reader since whichever one I buy excludes important rights that I believe I have, such as the right to BUY books from anybody and view them on my device. The state of affairs with Amazon, for example, is analogous to Apple building computers and an OS and excluding ANY software other than that created by Apple from working on an Apple computer. That is of course NOT the way things are. Software vendors can write for the Apple platform regardless of whether or not they are part of Apple’s company!

Apple’s walled garden on iOS allows other developers, but only with Apple’s approval. Apple has a TOS that is incompatible with the GNU GPL, so lots of free/open-source software is BANNED from the iOS by Apple. It isn’t (yet) so bad on the Mac, but your analogy is actually more true than you realize. Apple *IS* locking things down.

Was actually fine with DRM until I paid 40 bucks for a computer book only to realize that Amazon has disabled any use of cut/paste, which means I have to type all kinds of SQL code BY HAND. A huge waste of money and time. Want to crack DRM just to be able to use Ctrl-C while I’m reading it…anyone able to help out? Does MobiDeDRM work anymore? I will never pay $40 bucks for a DRMed book again. But since I’ve got this one, I’d love to be able to find a way to cut and paste. I don’t have a Kindle, just Android and Windows and Linux versions of Amazon Reader. Anyone?

About

www.tips4linux.com is a place dedicated to the Linux user. Not only for the advanced but also for novice users who wish to learn how easy life with Linux can be and how customizable the operating system is. Linux can also be used as an OS platform servers and proves to be reliable when it comes […]