[Nexus 4 Q&A, Help & Troubleshooting] picodot:
Nexus 4 Root via Linux Notes

I rooted my Nexus 4 with my Linux machine (Linux Mint) earlier today. I had a couple hiccups, notably:

If you download the 64-bit/x86_64 version of ADT (Android Developer Tools, i.e. adb/Eclipse/etc. for Android development), the executable tools such as adb and fastboot are actually 32-bit. If you have a relatively fresh Linux install, you need to install the 32-bit executable binaries (see note below). Otherwise you will get strange errors even though the files are marked executable.

I sometimes had issues with my computer connecting to the phone via USB, especially after rebooting the phone. I found simply swapping USB ports (switching between the mouse and the phone, for example) would cause the phone to be recognized again.

Otherwise the process was smooth.

Here are the notes I collected as I searched the forums and web for how to root the phone in case they are helpful to someone. They're not really in any particular order; it's just a collection of what I found.

I used the following instructions:

http://makegadgetswork.blogspot.com/2013/01/root-nexus-4-on-linux-mint-13-and.html

# It had been so long since I used my personal Linux box that I
# forgot the root password :).
# Reset root password and main user password
http://community.linuxmint.com/tutorial/view/339

# Boils down to:
1) Enter grub by holding down shift key during boot.
2) Change:
linux /boot/vmlinuz-3.0.0-12-generic root=UUID=[letters and numbers]\[letters and numbers] ro quiet splash vt.handoff=7
to:
linux /boot/vmlinuz-3.0.0-12-generic root=UUID=[letters and numbers]\[letters and numbers] rw init=/bin/bash

# In x86_64 disto of ADT (Android Developer Tools), ADB libs are 32-bit.
#
# Running the 32-bit libs without 32-bit support will cause strange errors
# such as 'adb: No such file or directory'
#
# Here is how to install 32-bit binary runtime support on your 64-bit OS:
apt-get install ia32-libs

# Also install Java:
apt-get install sun-java6-jdk

# How to mount Nexus 4 in Linux
http://xdaforums.com/showthread.php?t=2004182

# How to backup phone prior to unlocking (unlocking will cause a factory reset)
http://xdaforums.com/showpost.php?p=34744848&postcount=4

# Linux root guide (this is what I followed)
http://makegadgetswork.blogspot.com/2013/01/root-nexus-4-on-linux-mint-13-and.html

# Another good root guide (Windows oriented)
http://xdaforums.com/showthread.php?t=2018179

# Linux root guide on XDA
http://xdaforums.com/showthread.php?t=35217628

# Root guides (didn't really use these)
http://www.cultofandroid.com/23782/rooting-the-google-nexus-4-the-right-way-how-to/
http://xdaforums.com/showthread.php?t=2010312&highlight=+waiting+for+device+

# How to fix Android devices not recognized by ADB
# (check that ~/.android is not owned by root)
http://www.tuxtrix.com/2013/03/how-to-fix-android-devices-not.html

# SuperSU download link:
http://download.chainfire.eu/282/SuperSU/

# CWM link:
http://www.clockworkmod.com/rommanager

# Setup device support for N4
sudo vi /etc/udev/rules.d/51-android.rules

# My /etc/udev/rules.d/51-android.rules

> cat /etc/udev/rules.d/51-android.rules
#LG - Nexus 4 - MTP (mount as media device)
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"

# Bootloader Nexus 4
SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4ee0", MODE="0660", OWNER="ankit"

# Normal Nexus 4
SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4ee1", MODE="0660", OWNER="ankit"

# Debug & Recovery Nexus 4
SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4ee2", MODE="0660", OWNER="ankit"

# Aliases to mount device as MTP
alias n4_mt 'sudo mtpfs -o allow_other /media/nexus4'
alias n4_umt 'sudo umount /media/nexus4'

# File that contains USB/device settings for N4
/etc/udev/rules.d/51-android.rules

# Restart devices
sudo service udev restart

# Print USB devices
lsusb

# Print ADB help
adb

# Print connected devices
adb devices

# Print device serial number
adb get-serialno

# Print device state
adb get-state

# Restart ADB server
adb kill-server ; adb start-server

# Restore sdcard backup
adb push ~/n4_bak_7_28/sdcard /sdcard/

# Reboot device to bootloader mode (needed to run fastboot)
adb reboot bootloader

# Reboot device to recovery (needed for flashing partitions (i.e. custom recovery, ROM)
adb reboot recovery

# Restore backed up data
adb restore ~/n4_bak_7_28/backup.ab

# Run shell on device
adb shell

# Show devices connected to fastboot
sudo fastboot devices

# Unlock phone (must be running in bootloader mode)
sudo fastboot oem unlock

# Flash custom recovery
sudo fastboot flash recovery /home/femtodude/install_adb/adt-bundle-linux-x86_64-20130717/sdk/platform-tools/recovery-clockwork-touch-6.0.3.4-mako.img