Kindle Hacks

Removing DRM

DRM is a shorthand for the evil practice of Device Rights Management (or Device Restriction Management), where venders of digital stuff (particularly books and music) claim you did not buy their product, but only a revocable license to use it, and they encrypt what is downloaded to your computer or device to keep you from sharing the book or whatever with your friends, neighbors, relatives, or whoever. They also reserve the right to delete the book from your device at their discretion, and without refunding your money.

Agreed, sharing in this manner is a violation of copyright, and the publishers are within their rights to enforce this. HOWEVER, making backup copies for your own use or having the item on multiple devices that you own is LEGAL, but as long as the DRM is there you cannot do so.

Just one example of why you want to remove DRM from any downloaded book: What if you drop your Kindle or have it stolen? The unrestricted versions of your books on your hard drive would still readable on most e-book reader programs, for example the ebook-viewer utility that comes with Calibre.

Therefore, here is how to legally remove the DRM for your own private use. (If you break the DRM and then put the book on your web page or share it around, you are guilty of a felony and you will get no sympathy from me or the judge.)

Using Calibre

  1. Go to and download the newest version of the DeDRM tools from one of the links given there. You should wind up with a file called
  2. Unzip it to produce the directory tools_v5.5.3. Park that directory wherever it’s convenient. I put it in /home/dierdorf/bin.
  3. Inside that directory are three sub-directories: Calibre_Plugins, DeDRM_Applications, and Other_Tools, which seemsreasonably obvious.
  4. The DRM encryption scheme incorporates the serial number of the device it was downloaded to, so write down the serial number(s) of your book reader(s) because you’re going to need them. On an e-ink Kindle, the serial number is at Menu-->Settings under the "Device Info" heading. On the KF, it is to be found under Settings-->Device-->About. (Pull down the top menu and press "More" to get the Settings menu.)
  5. To install the Calibre plugin, start Calibre-->Preferences-->Plugins-->Load Plugin From File. Navigate to tools_v5.5.3/Calibre_Plugins and select Ignore the warnings.
  6. Back out and select Calibre-->Preferences-->File Type Plugins.
  7. Select the DeDRM plugin and click on "Customize plugin".
  8. Enter the serial numbers of your Kindle devices, separated by commas.
  9. Click “Apply”
  10. Restart Calibre for the plugin to take effect.

The plugin will now remove DRM from any Kindle file being added to the Calibre library or being sent to the bookreader, but it will not change the version which is already in the Calibre database! If you want to remove DRM from a book already in the Calibre database (to read it from inside Calibre, for instance), the easiest way is to select the book(s), click on “Save to Disk”, then import them (removing the DRM in the process) and delete the originals.

Removing DRM Using the Command Line

The DRM removal tool can also be run from the command line. It’s name is, and there ought to be two copies:

They are identical and both will work under Linux. (Hooray for Python!) Use the Windows one, both because the path is shorter and because it doesn't contain any blanks.

The command is:

python [pathto] -s [kindle serials, in quotes] [file to be converted] [directory to park the unDRM version]
I have a short batch file I call undrm that makes this much easier. Note we have three Kindles, and the offending file might have been originally downloaded to any of them:
#! /usr/bin/zsh
### Remove DRM from an AZW file, storing MOBI in home directory

python ~/bin/tools_v5.5.3/DeDRM_Applications/Windows/DeDRM_5.5.3/DeDRM_lib/lib/ -s "B006A0A00422E67FF,B006A0A0119401A7,D059A0A024450M3H" "$1" "/home/dierdorf/"

The command undrm whatever/mybook.azw will produce in my home directory.

Updating Calibre in Linux

PS: To easily update Calibre to the most recent version, I use the following small Linux batch file:

#! /bin/sh
# wget -O- | tar xvz 
# cd calibre*
# sudo python install
sudo python -c "import urllib2; exec urllib2.urlopen('').read(); main(install_dir='/opt')"
The Windows and Mac versions don't need this — you can just click on the “Update” notice when a new version is available.

Other Book Types

Although I concentrated on the Kindle, note that the CalibrePlugins directory also has plugins to remove DRM from .epub, .pdf, and .pdb, so if you have a Nook, Sony reader, or whatever, you can exorcise those books, too. It does NOT handle Apple decryption, but the original web page has a link to a tool which does do so.

Books, Not Docs

The Kindle Fire has two “folders” where it stores and displays readable material. If it was downloaded from Amazon, it goes into “Books”, and if it was “sideloaded”, either drag-and-drop or via Calibre, it goes into “Docs”. This is a PITA, both because you’re not sure where a particular title is, and because the Docs folder can’t be sorted by Author. Here’s how to get those into “Books” instead, using Calibre.

  1. Go to Calibre-->Preferences-->Conversion-->Output Options-->Mobi and make sure that the “Personal Doc Tag” field is blank. Hit “Apply”. You only need to do this once.
  2. If the books are safely in the Calibre database, then delete them from the KF. (Switch to the “Device” display, select the offending titles, and hit the delete key.)
  3. Switch to the “Library” display and select the books you just deleted from the KF.
  4. Select “Convert books” from the top bar.
  5. If you feel like it, in the conversion window, select “Mobi Output” on the left and double-check that the “Personal Doc Tag” field is blank!
  6. Click OK to begin the conversion(s). You may get a message saying the book is already in mobi format and asking if you want to re-convert. Say “yes”.
  7. You should now have both a “MOBI” and “ORIGINAL_MOBI” format shown on the right of the main page.
  8. The just-converted books should still be selected. If not, select them, and then click “Send to Device” at the top. The books will now be in the “Books” folder of the KF instead of “Docs”.
  9. If you forgot to delete the book(s) from the KF first, then you will have two copies on the reader. Go to Calibre’s “Device” display and delete the older one(s). (The newly-converted version(s) will have today’s date.)
  10. Note that with the “Personal Doc Field” blank, the conversion will even remove any DRM, something that would not happen otherwise for a book already in the Calibre library.

Sharing Data Across a Network

Sharing Linux-to-Linux

The most common way to mount a “foreign” Linux file system on your computer is using NFS (Network File System).

  1. Make sure nfs-kernel-server and nfs-common packages are installed. (Ubuntu doesn’t install them by default.)
    sudo apt-get install nfs-common nfs-kernel-server
  2. Edit /etc/hosts.allow to have a line such as:
    ALL: othercomp dell sony ...
    listing computers that you are willing to allow access to THIS computer. You can use either an IP address or a DNS hostname.
  3. Edit /etc/exports to have lines like these for each file system you’re willing to export and the computer it can be exported to:
    /       dell(rw,sync)
    /extra  dell(rw,sync)
    /images dell(rw,sync)
    /       sony(rw,sync)
    /extra  sony(rw,sync)
    /images sony(rw,sync)
    In this case, I’m allowing three different file systems (root, extra, and images) to be exported to computers sony and dell.

    Note that if you are on mycomp and want to access othercomp, you have to change othercomp’s /etc/hosts.allow and /etc/exports files to contain “mycomp”.

  4. Reboot all computers to have everything take effect.
  5. At this point you should be able to mount the other computer’s directories:
    sudo mount -t nfs othercomp:/home/dierdorf mymountpoint
    It’s easier to put entries in your /etc/fstab file:
    dell:/home/dierdorf    /dell   nfs  relatime,users,noauto  0 0
    sony:/home/dierdorf    /sony   nfs  relatime,users,noauto  0 0
    where /dell and /sony are the mountpoints. The noauto option means they will not be auto-mounted at boot, since they might not be available on the network at the time. When you decide you need one, just say:
    mount /sony
    or whatever. (You don’t need to use sudo because of that users option.)

    Sharing Linux-to-Windows

    Windows uses a facility called SMB (Server Message Block), now renamed CIFS (Common Internet File System), for network sharing. Linux has a tool called samba to interface with a Windows network sharing environment. Again, it isn’t installed by default, so if you need it, use

    sudo apt-get samba smb-client winbind

    Last modified: Sat Jan 12 16:45:23 CST 2013