Kindle touch with ssh to wi-fi enabled

Lately, I’ve spent quite a lot of time playing with my Kindle. The motivation was mostly its sloppiness – after having it for 1.5 year, my Kindle became very slow and unresponsive… I decided to factory reset it. And while doing it, I’ve checked if I maybe the jailbreak of newer firmware is possible (last time I’ve checked over a year ago it wasn’t).
To my big joy, I found these days it’s fairly easy to jailbreak any kindle by downgrading it’s firmware.
But this isn’t the focus of this post. Here I would like to share my experience with enabling ssh access to my Kindle. Why anyone would do that? Kindle is ARM-processor powered computer with Linux installed. So having SSH access, you can setup your Kindle to do lots of useful stuff. But about that, I’ll write in the next posts 😉
Here is how to proceed:

  1. Jailbreak your Kindle
  2. Install KUAL & Mobileread Package Installer (MrPI)
  3. Install USBNetwork Hack
  4. Create new user account in Kindle for SSH access
  5. # get dev name from udev
    dmesg | grep usb0
    
    # bind
    sudo ifconfig enp0s20u8 192.168.15.201
    
    # telnet
    telnet 192.168.15.244
    
    # mount root with write access
    mntroot rw
    
    # create new user
    mkdir -p /home
    adduser USER
    
    # make it root by changing USERID to 0 in <code>/etc/passwd</code> ie. 
    USER:x:0:0:root,,,:/home/USER:/bin/sh
    
    
  6. Start sshd and enable port 22 for SSH temporarily
  7. This is only to check if SSH is possible. So far we didn’t make any serious changes 😉

    /mnt/us/usbnet/sbin/sshd -f /mnt/us/usbnet/etc/sshd_config
    iptables -A INPUT -p tcp --dport 22 -j ACCEPT
    

    Now try to login to your Kindle by SSH. You can find its IP by executing ifconfig. Proceed only if SSH works for you.

  8. Enable port 22 for SSH
  9. # add below line to <code>/etc/sysconfig/iptables</code> to enable SSH access
    -A INPUT -p tcp --dport 22 -j ACCEPT
    
  10. Add sshd to upstart
  11. Create new file /etc/upstart/sshd.conf

    # ssh - OpenBSD Secure Shell server
    #
    # The OpenSSH server provides secure shell access to the system.
    
    env LOGFILE=/tmp/ssh.log
    
    description     "OpenSSH server"
    
    start on dbus_ready
    stop on stopping dbus
    
    respawn limit 2 5
    umask 022
    
    pre-start script
        test -x /usr/sbin/sshd || { stop; exit 0; }
        test -e /etc/ssh/sshd_not_to_be_run && { stop; exit 0; }
        test -c /dev/null || { stop; exit 0; }
    end script
    
    script
        # if you used to set SSHD_OPTS in /etc/default/ssh, you can change the
        # 'exec' line here instead
        echo `date` "Starting sshd..." >> $LOGFILE 2>&1
        /mnt/us/usbnet/sbin/sshd -f /mnt/us/usbnet/etc/sshd_config >> $LOGFILE 2>&1
    end script
    
  12. Disable auto updates
  13. mv /etc/uks /etc/uks.disabled
    

Now SSH should work after Kindle reboot 🙂

Enjoy!

Mount USB drive in RPi2

By default, RPi2 limits power supply of USB ports to 0.6A, while most USB drives require more than that. This is why most USB drives cannot be used with RPi2 without external power supply to RPi2. Luckily, given that you have decent power supply (ie I have 2A charger), you can increase USB port max current, by editing `/boot/config.txt`.

IMPORTANT!!! RPi2 allows max 1.2A current through all 4 USB ports combined, so don’t even think about plugging two USB drives!!! This is because the maximum power allowed into the RPi2 is limited to 2A by the fuse (F1) so if one of your USB device draw 1A, then that leaves 1A for the RPi + GPIO + remaining USB devices.

First, check if your drive can be detected without tweaking

sudo blkid

If you see only mmcblk0 entries, this means that your drive is not recognised.

/dev/mmcblk0p1: ...
/dev/mmcblk0p2: ...
/dev/mmcblk0: PTUUID="d2fd971c" PTTYPE="dos"

Add max_usb_current=1 to /boot/config.txt:

Reboot and check if your USB drive is visible after restart:

sudo reboot
sudo blkid

Now, you should see new entry:

/dev/mmcblk0p1: ...
/dev/mmcblk0p2: ...
/dev/mmcblk0: PTUUID="d2fd971c" PTTYPE="dos"
/dev/sda1: LABEL="turo"...

And you should be able to mount it:

sudo mkdir -p /media/turo
sudo mount /dev/sda1 /media/turo

Inspired by www.htpcguides.com and www.raspberrypi.org/forums.