Freeing ebooks in Linux

In this day and age where space is a really a luxury, gone are the days where one can afford huge bookshelves, and tons and tons of books. I still do like the freedom and non-intrusive nature of paper books, but I also like to be able to view books in electronic form (ebooks), and besides they are a huge space saver, I do no longer need physical bookshelves, just virtual ones.

Unfortunately, there are some folks who believe they have the right to decide where you can only view your ebooks as well as what you can use to view them. Suddenly, you find that you don’t just have to pay for the book you read, but you also have to pay for lending it to a friend, or just moving from one place to another.  Sadly, they have become bound with the same disease that has plagued the video and music industry, which is the loss of control of what you have purchased.  And these guys think they are doing a noble deed, after all, they claim it is for the protection of the book’s author and ensuring that they get paid… eventually, they have packaged everything under the grand name of: Digital Rights Management (DRM).  I wonder sometimes, if paper books are subjected to the same humiliation, what would be the general public reaction then…

If you ever bought an ebook before, chances are that they are likely to be in Adobe ePUB format (Otherwise known as ACSM files). These files can only be opened via Adobe Digital Editions, or ADE for short. Of course, there are many other readers out there where you can also peruse to view these files with BUT only with the “many other readers”.  And what could have been more farcical itself is that these other readers use the same technology that I used to remove the DRM from Adobe ePUB so that you can only use their viewer to view the books.

Therefore, the book that you have bought in itself is not free, you do not own the book, the reader does and indirectly, the online seller does. That is because most online ebook sellers often package their “proprietary” ebook reader so that you can read books bought from their store.  For this same reason too, I never liked online music, I prefer to own my music, rather than put ownership in the ‘cloud’ and pretend it is mine just because I own a playlist where in actuality, I do not own my music, the online provider does.

But I digress,  here is how I got my ebooks to be truly mine. The aim is to put the ebooks in a portable format (read: could be opened in any OS/ebook reader)  Hence, there are 2 main steps to it.

  1. Extract the DRM protected ePUB from the ACSM file.
  2. Create a copy of the Adobe ePUB with the DRM removed.

Note that there are actually quite a bit of guides out there on how to remove DRM from ebooks. And beware again, as a disclaimer: That in some countries this may be considered illegal, by doing so I do not claim to be responsible for anything that might happen to you should you run afoul of the law.

Besides not believing that anyone has any right to decide to manage or control over my purchased goods, I am also writing this guide as I feel that some of the most of the guides are in Windows/Mac. I use neither of these, for I only use Linux. So there. Everyone probably has a different version of how they do it. so here goes…

Wine

  • Install Wine
    I installed Wine in a Debian VM because I don’t want 32 bit libs messing my main system and if I screw up, well it is just a vm….
  • Use winetricks to install Adobe Digital Editions (ADE). It is an old version, but it still works well.
    Theoretically, you could also install it with just wine on the default WINEPREFIX and not having to key it in when you need to install additional components later.
  • Log on to it with your Adobe ID and activate the computer.
  • Note the WINEPREFIX for ADE, you will need it later. You can find that out at the program launcher or via winetricks.
  • Export your books from your online book store if you can in .acsm format, import it into ADE. This may vary, I use Kobo and they do have an Export Book function.
  • Now you should see a “My Digital Editions” folder with corresponding .epub files of the acsm files that you have used ADE to open with

Apprentice Alf

Get the DRM removal tool, extract the zip file.

You will probably see this after unzipping the file:

caleb@ravn-debian:~/Downloads/DeDRM$ ls -al
total 40
drwxr-xr-x 7 caleb caleb 4096 Nov 18 22:07 .
drwxr-xr-x 8 caleb caleb 4096 Nov 18 22:07 ..
drwxr-xr-x 2 caleb caleb 4096 Oct 7 09:32 DeDRM_calibre_plugin
drwxr-xr-x 3 caleb caleb 4096 Oct 9 16:06 DeDRM_Macintosh_Application
drwxr-xr-x 3 caleb caleb 4096 Oct 7 09:32 DeDRM_Windows_Application
drwxr-xr-x 2 caleb caleb 4096 Oct 7 09:32 Obok_calibre_plugin
drwxr-xr-x 9 caleb caleb 4096 Oct 7 09:32 Other_Tools
-rw-r--r-- 1 caleb caleb 8464 Aug 10 06:38 ReadMe_First.txt

It is the Other_Tools directory which is of interest. A python script, adobekey.pyw will have to be executed there but before it can be done….

Installation

You will need to install the following in your Wine profile

  • Note:
    .msi files require you to use “env WINEPREFIX=”blahblah” wine start <name of .msi file>”
    .exe files, you just have to  “env WINEPREFIX=”blahblah” wine <name of .exe file>”
  • And then go into the Other_Tools directory and invoke this command
Other_Tools/DRM_Key_Scripts/Adobe_Digital_Editions$ env WINEPREFIX="/home/caleb/.local/share/wineprefixes/adobe_diged" wine python adobekey.pyw

This will generate a key called adobekey_1.der. This is your Adobe key file, keep it in a safe place 🙂

caleb@ravn-debian:~/Downloads/Other_Tools/DRM_Key_Scripts/Adobe_Digital_Editions$ ls -al
total 36

drwxr-xr-x 2 caleb caleb 4096 Nov 18 20:41 .
drwxr-xr-x 7 caleb caleb 4096 Oct 7 09:32 ..
-rw-r--r-- 1 caleb caleb 609 Nov 18 20:41 adobekey_1.der
-rw-r--r-- 1 caleb caleb 22467 Oct 7 09:32 adobekey.pyw
  • On Debian, install Calibre the epub book reader and get the DeDRM Calibre plugin installed as per instructions.
  • Customise the Calibre plugin by
    • Importing your adobekey_1.der file (Click on the Import Existing Keyfiles button)
    • Keying in your WINEPREFIX for ADE in the field on the dialog box.
    • Pictorially, it looks something like this.

dedrm-customise

  • Now try to Add Books to Calibre and select the DRM locked ePUBs previously extracted by ADE under your “My Digital Editions” folder.
  • Voila!! The ePUBS are automatically stripped of their DRMs, you can henceforth export (save to disc) the ePUBs from Calibre out and use your favourite ebook viewer elsewhere to view them, like I finally got them showing in my Chromebook :).

Comments are closed.