Nexus 5 installation stuck at erasing 'userdata'



  • I am having trouble installing UBports on a Nexus 5. I have done the following:

    • Booted to fastboot mode (vol up + vol down + power)
    • Unlocked phone (fastboot oem unlock) - this seemed to hang up on erasing for hours. I read that other people just rebooted and it was fine, so I did that. When I boot to fastboot mode now, it says it is unlocked.
    • Tried installing UBports using magic-device-tool launcher.sh. It seemed to go alright until it hung up on erasing 'userdata'. The terminal output is:

    Detecting device

    039c8980e0785f4f fastboot
    Device detected !

    Flashing legacy channel

    Creating filesystem with parameters:
    Size: 734003200
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 7472
    Inode size: 256
    Journal blocks: 2800
    Label:
    Blocks: 179200
    Block groups: 6
    Reserved block group size: 47
    Created filesystem with 11/44832 inodes and 5813/179200 blocks
    target reported max download size of 1073741824 bytes
    erasing 'cache'...
    OKAY [ 0.484s]
    sending 'cache' (13348 KB)...
    OKAY [ 0.630s]
    writing 'cache'...
    OKAY [ 1.029s]
    finished. total time: 2.143s
    Creating filesystem with parameters:
    Size: 29236371456
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 8192
    Inode size: 256
    Journal blocks: 32768
    Label:
    Blocks: 7137786
    Block groups: 218
    Reserved block group size: 1024
    Created filesystem with 11/1785856 inodes and 156120/7137786 blocks
    target reported max download size of 1073741824 bytes
    erasing 'userdata'...

    Eventually I shut off the phone and rebooted to fastboot and installed TWRP hoping that it would let me erase things. I used it to wipe partitions, but it also shows a lot of errors when I do it. They mention that it cannot mount data and cache partitions. If I exit TWRP, boot to fastboot mode, and try installing UBports again, I get the same result as above. The phone itself has a green "erasing..." message, but it is unresponsive to the up/down and power buttons, other than shutting off if I unplug it from the computer and hold the power button for about 10 s.

    If I reboot the phone and do not try to get into fastboot mode, it displays a set of four animated dots in the center of the screen. I let that go for over 10 minutes before I decided to shut it off.

    Any thoughts on how to proceed with getting UBports to install?



  • I have also tried installing UBports using the image server instead of the cloned git method. The command and terminal output are:

    sudo ubuntu-device-flash --server=http://system-image.ubports.com touch --device=hammerhead \ --channel=15.04stable --bootstrap
    [sudo] password for joe:
    2017/06/24 21:26:25 Device is |hammerhead|
    2017/06/24 21:26:25 Flashing version 42 from ubuntu-touch/stable channel and server http://system-image.ubports.com to device hammerhead
    2017/06/24 21:26:46 Start pushing /home/joe/.cache/ubuntuimages/gpg/image-master.tar.xz to device
    2017/06/24 21:26:46 Start pushing /home/joe/.cache/ubuntuimages/pool/keyring-4c4e7ef380ebcfa2c31084efa199138e93bfed8fc58aa3eb06bdf75a78af9b57.tar.xz to device
    2017/06/24 21:26:46 Start pushing /home/joe/.cache/ubuntuimages/ubports-touch/15.04/stable/hammerhead/version-1.tar.xz to device
    2017/06/24 21:26:46 Start pushing /home/joe/.cache/ubuntuimages/pool/device-728a726a0e9a9983dc3b3b5279ab12759b3e15d33a657dd4b9253b3aa27858c1.tar.xz to device
    2017/06/24 21:26:46 Start pushing /home/joe/.cache/ubuntuimages/pool/ubports-d50c18b27590af5734a826c4f7857d8909b0e0f902d21af142a780620c8eb58b.tar.xz to device
    2017/06/24 21:26:46 Start pushing /home/joe/.cache/ubuntuimages/gpg/image-signing.tar.xz to device
    2017/06/24 21:26:46 error pushing: failed to copy '/home/joe/.cache/ubuntuimages/pool/keyring-4c4e7ef380ebcfa2c31084efa199138e93bfed8fc58aa3eb06bdf75a78af9b57.tar.xz' to '/cache/recovery/': Is a directory

    The phone then reboots, briefly shows a google screen with an unlocked symbol, and then goes to a screen titled Ubports Recovery with a list of options. If I reboot the system from the Ubports Recover -> Ubuntu actions, the phone shuts off but does not come back on.

    Any advice on how to proceed with the Ubports installation will be appreciated.



  • @JoeBeach Mine did the same at the UT recovery stage. I just left it and waited nit sure for how long might gave been 10 mins. It then moved on by its self. It then sat on a screen with Google and an unlocked padlock on it before you get the UBtouch start up screen. Hope this helps



  • @JoeBeach Had the same thing. I just reran MDTool and all went well after that.
    Not sure from above but if yours reboots to android you could try factory resetting it fromthere, then re running MDTool.



  • @Lakota Thanks for the suggestions. Last night (before I read your replies) I also tried installing the latest update for the Nexus 5 from google. That also had problems hanging up on erasing, although it was cache instead of userdata.

    I found a post from a person trying to reinstall android that also had this problem. One suggestion was to unzip the bundled image file and use fastboot to flash the individual images. I tried that and it hung on erasing system partition. Then I tried formating system with fastboot and that went fine, it erased it in a few seconds and then had it formated in a minute or so. Then I tried flashing the system partition and it seemed to work. However, when I tried to boot after flashing all of the partitions, it stuck on the 4 animated dots screen (google's splash screen, I guess) for over 2 hours before I finally shut it off.

    I am beginning to wonder if I have a bum phone. I bought it on craigslist and was told it worked, but it had a stone dead battery so I couldn't check it. I replaced the battery and jumped straight into the UPports installation without trying to boot the phone into the stock OS first, that was probably a mistake.

    I'm trying the magic device tool installation method again. So far, it is on "erasing userdata" for 25 minutes. I'm going to let it go for up to 4 hours to see if it every gets through it.



  • There is also an issue with nexus 5 sticking in a bootloader cycle something to do with the power buttun I think. Mine was from ebay and arrived contiually trying to start then buzzing and trying again. Fixed that by continually gently "flicking” the power button(info on the web). Might be nothing to do with your problem but have a look.



  • The magic device tool attempt I mentioned above stayed stalled at erasing userdata for over 8 h before I shut off the phone. After rebooting into fastboot mode I found that I could sometimes use fastboot to format partitions, other times it would hang on the erase. I manually formated the partitions and then tried the system image server installation method, but that stalled again with the "'/cache/recovery/': Is a directory error". However, that did install the UBports Recovery before failing.

    While in the UBports Recovery, I can push files to the device with adb. I was able to push all the files that were mentioned in the system image server terminal output. I suspect that I could complete the UBports installation if I were to know what needs to be pushed where and what adb or fastboot command is used to extract the files once they are pushed.

    Can anyone tell me how to manually install the files or point me to the source files for the system image server or MDTool scripts so I can find the individual commands to do things manually?



  • You can try:

    1. Switching the device off and leave it off for a while.
    2. Remove your /home/joe/.cache/ubuntuimages and all its content.
    3. Start up in fastboot mode.
    4. Re-run the MDTool.

    Repeat the steps if it fails a few times (5 times or so). Also make sure bootfast tells you that it is unlocked.



  • @hans1977se , I gave your suggestion a try. All five times it hung up on erasing userdata. Each time the terminal output was the same, other than the times changing slightly. An example is:

    Detecting device

    039c8980e0785f4f fastboot
    Device detected !

    Flashing legacy channel

    Creating filesystem with parameters:
    Size: 734003200
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 7472
    Inode size: 256
    Journal blocks: 2800
    Label:
    Blocks: 179200
    Block groups: 6
    Reserved block group size: 47
    Created filesystem with 11/44832 inodes and 5813/179200 blocks
    target reported max download size of 1073741824 bytes
    erasing 'cache'...
    OKAY [ 0.514s]
    sending 'cache' (13348 KB)...
    OKAY [ 0.630s]
    writing 'cache'...
    OKAY [ 1.029s]
    finished. total time: 2.173s
    Creating filesystem with parameters:
    Size: 29236371456
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 8192
    Inode size: 256
    Journal blocks: 32768
    Label:
    Blocks: 7137786
    Block groups: 218
    Reserved block group size: 1024
    Created filesystem with 11/1785856 inodes and 156120/7137786 blocks
    target reported max download size of 1073741824 bytes
    erasing 'userdata'...

    I'd let it sit on the erasing userdata message for five minutes, then shut the phone off, let it sit five minutes, then try again.

    I dug through the MD Tool scripts (launcher.sh and the others it calls) and found that in the end, it does the following:

    fastboot format cache
    fastboot format userdata
    fastboot reboot-bootloader
    ubuntu-device-flash --server=http://system-image.ubports.com touch --channel=ubports-touch/legacy --device=hammerhead --bootstrap
    rm -f /tmp/AttachedDevices

    I manually formated cache, rebooted to fastboot, manually formatted userdata (rebooting between formats makes it so it doesn't hang up on erasing), rebooted to fastboot, then ran the ubuntu-device-flash command. The terminal output was:

    $ ubuntu-device-flash --verbose --server=http://system-image.ubports.com touch --channel=ubports-touch/legacy --device=hammerhead --bootstrap
    2017/07/01 11:22:44 Device is |hammerhead|
    2017/07/01 11:22:45 Flashing version 42 from ubports-touch/legacy channel and server http://system-image.ubports.com to device hammerhead

    While the above was displayed, the phone was flashing messages about erasing/downloading/writing. Then it blanked the screen and rebooted to a screen that showed Google with an unlocked padlock. A second or two after that happened, the following messages were displayed in the terminal:

    2017/07/01 11:23:05 Start pushing /home/joe/.cache/ubuntuimages/pool/ubports-d50c18b27590af5734a826c4f7857d8909b0e0f902d21af142a780620c8eb58b.tar.xz to device
    2017/07/01 11:23:05 Start pushing /home/joe/.cache/ubuntuimages/pool/device-728a726a0e9a9983dc3b3b5279ab12759b3e15d33a657dd4b9253b3aa27858c1.tar.xz to device
    2017/07/01 11:23:05 Start pushing /home/joe/.cache/ubuntuimages/pool/keyring-4c4e7ef380ebcfa2c31084efa199138e93bfed8fc58aa3eb06bdf75a78af9b57.tar.xz to device
    2017/07/01 11:23:05 Start pushing /home/joe/.cache/ubuntuimages/ubports-touch/15.04/stable/hammerhead/version-1.tar.xz to device
    2017/07/01 11:23:05 Start pushing /home/joe/.cache/ubuntuimages/gpg/image-master.tar.xz to device
    2017/07/01 11:23:05 Start pushing /home/joe/.cache/ubuntuimages/gpg/image-signing.tar.xz to device
    2017/07/01 11:23:05 error pushing: failed to copy '/home/joe/.cache/ubuntuimages/pool/keyring-4c4e7ef380ebcfa2c31084efa199138e93bfed8fc58aa3eb06bdf75a78af9b57.tar.xz' to '/cache/recovery/': Is a directory

    After a bit more time, the phone showed the Ubports Recovery page with various options. So it seems to me that something is happening to make the phone reboot before everything that is supposed to happen in fastboot actually occurs. There is a file push problem ("Is a directory", last line in the output above) and maybe other things.

    I suspect I need to do the installation manually to sort it out. To do that, I need to know what files to push where and how to extract them once they are there. If you or anyone else can clue me in on the details of what commands ubuntu-device-flash is supposed to run, that might help me out.


  • Community

    It's really beginning to sound like the flash on your device is not up to par. Have you been able to flash the device with an Android image, or even its factory image?



  • @JoeBeach Too bad the luck was not on your side in this. :( It doesn't sound good, and i agree with @UniSuperBox that it seems to be something wrong with your flash. It could be partly broken, or maybe fastboot has been corrupted?

    I think it would probably be best if you could get the phone back to android first. From your earlier posts i can see that you have tried that already, with problems, but maybe you could give it a second try? I also found this page (https://forum.xda-developers.com/google-nexus-5/general/fix-unbrick-nexus-5-stucked-qualcomm-hs-t3043301) that you could evaluate if it would be worth a try. I haven't tried it myself, so i cannot recommend you either way, but it look like it could be a way forward.

    If you're in the end getting nowhere in this, maybe trying to get a very cheap second one with a cracked screen and build one working phone with a mix of parts from the two phones could be the way to go?



  • @UniSuperBox and @hans1977se , I am leaning toward hardware problems being the answer also. I was able to get the ubuntu-device-flash to execute without any error messages by booting to the UBports recovery, running an adb shell, and making a directory "recovery" under /cache. After exiting the adb shell I ran the ubuntu-device-flash command (no --bootstrap option so it would use the adb connection) with the following results:

    $ ubuntu-device-flash --verbose --server=http://system-image.ubports.com touch --channel=ubports-touch/legacy --device=hammerhead
    2017/07/01 13:55:10 Device is |hammerhead|
    2017/07/01 13:55:10 Flashing version 42 from ubports-touch/legacy channel and server http://system-image.ubports.com to device hammerhead
    2017/07/01 13:55:10 Start pushing /home/joe/.cache/ubuntuimages/pool/keyring-4c4e7ef380ebcfa2c31084efa199138e93bfed8fc58aa3eb06bdf75a78af9b57.tar.xz to device
    2017/07/01 13:55:10 Start pushing /home/joe/.cache/ubuntuimages/ubports-touch/15.04/stable/hammerhead/version-1.tar.xz to device
    2017/07/01 13:55:10 Done pushing /home/joe/.cache/ubuntuimages/pool/keyring-4c4e7ef380ebcfa2c31084efa199138e93bfed8fc58aa3eb06bdf75a78af9b57.tar.xz to device
    2017/07/01 13:55:10 Done pushing /home/joe/.cache/ubuntuimages/ubports-touch/15.04/stable/hammerhead/version-1.tar.xz to device
    2017/07/01 13:55:11 Start pushing /home/joe/.cache/ubuntuimages/pool/device-728a726a0e9a9983dc3b3b5279ab12759b3e15d33a657dd4b9253b3aa27858c1.tar.xz to device
    2017/07/01 13:55:11 Start pushing /home/joe/.cache/ubuntuimages/gpg/image-signing.tar.xz to device
    2017/07/01 13:55:11 Start pushing /home/joe/.cache/ubuntuimages/gpg/image-master.tar.xz to device
    2017/07/01 13:55:11 Done pushing /home/joe/.cache/ubuntuimages/gpg/image-signing.tar.xz to device
    2017/07/01 13:55:11 Done pushing /home/joe/.cache/ubuntuimages/gpg/image-master.tar.xz to device
    2017/07/01 13:55:12 Start pushing /home/joe/.cache/ubuntuimages/pool/ubports-d50c18b27590af5734a826c4f7857d8909b0e0f902d21af142a780620c8eb58b.tar.xz to device
    2017/07/01 13:55:19 Done pushing /home/joe/.cache/ubuntuimages/pool/device-728a726a0e9a9983dc3b3b5279ab12759b3e15d33a657dd4b9253b3aa27858c1.tar.xz to device
    2017/07/01 13:55:43 Done pushing /home/joe/.cache/ubuntuimages/pool/ubports-d50c18b27590af5734a826c4f7857d8909b0e0f902d21af142a780620c8eb58b.tar.xz to device
    2017/07/01 13:55:43 Created ubuntu_command: /home/joe/.cache/ubuntuimages/ubuntu_commands501912074
    2017/07/01 13:55:43 Rebooting into recovery to flash
    $

    That all looked great, but in the end it still doesn't boot into UBports, it just sits on a black screen with "Google" in the center and and unlocked icon at the bottom.

    I'll do some looking to see if the flash is replaceable in the Nexus 5, but I suspect it is not. There are other ones out there I could buy, I just picked this one up because it was cheap and local. I should have insisted on seeing it boot up before I bought it. Oh well, I've spent $60 on worse things...



  • @JoeBeach You could even upgrade to 64GB in the same go. :) I found this hack blog (http://hackaday.com/2016/05/10/upgrading-a-nexus-5-emmc-to-64gb/). It's not for the fainthearted, and uncertain if more than 32GB will be usable, but quite interesting.



  • Hi there,

    I just found this thread. Maybe my problem is even better addressed here:
    I followed the instructions on your website. Unlocked bootloader and root the device.

    Using magic-device-tool I receive through following error message:

    err: fork/exec /usr/bin/xz: cannot allocate memory

    Can you please help me?



  • @tH3f0rC3

    Before this error message I received:
    Unable to write recovery img



  • @hans1977se I saw that blog too. I have a reasonable amount of skill with soldering, but I think I'd also like to have a bit of good luck on my side to pull that off. On the other hand, if the phone isn't working anyway, maybe its worth a shot...



  • @tH3f0rC3 I'm definitely not an expert at this, but I'll give my input.

    I took a quick look at the man page for xz. It is a compression/decompression tool. The terminal output I posted earlier shows that one part of the installation is copying various *.xz files to the phone. It appears that it then runs xz on those compressed files to uncompress them. The "Unable to write recovery img" and "cannot allocate memory" error messages suggest to me that the phone's memory is full. Whether that means RAM or flash memory, I'm not sure. If it is a RAM problem, I'm not sure what to do. If it is a flash problem, perhaps the partitions were not properly reformatted during the installation process or maybe the phone has a nonstandard partition layout that doesn't have enough room for the uncompressed files?

    Can the phone boot to its previous operating system and work properly?



  • @JoeBeach I have soldered these kind of chips, both successfully and unsuccessfully, and i think there are particularly two things that are difficult. The first thing is that surrounding components very easily goes off the pcb, and the other thing is to get good connections to the pcb on all pads. I think an IR-heater is probably the best for this job.

    I don't know where you're located, but is some parts of the world it is very easy and cheap to have someone doing this. Otherwise, if you have to do it yourself, like you say on the other hand it is unusable scrap anyway. :)

    Did you try the un-brick instruction i linked to as well?



  • @hans1977se I had not looked at the unbrick link, I missed that along the way. I don't normally work in windows, but I have a dual boot laptop at work for occasions like this. I'll give it a try and let you know what I find.



  • @JoeBeach
    Yes, the currently installed Android system works still very well.
    Do you have any suggestion how to clean memory and try again. By the way, its a 16GB Nexus 5.

    Best Regards,


Log in to reply
 

Looks like your connection to UBports Forum was lost, please wait while we try to reconnect.