Nexus 5: boot loop

I had a Nexus 5 stuck in a boot loop (Android logo/animation in a loop, not actually booting).

This is what I think I’ve done to fix the issue. It seemed that /persist partition was corrupt. I tried a factory reset, flash new stock images, and clear cache, etc before trying the following.

Note that I managed to boot Android 4.4, but nothing else; it did throw a shit load of errors though (Google Play crashes, etc).

First of all, get ADB & Fastboot here. You’ll also need an hex editor (mac).

This will unlock your phone’s OEM mode; and thus potentially voiding warranty and erasing all data (!).

Edit file paths as needed, this is a copy paste of what I can still see on my terminal.

If you know your device’s WiFi MAC & Bluetooth address that’ll be useful for later, as apparently that gets wiped.

Boot into recovery boot by turning off your device and then holding the power + volume down button.

$ ./fastboot-mac oem unlock
... OKAY

Flash openrecovery (TWRP):

./fastboot flash recovery ../openrecovery-twrp-2.8.5.2-hammerhead.img
sending 'recovery' (13918 KB)... OKAY
writing 'recovery'... OKAY

Boot into recovery mode (using volume buttons) from the recovery boot. ADB should work now. This will find a bunch of errors and destroy the partition.

nazgul ~/Android $ ./adb-mac shell

~ # e2fsck /dev/block/platform/msm_sdcc.1/by-name/persist
e2fsck 1.42.9 (28-Dec-2013)
Superblock has an invalid journal (inode 8).
Clear<y>? y
yes
*** ext3 journal has been deleted - filesystem is now ext2 only ***
Superblock has_journal flag is clear, but a journal inode is present.
Clear<y>? yes
/dev/block/platform/msm_sdcc.1/by-name/persist was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Journal inode is not in use, but contains data. Clear<y>?
yes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: -(75--1098)
Fix<y>?
yes
Free blocks count wrong for group #0 (2972, counted=3996).
Fix<y>?
yes
Free blocks count wrong (2972, counted=3996).
Fix<y>?
yes
Recreate journal<y>?
yes
Creating journal (1024 blocks): Done.
*** journal has been re-created - filesystem is now ext3 again ***
/dev/block/platform/msm_sdcc.1/by-name/persist: ***** FILE SYSTEM WAS MODIFIED *****
/dev/block/platform/msm_sdcc.1/by-name/persist: 30/1024 files (3.3% non-contiguous), 1124/4096 blocks

~ # e2fsck /dev/block/platform/msm_sdcc.1/by-name/persist
e2fsck 1.42.9 (28-Dec-2013)
/dev/block/platform/msm_sdcc.1/by-name/persist: clean, 30/1024 files, 1124/4096 blocks

~ # make_ext4fs /dev/block/platform/msm_sdcc.1/by-name/persist
Creating filesystem with parameters:
Size: 16777216
Block size: 4096
Blocks per group: 32768
Inodes per group: 1024
Inode size: 256
Journal blocks: 1024
Label:
Blocks: 4096
Block groups: 1
Reserved block group size: 7
Created filesystem with 11/1024 inodes and 1102/4096 blocks
Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

So far, so good. Persist partition was corrupt and recreated.

The original howto (see below) said root (su) was needed here; however it worked without root for me (?).

Download this file (kudos to whoever made it) and unrar it. Use your hex editor to edit last 6 digits (“00 00 00”) to a valid hex value, or even better, your actual MAC address if you can remember/find it.

Now upload these two (hidden) files to /sdcard/:

nazgul ~/Android $ ./adb-mac push .bdaddr /sdcard/.bdaddr
0 KB/s (6 bytes in 0.078s)
nazgul ~/Android $ ./adb-mac push .macaddr /sdcard/.macaddr
1 KB/s (6 bytes in 0.004s)

And run these commands:

nazgul ~/Android $ ./adb-mac shell
~ # su
/sbin/sh: su: not found
~ # cd /persist
/persist # ls
/persist # mkdir bluetooth wifi
/persist # chown bluetooth:system ./bluetooth
/persist # chmod 770 ./bluetooth
/persist # ls
bluetooth
wifi
/persist # cp /sdcard/.bdaddr /persist/bluetooth
/persist # chown bluetooth:system ./bluetooth/.bdaddr
/persist # chmod 660 ./bluetooth/.bdaddr
/persist # chown wifi:system ./wifi
/persist # chmod 770 ./wifi
/persist # cp /sdcard/.macaddr /persist/wifi
/persist # chown wifi:system ./wifi/.macaddr
/persist # chmod 660 ./wifi/.macaddr
/persist # rm /sdcard/.bdaddr
/persist # rm /sdcard/.macaddr
/persist # reboot

Go back into recovery boot and flash Android (I flashed 4.4 first, made sure it worked, and then flashed 6.0.1 (latest at this time); but you can probably flash latest version right away. Also unzip the zip file with all the images inside the .tar.gz — we’ll need the files later:

nazgul ~/Downloads/hammerhead-mmb29k.6 $ ./flash-all.sh
sending 'bootloader' (3120 KB)... OKAY
writing 'bootloader'... OKAY
rebooting into bootloader... OKAY
sending 'radio' (45425 KB)... OKAY
writing 'radio'... OKAY
rebooting into bootloader... OKAY
archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
archive does not contain 'system.sig'
--------------------------------------------
Bootloader Version...: HHZ12k
Baseband Version.....: M8974A-2.0.50.2.28
Serial Number........: 0644c9920b105eb5
--------------------------------------------
checking product... OKAY
checking version-bootloader... OKAY
checking version-baseband... OKAY
sending 'boot' (9154 KB)... OKAY
writing 'boot'... OKAY
sending 'recovery' (10012 KB)... OKAY
writing 'recovery'... OKAY
sending 'system' (1020405 KB)... OKAY
writing 'system'... OKAY
erasing 'userdata'... OKAY
erasing 'cache'... OKAY
rebooting...

Note that it won’t actually boot yet, so go back into recovery boot, and flash userdata and cache (not sure why they go missing or get entirely erased):

nazgul ~/Downloads/hammerhead-mmb29k.6 $ ./fastboot flash userdata image-hammerhead-mmb29k/userdata.img
sending 'userdata' (137318 KB)... OKAY
writing 'userdata'... OKAY
nazgul ~/Downloads/hammerhead-mmb29k.6 $ ./fastboot flash cache image-hammerhead-mmb29k/cache.img
sending 'cache' (13348 KB)... OKAY
writing 'cache'... OKAY

Execute a normal boot now, and wait 5 to 10 minutes.

Android should boot up normally now.

You can also OEM lock your phone again, if you wish (but a sticky bit has been set).

I’ve followed these forum posts.

Waze not getting a GPS fix

TL;DR: recalibrate your compass.

I’ve come across an issue for the past 10 days that Waze kept losing its GPS fix. This meant:

  • constantly switching between 0 and 120 (or whatever) km/h
  • constantly zooming in & out on maps (dynamic zoom level depending on speed)
  • being in a field/not on the road for most of the time, or stuck to a location of many minutes ago
  • often & randomly losing GPS fix (ie middle of the highway without any buildings blocking the line of sight)
  • I could do a 45 minute trip with Waze never getting a GPS fix
  • not knowing road issues (accidents, traffic jams ahead, speed traps, etc)

Things I tried:

  • nothing changed (no new car window, didn’t move my phone location in the car, etc)
  • not moving (ie parked car) didn’t really improve the GPS fix
  • even left my phone with Waze on in the car for 30 minutes parked (got a fix, but later that evening when driving home it started to lose its GPS fix again)
  • clear Waze cache
  • uninstall Waze completely
  • GPS Essentials showed a fix with 3 or more GPS satellites when Waze couldn’t get a fix
  • I was about to find a way to reset my GPS and/or clear its cache (???)

PS: I have had this issue in the past (I believe with the same phone, a Nexus 5), but it went away after several days.

What I did notice, however, is that in Google Maps the arrow (clicking the pin point button twice or something) was pretty much showing the opposite direction of how the car was moving (thus driving backwards at ~120km/h). This made me think, as I know the GPSes in smartphones are quite cheap and aren’t always on (to save battery — my phone is always being charged in the car though) and the phone uses the accelerometer and other sensors to “guess” current path (or rather, path changes, ie taking a turn or slowing down/accelerating).

I then recalibrate my compass using this method with the free app GPS Essentials (compass tab). I noticed two things

  • my compass was showing south as north
  • calibrating it in my room (no known magnets here) gave a mixed result (it sometimes pointed north, and sometimes stopped doing so)
  • moving around gave me a better calibration (more accurately pointing north)
  • question? Is the compass chip fucked? broken? cheap ass crap?

Trying now again driving around with Waze:

  • Waze almost instantly has a GPS fix
  • Waze doesn’t lose its GPS fix most of the time but …
  • Waze still occasionally loses its fix (but regain it after a second or two, three)

So it’s not always a GPS issue, but rather an issue with one of the other sensors (what here seems to be the compass).

Edit: the problem comes back after ~1 day. Compass often stuck and doesn’t really point north. Ever. Calibrating sometimes helps, but it ends to get stuck again after a while. Nexus 5 chipset issue? Google Navigation works (way) better (it doesn’t remain at the same location for ~10 minutes), but it’s not very precise either (always lagging behind a a street or cross road or something). Perhaps Google Navigation is better at using GSM localisation and doesn’t use the compass to figure out so much?

Edit 2: It works “fairly ok” if I calibrate my compass just before driving. It still loses its fix a few times, but all in all it was acceptable.

I’ve seen in tools like GPS Status that north always points to the bottom right (“south east”) unless it finds a GPS fix. When it’s stuck “finding GPS location” my compass is entirely off and Waze is seeking a fix. When it has a GPS location Waze is fine.

Note that while it cannot find a GPS location, it does have a fix with 3+ GPS satellites.

So I’m not sure if it’s a compass issue, or a GPS issue, and what the definite difference is between both (a smartphone compass not being a magnetic compass if I understand correctly).

4.4.x & Nexus 7 (2012/v1)

New Android, once more a laggy device. Thank you Google.

My Nexus 7 (1st generation, 2012 model, with 3G) is encrypted, so I guess that might also slow everything further down.

Three things I did to solve the lagginess:

  • Wipe cache (howto),
  • Clear space (I had some movies left on it, deleted a few big files and it seemed to instantly pay off),
  • For some odd reason turning off WiFi optimalisation (advanced settings of WiFi) seemed to have the biggest impact on speed.

Edit (2/2/2014): Lagginess came back pretty quickly. I tried an entire reset/wipe and re-encrypted the storage. That didn’t really help.

I’ve now done a complete wipe again, but have not encrypted the storage (and removed more useless apps). And it is noticeably less laggy.

Edit (8/2/2014): It’s actually very smooth again, I can run and use the tablet in a decent way. Encryption on Nexus 7 (v1) is a no go.

Nexus 4 red light of death (2)

To continue my story, I replaced the battery with a new, and what appears to be a genuine LG battery (if not, then those Chinese are getting good at it).

It worked and booted, but the battery got drained in ~8 hours (100% to 0%). And it felt a tiny bit warm on the cover, just above the battery (battery area was normal). Especially in my pocket it would get quite warm.

BTfYOSRIMAA66_z

At 0% it wouldn’t turn off though (but it did anyway after about half an hour of being at 0%).

I was hoping that entirely draining the battery a few times would fix whatever it was, but after the 2nd drain, the red light of death popped up again, and I haven’t been able to boot since.

I’ll attempt to RMA it (I don’t know if they’ll notice I swapped the battery, as that would kind of void my warranty… Well done, LG, well done).

IMG_20130910_014157

Should probably clean the display before taking a picture next time. 😉

Edit:

I’ve read on XDA-Developers this might be a product error. My girlfriend also has a Nexus 4 (about 3 months old, mine was 5 months), and that one hasn’t caused any problems (although, it seems less smooth, and the battery is drained quicker, than mine).

I’d generally suggest, if you have a red light of death (and it’s not flashing) to just RMA it. Not sure if I’ll ever see my N4 again. 🙁

Nexus 4: Red light of death

On Thursday night I used my Nexus 4 as GPS (as I always do — it’s my main navigation device, so Google, please bring back a usable navigation app pretty plx!) to drive from Brussels to Antwerp (~40 minutes).

I had about 60% of battery left when I turned on the GPS. I tend to recharge my battery every night. It’s times like these I usually just use the GPS without using the car charger. I don’t mind my phone being at 10 or 20% when I arrive home, late at night, as it will be charged overnight anyway.

Almost home, the notification of 14% battery left popped up; I dismissed it as I had 10 more minutes to go. About 5 minutes after that, my phone suddenly switched off. Like, just, suddenly black. No shutdown or anything. It caught my attention, but I left it at that.

Finally home, I quickly unpacked some stuff, checks some mails, etc, and about an hour later I headed to bed.

That’s when I took my phone and plugged it into the charger and a red led popped up. I had never seen this one before.

From there on, I was unable to turn on my phone (my entirely drained Nexus 7 has the same behaviour, it requires being plugged in for 10ish minutes before booting up). I decided to let it charge 10 minutes. Nothing. Hitting power button didn’t change a thing.

As my Roomba seemed to have had a fight with the charger cables under the bed, I thought it might have half ripped the cable or something, so I tried a USB cable and a PC: same. Another charge: same.

Fair enough, I left it charging for the right. Waking up (yes, these things kind of keep me awake — or rather, wake me up) several times during the night, I tried turning it on… but alas. And still a constant red light turned on.

I just had the latest 4.3 bis update (the 7 or 9 Mb update) like 24 or 48 hours before. And I don’t think I had rebooted the device since. Was this causing it?

I started Googling, got in touch with my Amazon.de seller (as it’s ridiculously expensive in Belgium, and I think when I got it, it wasn’t officially for sale here yet) and bought Skype credit (yep, didn’t have a backup phone) to call Google Play support.

Amazon told me to try to do it via Google, or it will take a “very long time” to RMA it.

Google told me to do it via Amazon as it wasn’t bought via the Play store (and send me a troubleshooter to try to “get it out of deep sleep” — but that didn’t work).

I tried several steps, including the hard reset (volume up + power for 60 seconds), but nothing helped.

As it was still under warranty, I didn’t want to really mess up too much, but I couldn’t imagine having to miss this device for another day, let alone weeks…

Drove to my parents to get a backup phone, and there we opened the device (with those odd you-are-not-supposed-to-open-this screws) and, as one post stated on XDA-dev, to unplug the battery.

The multimeter showed 0 volt on the battery (but the connector was so small we weren’t sure it quite touched the copper.

However, reconnected the battery cable and inserted the USB charger… And the screen lit up, a charging icon popped up, and no red light of death. Yay.

Let it charge for ~3 hours (the battery felt warm, but not sure if it was anomalous) and so far so good. We’ll see tomorrow whether it drains faster than usual.

Some people pointed out a product issue, either causing the battery to overdrain (which is bad) or to be too strict on it (and refusing to recharge when it’s quite safe to do so). But the battery itself could also be dying.

I have a phone mount on my dashboard, and during the summer, in full sunlight, using my GPS, and the phone being black, I noticed the back side got quite … hot… So did this cause any permanent damage?

EDIT:

After being fully charged, I noticed a drop of about ~10% per 60 minutes. Which seemed a lot. I let it discharge overnight, and when I woke up it was indeed entirely dead again.

Attempting to recharged caused the red light of death again. Unplugging the battery (for 5 minutes) didn’t solve the problem anymore. It seems like it’s really dead.

We managed to read the voltage with a multimeter, stating 3,15V (instead of 3.8). Unsure whether it’s the battery or the charger of the phone… Unplugging the battery and attempting to charge also causes a red light of death.

I’ll get a new battery on Monday, and do my best to swap it (apparently they glued in the battery… sigh).

EDIT 2:

This.