Skip to content

Instantly share code, notes, and snippets.

@nv1t
Last active March 20, 2024 02:08
Show Gist options
  • Save nv1t/c9297e33af5363d995cac2ee379f18ae to your computer and use it in GitHub Desktop.
Save nv1t/c9297e33af5363d995cac2ee379f18ae to your computer and use it in GitHub Desktop.
Convert ACSM files to DRM-free EPUB files with one command on Linux

(Source: https://pythonrepo.com/repo/BentonEdmondson-knock-python-command-line-tools)

This software does not utilize Adobe Digital Editions nor Wine. It is completely free and open-source software written natively for Linux.

For NixOS User

  1. Create a free Adobe account here if you do not already have one.
  2. Install the software. For NixOS, include this flake in your system flake.nix. Then run knock ~/path/to/my-book.acsm to use.
inputs.knock.url = github:BentonEdmondson/knock
outputs = { self, knock }: { /* knock.defaultPackage.x86_64-linux is the package */ }

For non-NixOS

Use the latest release. It is large because it includes all dependencies, allowing it to run on any system with an x86_64 Linux kernel. It was built using nix bundle. Use it by doing the following: Download knock-version-x8664-linux and open a terminal

  • Navigate to the folder within which knock-version-x86_64-linux resides (e.g. cd ~/Downloads)
  • Run mv knock-version-x86_64-linux knock to rename it to knock
  • Run chmod +x knock to make it executable
  • Run ./knock ~/path/to/my-book.acsm to convert the ebook

If you receive an error that says something like ./nix/store/...: not found or ./nix/store/...: No such file or directory then you might not have user namespaces enabled. Try running the following to fix it:

# echo "kernel.unprivileged_userns_clone=1" >> /etc/sysctl.conf
# reboot

Enter in your Adobe email and password when prompted

Optionally move the executable to ~/bin (for your user) or /usr/local/bin/ (for all users) to allow it to run from anywhere (might not work on some distributions)

Verified Book Sources

Knock should work on any ACSM file, but it has been specifically verified to work on ACSM EPUB files from the following:

  • eBooks.com
  • Rakuten Kobo
  • Google Books
  • Hugendubel.de (German)

The resulting EPUB file can be read with any EPUB reader.

Legality

It's Perfectly Legal to Tell People How to Remove DRM (Gizmodo)

Do not use this software for piracy; this software is not intended for piracy. This software exists to allow readers to legally purchase and then legally and freely read ebooks. I suspect that the significant prevalence of ebook piracy is caused in large part by the restrictions put on legally purchased ebooks. This software exists to incentivize the legal purchase of ebooks by enabling their unrestricted and legal consumption.

@helphelpplease
Copy link

Hi, the above "Use the [latest release]" link aka (https://github.com/BentonEdmondson/knock/releases) is 404. Do you by chance have the release somewhere ?

@nv1t
Copy link
Author

nv1t commented Aug 7, 2023

@helphelpplease
Copy link

thanks

@TechLauren
Copy link

I would like to download knock-version-x86_64-linux but cannot find a working link to it anywhere.

@nv1t
Copy link
Author

nv1t commented Mar 19, 2024

Unfortunately i think you will only get the files and have to build it yourself.

@TechLauren
Copy link

TechLauren commented Mar 20, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment