Nexus 4

From Segfault
Jump to: navigation, search






After almost bricking[1] this Nexus 4, let's try to document the a restore process[2].

  • Download factory image from Google, verify the checksum
  • Reboot into the bootloader:
fastboot reboot-bootloader               # Use adb reboot-bootloader if fastboot does not work!

Or via holding Vol- while powering on the device. If this is not working either, try holding both Vol- AND Vol+ down while powering on the device.

Erase all partitions:

fastboot erase boot
fastboot erase cache
fastboot erase recovery
fastboot erase system
fastboot erase userdata

Flash with the stock image:

fastboot flash bootloader bootloader-mako-makoz20i.img
fastboot reboot-bootloader

fastboot flash radio radio-mako-m9615a-cefwmazm-2.0.1700.84.img
fastboot reboot-bootloader

fastboot -w update

The last command should also reboot the device.

Additionally, if we want to lock the device again:

fastboot oem lock
fastboot reboot-bootloader


Installing CM on the Nexus 4[3] was pretty straightforward.

The device needs a custom recovery image, see above. Once this is installed, we can install CyanogenMod.

  • Download CyanogenMod[4]
  • Download SuperSU, to enable root access[5]
  • Download Google Apps, if needed[6]
adb push /sdcard/
adb push UPDATE-SuperSU-v*.zip /sdcard/
adb push gapps-kk-**.zip /sdcard/

Be sure to verify the checksums of these files!

Boot into the bootloader:

adb reboot bootloader
  1. Select "Recovery", we should now be in our recovery mode.
  2. Select "wipe" or "factory reset"
  3. Select "install from SDcard" and then point to the CyanogenMod zip file - and select install
  4. Repeat 4) for other zip files as well (the GoogleApps or the SuperSU package)
  5. Reboot the phone, now CyanogenMod should boot.


  • As CyanogenMod comes up, it might ask if we want to run "Launcher" or "Launcher3". Apparently, "Launcher" has more Google features and "Launcher3" seems to be its basic variant[7]
  • As documented in the CyanogenMod wiki[8], some features might not work with:
    • In low signal zones (remote house at the mountain for example) CM 10.1.3 mako on Nexus 4 throw a song and 2 vibrations when the null signal notification appears.
    • Native camera app is not available, photosphere feature is not available too.
    • Impossible to take normal photos using flash. Camera app is usable only for daylight photography.
The last two issues apparently have been fixed, but the Wiki cannot be edited at the moment to document that.[9]


To update an encrypted device, we have to take a few precautions because we have to decrypt the device before we can update the operating system. The easiest way is to use adb sideload:

Select Wipe Dalvik Cache and Wipe Cache and select Swipe to Start Sideload:

adb push  /sdcard/
adb sideload

Reboot the phone, CyanogenMod should now be updated.

Without adb sideload, the procedure is somewhat more complex[11]. In short:

adb reboot recovery
adb shell

Mount a 500 MB tmpfs onto /sdcard:

mount -t tmpfs -o size=500m tmpfs /sdcard

Push the update image to the phone:

adb push /sdcard/

On the phone, navigate to "Install update from sdcard", select /sdcard/ we just uploaded. After the update is complete, reboot the phone.

Sometimes this doesn't work[12] and the tmpfs should be mounted over /data instead:

mount -t tmpfs tmpfs /data
mkdir /data/media

On the computer again:

adb push /data/media/

Then continue as above, but selecting /data/media/ instead of /sdcard/



With Android 4 (or CyanogenMod installed), tethering should work out-of-the-box:

Settings → Wireless & Networks → Tethering & portable hotspot → Portable Wi-Fi hotspot

→ See also Tethering

Barnacle Wifi Tether

Barnacle Wifi Tether will set up a wireless ad-hoc network. For the Nexus 4, the following options needed to be set:[13]

  • "Custom Wifi Ad-hoc" → none
  • "Skip wpa_supplicant" → enabled
  • "WAN" → <empty> or rmnet_usb0


android-wifi-tether ("Wireless Tether for Root Users") was working quite well on the HTC Sensation and it seems to work on the Nexus 4 as well.

Trying to install while connected to T-Mobile[14] resulted in "This item is not available on your carrier". However, the .apk file can be downloaded & installed manually.

Tethering only worked after setting[15] the following options:

  • Device-Profile → Generic ICS/JB (wlan0)
  • Setup-Method → Netd-Ndc (master)
  • Send Netd Max Client Cmd → enabled
  • WiFi-driver reload 2 → enabled
  • Routing fix → enabled


The Nexus 4 supports 802.11n WiFi networks, which operate in 2.4GHz and 5 GHz bands. It does not, however support 802.11ac.[16][17].

There is an issue though with the reported "signal strength" for 5GHz WiFi networks.[18] Apparently with Android 4.3 the reported signal strength is lower for 5 GHz networks, although the bitrate seems to suggest otherwise:

  • 5GHz network, 2 bars:
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
[ ID] Interval       Transfer     Bandwidth
[  4] local port 5001 connected with port 34313
[  4]  0.0-10.1 sec  48.1 MBytes  40.0 Mbits/sec
[  5] local port 5001 connected with port 34314
[  5]  0.0-10.1 sec  47.4 MBytes  39.2 Mbits/sec
  • 2.4 GHz network, 4 bars (full):
[  4] local port 5001 connected with port 34315
[  4]  0.0-10.4 sec  15.9 MBytes  12.8 Mbits/sec
[  5] local port 5001 connected with port 34316
[  5]  0.0-10.3 sec  22.9 MBytes  18.7 Mbits/sec

Phone goes black while in call

Might be related to the Proximity Sensor, which is located in the upper left of the phone. A screen protector / dirt might be in the way.

USB Mass Storage

Unfortunately, the Nexus 4 does not show up as a USB mass storage device when connected to a computer via USB cable.[19]. Alternative ways to transfer data to/off the device would be:

 adb pull /mnt/sdcard/DCIM .
 adb push local/directory /mnt/sdcard/download
  • Apply some kind of hardware hackery[19] to make USB OTG ("On The Go") work.

Contact icons

While contact icons appear just fine in the contact list, they appear blurry when displayed in incoming calls or when looked at in detail mode.

Google data connection issue

When not on WiFi, the Nexus 4 gets full bars and a "H" (for Speed Packet Access HSPA) - but the bars and the "H" are "grey". Data connection is fine, browsing works, but I can't install apps from the Google Play store.

When I connect to WiFi, the "H" vanishes (naturally) and the bars turn blue - now I'm able to install apps from the Google Play store, but data connections are handled by the WiFi connection of course.


The last link suggests to dial *#*#4636#*#* and select "Phone information", where one can switch from "WCDMA preferred" to "WCDMA only".

Lollipop Boot loop

After updating/flashing to Android 5.0.1 ("Lollipop"), the Nexus4 can't seem to exit its boot animation and stays there for quite a while[20][21]. After it wouldn't come back after ~10 minutes, I pressed the power button and the Nexus4 rebooted just fine.

LineageOS & GApps

After installing LineageOS 15.1, even the smallest "pico" Open GApps package cannot be installed due to insufficient disk space in /system. [22] The trick is to exclude e.g. the GoogleTTS package:

cat > /sdcard/gapps-config.txt

Now it should be possible to install Open GApps alongside Lineage 15.1 and above.