01.12.2015 13:25

Rooting Google LG Nexus 4

Brief description of how to root LG Nexus 4 with probably any Android version (tested on 5.1.x) using Linux, but those steps are very general for most of Nexus devices.

Connect with USB cable to PC with Linux (Fedora).

Enable Developer Options on Nexus:

Install android-tools if you do not have them:

dnf install android-tools

You may need to add your device vendor and product id into ~/.android/adb_usb.ini

# adb devices
List of devices attached
18a58702a252b7e6        unauthorized

Optional backup:

adb backup -apk -all -f 20151201.backup

Power off your Nexus 4 device.

Boot it into Fastboot mode by pressing the Volume down and Power button.
Screen shows the “Start” text.

# fastboot devices
18a58702a252b7e6        fastboot


Unlock bootloader (All data lost!):

# fastboot oem unlock
...
OKAY [ 34.627s]
finished. total time: 34.627s

Reboot phone.

Install MTPFS:

dnf install simple-mtpfs

Mount MTP:

simple-mtpfs /mnt/

Download SuperSU: http://forum.xda-developers.com/showthread.php?t=1538053

Download Clockwork recovery: http://forum.xda-developers.com/nexus-4/development/recovery-official-cwm-recovery-6-0-4-7-t1995440

Copy them to /mnt/

umount /mnt/

Boot CWM recovery:

fastboot boot recovery-clockwork-6.0.4.7-mako.img

Alternatively flash it:

(fastboot flash recovery recovery-clockwork-touch-6.0.4.7-mako.img)
(Choose the recovery mode option from the fastboot menu.)

Use Up/Down/Power button to search for the “flash zip from SD card” in recovery, followed by “choose zip from SD card”.. "0"
Browse to SuperSU package. Install it.
Reboot system now from menu.
Yes to fix root.

Optional restore backup:

adb restore  20151201.backup

Open Play store
Install Busybox
Install Terminal Emulator

Refs:

http://dottech.org/179248/how-to-root-nexus-4-on-android-5-1-lollipop-lmy47o-guide/


Installing Lineage OS

Suddenly every boot the phone printed "Android starting", "Optimising xx of xxx" - this took almost 20minutes, draining the battery and making the phone hot. I did not found any solution to that - if I should use the ultimate factory reset, then I decied to switch to Lineage OS

Here is a howto

https://wiki.lineageos.org/devices/mako/install

Generally I have the phone rooted so I did just

fastboot boot recovery-clockwork-6.0.4.7-mako.img
Wipe Cache, System and Data
adb push lineageos*.zip /sdcard/
adb push open_gapps_nano*.zip /sdcard/
adb push addonsu*.zip /sdcard/
Install zip files form sdcard

With Android 7 attaching a phone to PC is not automaticaly setting it to MTP mode, but charging only. You have to click on the "charging" message and change to MTP to get to the internal storage.

Email comment