View Single Post
Old 12-31-2014, 07:32 PM   #241
Difflugia
Testate Amoeba
Difflugia ought to be getting tired of karma fortunes by now.Difflugia ought to be getting tired of karma fortunes by now.Difflugia ought to be getting tired of karma fortunes by now.Difflugia ought to be getting tired of karma fortunes by now.Difflugia ought to be getting tired of karma fortunes by now.Difflugia ought to be getting tired of karma fortunes by now.Difflugia ought to be getting tired of karma fortunes by now.Difflugia ought to be getting tired of karma fortunes by now.Difflugia ought to be getting tired of karma fortunes by now.Difflugia ought to be getting tired of karma fortunes by now.Difflugia ought to be getting tired of karma fortunes by now.
 
Difflugia's Avatar
 
Posts: 3,049
Karma: 27300000
Join Date: Sep 2012
Device: Many Android devices, Kindle 2, Toshiba e755 PocketPC
I hope nobody feels like I'm derailing the thread , but here's the beginning of a how-to for running Calibre with De-DRM in Linux. I hope it's general enough to avoid any problems with the MobileRead guidelines.

First, though, in keeping with the spirit of the thread, Windows blows goats. All versions. I've used every version from 1.01 to 8.1 and they all suck. I am confident that Windows 10 will suck. VMS was better than Windows and VMS sucked.

That said, the system that I use dual-boots Slackware (installed as 8.1, transferred between computers with kernel/library upgrades as necessary) and whatever Windows flavor of the month comes installed on my latest computer (I just got a new laptop about two weeks ago with 8.1). I have Calibre portable installed on an external hard drive and I attach my Linux Calibre installation to the external library, so I can switch back-and-forth between Linux and Windows with Calibre. The portable Calibre version for Windows is 1.45 and, embarrassingly, the version I'm running on Linux is 0.9.42. I'm using version 6.0.8 of The Tools (6.1.0 is current). The only problem I've ever had switching between Linux and Windows is that the Linux FAT32 driver has twice created a path name for a book that was longer than what Windows claims is legal. Running the Calibre library check from Windows found these and I shrank the titles a little. The only inconvenience of having two versions is having two sets of settings and keeping them synced so that the interface looks the same whichever OS I'm running.

My "ereader" is Mantano Pro on a 7" Android tablet and I use Calibre Companion to transfer books. Before using Calibre Companion, I used Calibre's "Connect to Folder" feature to download books, which should work with any ereader that can be mounted as a USB drive (I know for sure that Kindles qualify).

The Guide:

1. Install Calibre

First, install Calibre for LInux. The instructions on this page worked for me. Then install The Tools from here (it's OK to link now, right?).

2. Install Wine

Next, install Wine 1.6.2. You can either install binary packages from here or (if you have developer tools installed) from source at one of the links on this page. If you download the source (wine-1.6.2.tar.bz2), the following commands will compile and install it:

Code:
tar xvjf wine-1.6.2.tar.bz
cd wine-1.6.2
tools/wineinstall
This will take a long time, even with modern hardware. It takes less than an hour on my new laptop, but I used to build it overnight.

3. Install ADE

Now install ADE 1.7.2. The install can be downloaded here. After downloading it, typing "wine setup.exe" should install it with no complaints. Wine is pretty well integrated with Linux desktop managers (I use Xfce with no problems), but if you can't find an icon or shortcut, the following command will run ADE if you installed it with all defaults:

Code:
wine "~/.wine/drive_c/Program Files/Adobe/Adobe Digital Editions/digitaleditions.exe"
At this point, ADE should also be integrated with your browser (I use Firefox and don't have to do any extra setup). Go to Adobe's sample ebook library and download something (I usually use This Side of Paradise). The browser should download the ACSM file and open it with Digital Editions.

4. Get ADE encryption keys

Now you need to retrieve your keys. I'm probably just skirting the rules by even discussing this, so if you need more detailed help, go to Alf's blog and ask there. I do want to say, though, that I have trouble getting the Linux tools to find my Wine installation, so I install the portable Windows version of Calibre using Wine just to get the keys. With Calibre under Wine, you can retrieve the keys the same way you do for Windows, but then export them to a .der file and import the keys into Calibre for Linux.

At this point, you should be able to select "Add Books" from Linux Calibre, browse to "My Digital Editions" in your home directory and find the file for This Side of Paradise. If everything has gone well, you should be able to open it in Calibre.

Without adding anything else, you can now buy books from eBooks.com and Kobo (as long as there's a download link). Now let's add Barnes & Noble and Amazon.

5. Install NOOK Study and get Barnes & Noble encryption keys

NOOK Study will run (albeit slowly) under Wine and can be used to retrieve your B&N key. The installer can be downloaded here. Instructions for retrieving the key can be found at Alf's blog (not trivial, but easier than everything else on this page). NOOK Study can then be used to download your books, but I recommend instead using the BN-Dload script for Greasemonkey (it also works with Chrome and Tampermonkey).

6. Install K4PC and get Amazon encryption keys

Now we can add Amazon. Download Kindle4PC here and install it with Wine. It should install just fine and allow you to login to your Amazon account. Then run Windows Calibre in Wine to retrieve the new K4PC key, export it to a .k4i file and then import it into Linux Calibre. You should then be able to use the K4PC application to download a book and then import it into Calibre. If possible, pick a book from a major publisher so you know that it has DRM on it and that you're exercising the de-DRM modules.

7. Stupid Kobo and their kepubs

As far as I know, the only store with books that are still locked to Linux-only is Kobo. Anything from Kobo that doesn't have a download link requires the Kobo desktop application, which doesn't work for me in Wine. Additionally, the Obok plugin that's needed doesn't work for Linux (I suspect it would work in Wine, but haven't tried it).

8. Connect and manage your Kindle or whatever

Now that you can import books, let's get them onto your ereader. I'm going to assume that you've got a Kindle, but the following directions can be adapted to pretty much anything. I'm trying them out on my actual Kindle (which hasn't been given a firmware update in Odin knows how long and needed to be charged up), so they shouldn't be too far off.

Once you connect your Kindle to your PC with a USB cable, I'm assuming that your Linux distribution automatically mounts it as a USB drive. I don't have mine set up to do auto-mounting, so I'm not sure where the mount point will be on yours. If you need to figure that out, let me know and I'm sure we can get it taken care of. If you find the mount point, Kindle stores its books in the "documents" directory under that. On my system, I mount my Kindle at "/mnt/kindle" with the following command (as root):

Code:
mount -t vfat /dev/sdb1 /mnt/kindle -o umask=0
I'll assume (very probably incorrectly) that your Kindle is mounted at the same place. In Calibre, go to "Connect/Share" and select "Connect to Folder". Browse to "/mnt/kindle/documents". This is personal preference, but I recommend that you now create a new folder here named "Calibre" (so, /mnt/kindle/documents/Calibre) and then browse into that. Now you can use Calibre to transfer books to and delete from this folder. Now go to the "Device" menu and "Eject Device". Finally, unmount the drive through whatever interface your Linux distribution gives you (I type as root "umount /mnt/kindle"). Unplug your Kindle from your computer and you should see all of your new books on the front page of your Kindle.

9. Conclusion: Windows is pants

During the process of writing this post, I actually performed all of the steps that I outlined above, so I know that they all work right now. Since I didn't update my Calibre to the latest version, I guess I can only verify for certain that it will work with 1.xx, but I have no reason to think that it won't work with 2.xx. If any of the steps that aren't DRM-specific need to be fleshed out more (actual commands to type, etc.) or anyone needs to hear more reasons why Windows totally eats it, let me know.

Last edited by Difflugia; 12-31-2014 at 08:01 PM. Reason: Typo
Difflugia is offline   Reply With Quote