Linux

Remove DRM from Kindle Books

I recently found myself in a bind for law school – I have to read 150 pages by Monday of a novel for a class.  I was driving to Georgia over the weekend and realized 8 hours in the car would be perfect.  However, I struggled to get the book I needed downloaded and converted.  I have a Windows machine but am a Linux user.  I needed to get the Kindle de-DRM functions working in Linux so I could listen to the book I purchased.  By the way – I now own the paperback ($14), the Barnes and Noble version ($12.99) and the Kinde version ($12.99).  I have $42 invested and feel ensuring I can listen to this book is well justified.

The following instructions are for Calibre and Linux.

Linux.
1) Install Calibre.  Choose software updater in Linux and install Calibre.
a) Open Calibre and ensure all looks OK.
2)  Go to Alf’s Apprentice Blog and download the latest DRM tools
a) Download the zip file and unzip it.
3) Install Wine on the Linux machine —https://wiki.winehq.org/Ubuntu
a) If your system is 64 bit, enable 32 bit architecture (if you haven’t already):
sudo dpkg –add-architecture i386
a) add-apt-repository ppa:ubuntu-wine/ppa
b) apt-get update
c) apt-get install wine1.7
d) Launch Wine Configuration
e) Follow the prompts: Wine configuration setup will ask to install the missing Wine dependencies in order to complete its setup to configure wine on the system. Most probably it requires wine Gecko installer and wine Mono installer.
f) Run “Configure Wine”, which will set up the default ‘wineprefix’
5) Run winetricks, select the default wineprefix and install component vcrun2008
6) Follow the following Linux instructions below:
——————————————————————————————–
Download all of the following to a folder
a) Download Kindle for PC
b) Adobe Digital Editions 1.7.x from http://helpx.adobe.com/digital-editions/kb/cant-install-digital-editions.html.  (Adobe Digital Editions 2.x doesn’t work with Wine.)
c) ActivePython 2.7.X for Windows (x86) from http://www.activestate.com/activepython/downloads
d) PyCrypto 2.1 for 32bit Windows and Python 2.7 from http://www.voidspace.org.uk/python/modules.shtml#pycrypto (PyCrypto downloads as a zip file. You will need to unzip it.)
7) Run the mis-named “Uninstall Wine Software”, which also allows installation of software.
 a) Install Kindle for PC. Accept all defaults and register with your Amazon Account.
 b) Install Adobe Digital Editions. Accept all defaults and register with your Adobe ID.
 c) Install ActiveState Python 2.7.x. Accept all defaults.
 d) Install PyCrypto 2.1. Accept all defaults.
8) Don’t do anything yet — we did the easy part.  Now we need to run the script to get the Kindle Key
Hidden away in the Help button of the keys under customize plug is this information.
a) Open Calibre
b) ChoosevPreference
c) Choose Plugins
d) Choose File Type Plugins
e) Choose DRM —
f) Click Customize Plugins and click help to see this text:
First, choose Preferences, then plugins.  Click File Input,
Linux Systems Only
Generating decryption keys for Adobe Digital Editions and Kindle for PC. If you install Kindle for PC and/or Adobe Digital Editions in Wine, you will be able to download DRMed ebooks to them under Wine. To be able to remove the DRM, you will need to generate key files and add them in the plugin’s customisation dialogs.

To generate the key files you will need to install Python and PyCrypto under the same Wine setup as your Kindle for PC and/or Adobe Digital Editions installations. (Kindle for PC, Python and Pycrypto installation instructions in the ReadMe.)Once everything’s installed under Wine, you’ll need to run the adobekey.pyw script (for Adobe Digital Editions) and kindlekey.pyw (For Kindle for PC) using the python installation in your Wine system. The scripts can be found in Other_Tools/Key_Retrieval_Scripts.Each script will create a key file in the same folder as the script. Copy the key files to your Linux system and then load the key files using the Adobe Digital Editions ebooks dialog and the Kindle for Mac/PC ebooks dialog.

9) So….easiest thing to do is go to the folder within your DRM zip folder and copy the kindlekey.pyw script over to your Wine Python folder.  Home/your name/.wine/drive_c/Python27/
a) Drop the kindle key in that folder
b) Choose “Open Folder in terminal”
c) Type wine python kindlekey.pyw
d) Take the key file that is generated and copy it back to your DRM folder.
10) Open Calibre, if closed from above, and go to plugin customization, choose Kindle for PC and Import Data Key.  Choose the key.
11) Close Calibre
12) Go to Kindle for PC – log in and sync your books.  You will see the .azw files under My Documents\My Kindle Content
13) Open Calibre
14) Choose Add Books and browse to the kindle folder to import the books.  Next, choose Convert Books and convert to epub format.
15) I then open the calibre path and cut and paste the converted books to my dropbox.  Now, they are available on my android and I can pull them into Moonreader.

Logitech H820e Wireless Headset and Linux Mint

I recently got a new Logitech Wireless Headset so I could use a soft phone (Bria), Google Hangouts, and Skype more effectively at work.  Out of the box there was nothing to do other than plug the headset into the USB and immediately I had audio.  Of course, not everything worked.

Working:

  1. Volume up and down worked no problem

  2. Audio and Sound working

Not Working:

  1. Phone call pick up button
  2. Microphone mute — disables the mouse and takes control of the mouse event handler
  3. And…a lot of white noise.

The fixes:

White Noise

The first issue reported today was I had much white noise. I opened the sound settings in Linux and saw that I have three microphones and three speakers. On the input side I clicked on the built in microphone and turned it off. Second, I click on the Analog microphone and muted it.  Finally, I clicked on the headset microphone and change the gain with a colleague listening in and letting me know when it sounded correct.

Mouse Handler

This issue was more problematic for me as I could not mute the microphone at first, then that started working. However, once muted  the mouse on the machine would no longer work. After some research I found these links that gave some insights. My fix is at the end.

Unity looses mouse click handler when using enabling USB headset

[SOLVED] No mouse left-click with USB headset GN9350e

I am running Linux Mint 17.3.  Thus, from the instructions above I have no /etc/X11/xorg.conf.d folder.  But, combining the information from the first support thread I made a file in the /usr/share/X11 folder.  Instructions are as follows:

  1. Open a terminal window
  2. type “lsusb” and press enter
  3. Locate the device in question…for me it is the logitech.  The line looks like this:
  4. Bus 003 Device 002: ID 046d:0a49 Logitech, Inc.
    1. NOTE the ID: 046d:0a49
  5. Browse to your /etc/X11/xorg.conf.d folder
  6. Right click and choose “Open as Root”
  7. Right click and choose “Create new Document”
  8. Choose “Empty Document”
  9. name the document something like “50-LogitechInc.conf”
  10. Paste the contents below into the file and then SAVE the file.  Make sure to name the Identifier to match your hardware (I used the Logitech definition) and paste in your USB ID properly.  My file looks like this:

Section “InputClass”

Identifier “Logitech, Inc.”

MatchUSBID “046d:0a49”

Option “Ignore” “on”

EndSection

Converting an ACER C720 to full Linux Mint

Previously I wrote about using Crouton with your Chromebook to run Linux.  This tutorial will walk you through the original process Build a Rockin $100 laptop.

My needs changed though, I needed far more hard disk space than the original 16 GB that came with the Acer Chromebook.  The process below is basically a $40 upgrade and about three hours of work.

Linux Mint on a Chromebook (acer C720)

this blog covers several topics:
1. Making a recovery boot disk
2. Installing a new SSD in an ACER C720
3. Installing Linux Mint and getting the machine back to a “zero state” for use
4. finally installing any extra tools

1) There are plenty of sites that detail making a recovery disk in Chrome. This is the first step before doing anything!! You must have made a recovery disk so you can restore Chrome to the new hard disk. And if all goes bad so you have a place to return to.

2) Installing the new SSD
I purchased a 128 GB SSD for my Chromebook. The key is to ensure it is 42mm and the format is NGFF. Approximate cost in January 2016 $52 from Amazon. I used the instructions found here to change out the SSD. In short follow these steps (http://www.androidcentral.com/how-upgrade-ssd-your-acer-c720-chromebook?pg=5#content)
1. Sync drop box and anything else that may be on your Linux Chroot
2. Make sure you left nothing!
3. Make a recovery disk
4. Shut down the computer
5. Remove the 13 screws and back
6. Swap out the drive
7. Reassemble the computer

I turned on my computer and came back to the developer (red explamation mark) screen. I returned the laptop to normal recovery mode (yellow explanation mark). However I hit my first SNAFU when the SanDisk 8gb recovery disk would not read. I have a 16gb USB I am going to use instead. I am on a separate Linux Mint machine following the google instructions in a Linux console terminal.

Just in case you need a USB Drive from terminal:
1. Find what the drive is called. You’ll need to know what the drive is called to mount it. To do that fire off:
1. sudo fdisk -l (L not one)
2. You’re looking for a partition that should look something like: /dev/sdb1. Remember what it’s called.
2. Create a mount point
1. Create a new directory in /media so you can mount the drive onto the filesystem:
2. sudo mkdir /media/usb
3. Mount!
1. sudo mount /dev/sdb1 /media/usb
2. When you’re done, just fire off:
3. sudo umount /media/usb

Finally! It took several tries to make a working recovery disk. Once I had it installed and Chrome recovered I was able to log into my chromebook with a 128GB SSD! It works…

Now it is time to customize and turn it into a Linux Mint box.

3) Installing Linux Mint.
1. Setup the system for developer mode using google’s documentation
1. Boot into Developer mode#
1. Make sure the Chromebook is turned off
2. Hold Escape and Refresh and tap the Power button
3. When the device reaches the recover screen, press Ctrl+d and then (after releasing Ctrl+d) press Enter
4. The system will reboot (this will take some time)
5. Press Ctrl+d again.
6. Once you reach the Google login screen, do NOT log in
7. Press Ctrl+alt+ → (not the right cursor key, but the key where the standard F2 key would be)
2. Setup SeaBios
1. Get to a shell by pressing CTRL-ALT-RightArrow (basically the former F2 key)
2. Login with root (use root as the password)
3. Type in crossystem dev_boot_usb=1 dev_boot_legacy=1
4. Type in reboot (system will reboot)
3. Create a Linux Mint bootable USB (see other details)
4. Once it comes to life, you’ll see the regular “Yellow Exclamation” screen, during which you can press CTRL-L
5. You’ll get a prompt asking you to press ESC to change boot sequence, go ahead
1. At this point you should see the Linux Mint boot screen, press TAB
2. replace — with mem=1G
6. Now you are in!! Click on the installlation disk to install Linux Mint.

Setting up the machine for use….I copied and pasted some of this from a prior blog. It is exciting to have a new, clean machine. This is how I configured for my requirements.

1. First things first the machine rebooted and I connected to wifi. Remember hit ctrl+L at the main screen to get started.
2. I checked my file system and noted I have 107 GB of free space.
3. Turn the firewall on
1. You can either go looking for “gufw” in the Software Manager, or alternatively, paste this into your terminal:
1. sudo apt-get install gufw
2. To turn your firewall on, search in your Whisker Menu for “firewall” or “gufw”. Firewall Configuration will                 come up. Click on that, turn it on, and you’re away.
4. Basic updates
1. Next, I clicked the update manager and pulled all Mint related updates and installed. This was nearly 500MB of        updates.
2. http://www.linuxmint.com/rel_qiana_cinnamon_whatsnew.php
1. Change the software sources
1. This should be done next. Simply go to the Menu, run your mouse up to Administration and select ‘Software Sources’
2. Update Manager – update all files
1. sudo apt-get update

3. Driver Manager – update all files

4. Ubuntu Restricted
1. go to software manager
2. type ubuntu restricted and install
3. Turn on the firewall
1. sudo apt-get install gufw
2. Open firewall and set information

4. VLC Media Player – from software center

5. Keyboard shortcuts
1. System Settings from start menu
2. Keyboard
3. https://sites.google.com/site/installationubuntu/chromebook-acer-720p/acer-c720-keyboard-mapping

6. Get Some Wallpaper
1. Setup the desktop changer to work

7. Get Flashplayer

8. sudo apt-get install flashplugin-installer

9. My personal list
1. Install the printer driver and test
2. Install Google Chrome and log
3. Install Dropbox
4. Install Everpad or Nixnote
5. Install skype

6. install unetbootin
1. if you get the extlinux error then run this command:
1. sudo apt-get install extlinux

7. Install Okular for reading PDF Files

8. Power Management for Laptop
1. sudo apt-add-repository ppa:linrunner/tlp
2. sudo apt-get update
3. sudo apt-get install tlp

9. Libre Office came installed….configure
1. Spelling and Grammar
1. http://extensions.libreoffice.org/extension-center/languagetool

2. Configure Fonts
1. Go to your Software manager and search for ttf-mscore
2. Reboot your PC or restart Libreoffice (including the Quickstarter if you are using that)

3. Then you can set the Times font and any point size you need.

10. Install Wine
11. Install Calibre
10. Programming
1. Install MariaDB
1. Start the database the first time
1. mysql -u root -p
2. Install ProgresSQL (ugh)
3. Install MySQLWorkbench
1. Download and install from the web site to get the latest version
4. Install monodevelopment
1. Download and install from the software manager
1. monodevelopment complete
2. monodevelopment developer
3. monodevelopment xsp4
5. Install php
1. http://www.it-iss.com/mysql/phpcrud-for-mysql/
2. Install the phpCrud script

Linux – trying something new

The excitement of a new operating system used to get me enthused.  However, Microsoft crushed that years ago, maybe right after the Rolling Stones sang the introduction to Windows 95.  It’s been a long time since I took time to configure a computer and install an operating system. Welcome to Linux.

I recently became fascinated with the idea of resurrecting an old computer and using Linux to do so. One, I could use the computer that was sitting dormant. Two, it would  give me a chance to finally experiment with this operating system I’ve heard of.  Three, I am curious about playing with the raspberry pi.

The installation of Linux Mint was not too difficult. However I say that only after knowing what I went through to figure out how to successfully install the program.

The hardest part was getting a successful download. I did try to download other versions of Linux with no success.  During the installation, and I am still not sure where I went wrong,  I managed to lose my Windows boot capabilities.  I can see a partition hard drive when the system comes back up but I do not understand why. So my advice is the very very careful during the install.

I am NOT ready to try to do it on another computer for fear of repeating whatever mistake I made. Fortunately though, the data is still there.

The small netbook run much faster and overall I am impressed with Linux. Even more impressive though is that it comes with all the tools I need to run and no additional cost.