Rooting my Moto E2 (Otus)

Phone model: Moto E 2nd Gen Dual Sim 3G (XT1506)
Codename: Otus
For specs check here

1. Enable USB debug (adb) in phone
Click About > Build number seven times. Developer Options menu appears and enable USB debugging. Connect the phone to the PC.

2. Setup adb and fastboot in PC (Fedora)

[root@localhost ~]#  dnf install android-tools

[root@localhost ~]# adb start-server
[root@localhost ~]# adb devices
List of devices attached
[none is displayed]

Phone not detected. Set up the adb. (Check this tutorial for explanations on below steps)

Create the file /etc/udev/rules.d/99-android-debug.rules as root and and add the line
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", ATTR{idProduct}=="2e83", GROUP="androiddev", MODE="0664"

[root@localhost ~]#  groupadd androiddev
[root@localhost ~]#  usermod -aG androiddev tony

Log off and log in

[root@localhost ~]#  udevadm control --reload
[root@localhost ~]#  systemctl restart systemd-udevd.service

Disconnect and reconnect phone.

[tony@localhost ~]# adb devices
List of devices attached
TA05409C3Z    unauthorised 

Phone is detected, but shown unauthorised.
Check phone and click OK to accept the notification for permission for adb from this computer.

[tony@localhost ~]$ adb devices
List of devices attached
TA05409C3Z    device


3. Unlock the bootloader

This factory resets the phone. Images, apps, settings and other data will be lost.

Go To Settings > Developer options, And Select Allow OEM Unlock

[tony@localhost ~]$ adb shell
[tony@localhost ~]$ adb reboot fastboot

[tony@localhost ~]# fastboot devices
TA05409C3Z    fastboot
[tony@localhost ~]$ fastboot oem get_unlock_data
(bootloader) 3A35230386907906#54235755323039
(bootloader) 52335A004F746F4FF4G5000000#3813
(bootloader) 73DDAE8FF6037D2H3HBJE39DJB31DDB
(bootloader) 42894#887A8E0812000000000000000
(bootloader) 0000000
OKAY [  0.222s]
finished. total time: 0.222s

Copy the string returned. Remove space(if any) and combine the lines.
Sign in to this motorola page using gmail account, submit the above string and get the Unlock_Key emailed to you.

[tony@localhost ~]$ fastboot oem unlock Unlock_Key
(bootloader) Phone is unlocked successfully!


(Follow these steps if you want to remove the “Bootloader Unlocked” warning image during every reboot.)

4. Flash the recovery

Using the below given recovery image for any other phone may brick it.

Download the TWRP recovery from xda-developers for Moto E XT1506 Otus

[tony@localhost ~]$ fastboot flash recovery twrp-otus-3.0.2-r5.img
target reported max download size of 299892736 bytes
sending 'recovery' (6852 KB)...
OKAY [  0.246s]
writing 'recovery'...
OKAY [  0.351s]
finished. total time: 0.597s

[tony@localhost ~]$ fastboot reboot


5. Root the phone

Download SuperSU from here and copy it to the SD Card/Internal memory.

[tony@localhost ~]$  adb reboot recovery

Check the phone, phone reboots to the above installed TWRP recovery.

Select Install and choose the SuperSU package and Swipe to install it.

Select Reboot > System

You will see the SuperSU app installed and functional!



Post installation procedure for my fedora 24

This is the detailed log of my post installation procedures for Fedora 24.

In the Settings,
In Privacy, changed Usage and History – off, Location services – off
Region and Language, added input sources Malayalam
In Search unselected everything inside
Universal Access set Large text on

Install RPMFusion
Free and NonFree
su -c 'dnf install$(rpm -E %fedora).noarch.rpm$(rpm -E %fedora).noarch.rpm'

Install FFmpeg and GStreamer
Skipped installing gstreamer-extras, other gstreamer plugins were already installed.
dnf install gstreamer1-plugins-ugly gstreamer1-plugins-bad-freeworld ffmpeg

Install Gnome Tweak Tool
dnf install gnome-tweak-tool
Enabled the Application and Places menu, Min Max buttion, Middle click lower.

Install Libdvdcss, HandBrake, Vlc
dnf config-manager --add-repo=
dnf install libdvdcss HandBrake-gui vlc

Install Flash.

Installing Chrome
Downloaded the Chrome RPM from Google.
dnf install google-chrome-stable_current_x86_64.rpm

Install Gimp, GFtp, Gparted
dnf install gimp gparted gftp

Install LM Sensors, Nethogs
dnf install lm_sensors nethogs

Disabled PackageKit automatic downloading of updates
gsettings set download-updates false

Setup Thundirbird
dnf install thunderbird
Copy the contents of the backed up profile folder (xxxxx.default) to the new profile folder
Disabled the mail downloadin Synchronising as the mails were being downloaded again.

Work on fonts/scaling
Changed the default fonts in Chrome to Serif, Serif and Sans and Size to 17.
Changed the font size in FireFox to 17.

Install Xboard
dnf install xboard
Replace the .xboardrc and .icsrc file from backup
Create a custom desktop shortcut to use Dreamer engine
Copy the XBoard.desktop from /usr/share/applications to ~/.local/applications and modify the command property with xboard -fe Dreamer

WAT and bypassing WAT

Windows 7 comes loaded with an anti-piracy system named Windows Activation Technologies (WAT).

Microsoft enforces Activation and Validation of all the instances where Windows is installed.

Activation pairs your product key (it is supplied with every legal copy) with your computer (hardware configuration) and helps to verify that your copy of Windows hasn’t been used on more computers than the Microsoft Software License Terms allow.
Activation is usually only required once unless you make significant hardware changes.

Validation is an online process where it is checked that the windows is genuine by verifying that the product key is not used on other computers or is blacklisted.
The validation process is repeated during several services like, when you use windows update, download drives from Microsoft download center etc.

If the validation fails, the user is notified about it and are instructed to buy the genuine software.

Further restrictions are also imposed, as in Windows 7,
The desktop background is set to black. It is possible to change the background buy they are reset every hour.
Reminders are given to activate the system, upon boot and also hourly.
A message is displayed on the bottom right corner stating that the windows is not valid.
Windows update is not allowed, however critical updates are allowed.

Other than these the OS functions normally.
Note that there are no mechanisms included in WAT to damage your hardware or access/delete your data.

How to bypass WAT and validate as genuine?

Use Volume Activation Keys (VAK)
Volume licensing is a method which which allows a single product key to be used for multiple installations, typically given for large enterprises.
A leaked volume activation key could be used successfully in Windows XP. But with Windows Vista Microsoft restricted the use of VAKs to a predefined number and introduced stricter activation schemes which made this unpopular since then.

Disable WAT
There are tools which disables the WAT while allowing the system to retain its Genuine status in every official check by Microsoft.
The most popular of these tools was RemoveWAT developed by Hazar.
However MS with its update KB971033 disabled it and included mechanisms designed to detect existing similar expoits.
This WAT update also contacts MS on routine basis and downloads signatures of newer exploits so that it can identify similar attacks in future.
But the latest versions of RemoveWAT (2.2.5 and later) claims to disable even this WAT update.

Simulate an OEM Product
OEM systems from large companies (Dell, Acer, HP etc) use a technique called System Locked Preinstallation (SLP). The pre-installed copy of Windows uses a single master product key tied to SLP code in the system BIOS that is unique to that manufacturer’s systems. If the encrypted licensing information in the pre-installed copy of Windows matches the information in the BIOS, no activation is required from the part of user and the system can be validated genuine.

So the trick is to included this SLP code into the BIOS, so that windows gets fooled believing that this is a regular OEM product.
This is usually accomplished either by modifying the BIOS ROM or by using a custom bootloader that injects this code into your system before loading windows.

One such software is the Windows 7 loader by Daz.

Since the software changes the bootloader there is a risk that windows might not boot. Though the author has specified fixes for it .

NOTE: If you intend to use any of the software listed above be extremely cautious. Most of the copies that you will find are modified to include nasty viruses/trojans/rootkits. If you ever download them from torrents or anyother site, please scan them at to ensure it is clean before running them.
Also i request you the verify the md5 or SHA1 checksums of the executables from the authors page.

Switching from POP to IMAP in Gmail/Thunderbird

To access your Gmail in your smart phone or tablet using the native mail app or Gmail app, and to have it synced across your different devices, IMAP is the best option.

Now, with IMAP I have all the mails in my Inbox, SentMail or Drafts synced in my Linux, Windows, Ipad and phone and also in the Gmail web interface ( perfectly.

I have been using Thunderbird with POP for years and decided to switch to IMAP finally.

I did not delete my POP accounts in the existing Thunderbird as I thought it has all my previous mails intact in case anything goes wrong.

The steps are listed here,

1. Enabled IMAP for Gmail.
Gmail > GearIcon > Settings > Forwarding and POP/IMAP > Enable IMAP and Save Changes.
by default this will be enabled usually.

All the gmail labels that you created or not (including Inbox, SentMail, Drafts etc) will be shown as folders in your Thunderbird. However, Gmail gives you the option to choose the one’s you want.

2. Selected the labels that I want to be displayed in Thunderbird.
Gmail > GearIcon > Settings > Labels and uncheck the “Show in IMAP” option of the labels that you dont want to show (you can change it anytime so dont worry).

I unchecked, Important, Chats, AllMail, and Spam. I keep all my important mails in Inbox itself so, AllMail is not needed.

Configuring Thunderbird,
I was not possible to convert the existing POP account. The method is to disable/delete the POP account and add a new IMAP account.

3. Disabled the existing account.
In Thunderbird,
Edit > Account settings > Your gmail account > Server settings
Unchecked the below
-Check for new messages at startup
-Check for new messages at ever…
-Automatically download new messages

4. Added the new IMAP account
Account Actions > Add Mail Account > Fill name, email and password > Continue > Create Account.

5. Tweaked the Thunderbird settings.
Account Settings > The newly created IMAP account > Server Settings
Check for new messages at startup – Checked
Check for new messages every 10 minutes – Checked

When I delete a message – Just mark it as deleted
Clean up (“Expunge”) Inbox on Exit – Unchecked
Empty Trash on Exit – Unchecked
(Deleted messages are automatically moved to Trash by Gmail and removed periodically)

Account Settings > The newly created account IMAP account > Copies & Folders
When sending messages, automatically:
Place a copy in – Unchecked
(Sent messages are automatically placed in SentMail folder by Gmail)

Drafts and Templates
Keep message drafts in: Other and selected the [Gmail] > Drafts
(This will make the draft appear in the Drafts folder of Gmail and so synced to every other devices)

Account Settings > The newly created IMAP account > Junk Settings
Enable adaptive junk mail controls – Unchecked
(Gmail already has junk mail filtering)

Account Settings > The newly created IMAP account > Synchronization & Storage
Keep messages for this account… – Checked
(This is required if you want offline access to your mails, Otherwise the mail is not fully downloaded until you click on the mail title)

In Advanced you can uncheck the folders where you dont want the full mail to be downloaded. A good candidate here is the Spam folder.

6. Clicked OK to save and close the account settings.

Thunderbird downloaded all the mails and it took almost an hour. I had about 1.5 GB email data.

Done!! :-)

The Linux Filesystem basics Part two

A filesystem can become ‘full’ and ‘run out of space’ either by (1) running out of all the free bytes, or (2) it can use up all the available inodes even when space is left for adding data.

Thought of making a test filesystem and check this.

We begin by making a file of size 500KB to hold our test filesystem.

[tony@localhost ~]$ su -
[root@localhost ~]# dd if=/dev/zero of=~/inodeimage.img bs=1k count=500
500+0 records in
500+0 records out
512000 bytes (512 kB) copied, 0.00167129 s, 306 MB/s
[root@localhost ~]# ls -l inodeimage.img 
-rw-r--r--. 1 root root 512000 Aug 26 22:06 inodeimage.img

Make this file a loop device to mount it as a disk and work on it.

[root@localhost ~]# losetup -f inodeimage.img    # -f assigns the first free loop device
[root@localhost ~]# losetup -a                   # list all loopdevices to see if it worked
/dev/loop0: [fd01]:33392 (/root/inodeimage.img)

Make our test filesystem using mkfs

[root@localhost ~]# mkfs /dev/loop0
mke2fs 1.41.14 (22-Dec-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
64 inodes, 500 blocks
25 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=524288
1 block group
8192 blocks per group, 8192 fragments per group
64 inodes per group

Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

Make a directory to mount our test filesystem, and mount it.

[root@localhost ~]# mkdir ~/inodetmp
[root@localhost ~]# mount -t ext2 /dev/loop0 ~/inodetmp

Check the free inodes and free space available on our test filesystem.

[root@localhost ~]# df -i ~/inodetmp/
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/loop0                64      11      53   18% /root/inodetmp   #53 free inodes
[root@localhost ~]# df -h ~/inodetmp/
Filesystem            Size  Used Avail Use% Mounted on
/dev/loop0            487K   15K  447K   4% /root/inodetmp
[root@localhost inodetmp]# ls

So 53 free inodes available. Lets fill that up by creating 53 small files.

[root@localhost inodetmp]# for i in {1..53} ;do dd if=/dev/zero of=file$i bs=1 count=1; done
1+0 records in
1+0 records out
1+0 records in
1+0 records out
1 byte (1 B) copied, 2.4928e-05 s, 40.1 kB/s

Now, lets try creating another file,

[root@localhost inodetmp]# touch newfile
touch: cannot touch `newfile': No space left on device

See that we have a lot of space remaining (393K free), but no inodes left. In essence our disk is ‘full’ and have ‘run out of space’.

[root@localhost inodetmp]# df -i ~/inodetmp/
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/loop0                64      64       0  100% /root/inodetmp
[root@localhost inodetmp]# df -h ~/inodetmp/
Filesystem            Size  Used Avail Use% Mounted on
/dev/loop0            487K   69K  393K  15% /root/inodetmp


Ok. Lets now try to fill the disk by the other method, ie, by using all the available bytes.

Remove all those files,

[root@localhost inodetmp]# rm -f *
rm: cannot remove `lost+found': Is a directory
[root@localhost inodetmp]# df -h ~/inodetmp/
Filesystem            Size  Used Avail Use% Mounted on
/dev/loop0            487K   15K  447K   4% /root/inodetmp
[root@localhost inodetmp]# df -i ~/inodetmp/
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/loop0                64      11      53   18% /root/inodetmp

We see that 53 inodes are free and 447K is available, lets make a file of that size.

[root@localhost inodetmp]# dd if=/dev/zero of=file bs=1k count=447
447+0 records in
447+0 records out
457728 bytes (458 kB) copied, 0.00132163 s, 346 MB/s
[root@localhost inodetmp]# df -h ~/inodetmp/
Filesystem            Size  Used Avail Use% Mounted on
/dev/loop0            487K  466K     0 100% /root/inodetmp

We now see that the ‘Available’ space is 0. But if you check carefully the output, we see that the disk ‘Size’ is 487K and ‘Used’ is 466K. So remaining 21K??

Lets try making another file,

[root@localhost inodetmp]# dd if=/dev/zero of=file2 bs=1K count=1
1+0 records in
1+0 records out
1024 bytes (1.0 kB) copied, 3.0609e-05 s, 33.5 MB/s

It was possible eventhough 0 space was shown available!
This is because 5% of disk space is reserved for super user use. And df doesnt show that space as available in its output. This explains the difference 21K.

Lets fill that up too,

[root@localhost inodetmp]# dd if=/dev/zero of=file2 bs=1k count=20
20+0 records in
20+0 records out
20480 bytes (20 kB) copied, 0.000121892 s, 168 MB/s

[root@localhost inodetmp]# df -h ~/inodetmp/
Filesystem            Size  Used Avail Use% Mounted on
/dev/loop0            487K  487K     0 100% /root/inodetmp
[root@localhost inodetmp]# df -i ~/inodetmp/
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/loop0                64      13      51   21% /root/inodetmp

Try adding a 1byte file, it must fail.

[root@localhost inodetmp]# dd if=/dev/zero of=file3 bs=1 count=1
dd: writing `file3': No space left on device
1+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000197034 s, 0.0 kB/s

See that we have a lot of inodes remaining (51 free ) but no bytes left. In essence our disk is ‘full’ and have ‘run out of space’.


As we have inodes remaining, It might still be possible to create empty (size 0 bytes) files.

[root@localhost inodetmp]# touch emptyfile
[root@localhost inodetmp]# ls -l
total 485
-rw-r--r--. 1 root root      0 Aug 29 15:44 emptyfile
-rw-r--r--. 1 root root 457728 Aug 27 23:05 file
-rw-r--r--. 1 root root  20480 Aug 27 23:05 file2
drwx------. 2 root root  12288 Aug 26 22:06 lost+found

I was wondering where there is space to create the directory entry for this newly created filename. It seems that the filesystem reserves some datablocks for the use of directories when the filesystem is created. If more space is needed, it is allocated dynamically from the unused datablocks, if available.

Just wanted to see how many files can made before that reserved space gets filled up in our test filesystem.
We try to make 50 empty files with 255 character long random filename.

[root@localhost inodetmp]# for i in {1..50} ; do name=`cat /dev/urandom | tr -cd 'a-f0-9' | head -c 255`; touch "$name"; done

The screen scrolled and the script terminated displaying “No space left on the disk”

As we can see below, the reserved space was over with just 3 of our empty files.

[root@localhost inodetmp]# ls -1 | wc -l
7              # 3 new files were made, excluding the existing 4.


Thankyou, if you were patient to read so far! :D I appreciate it.