Ubuntu – Ubuntu-device-flash fails on Nexus 7 2013 (Android 5.0.2) – can’t copy image to /cache/recovery/

nexus-7system-installationubuntu-touch

I have been attempting to install ubuntu-touch on a new Nexus 7 2013 (Android 5.0.2) from a laptop running ubuntu 14.04 LTS by following the instructions here:

https://developer.ubuntu.com/en/start/ubuntu-for-devices/installing-ubuntu-for-devices/

Flashing the device fails with the message that the image didn't copy to /cache/recovery/ because it "Is a directory" – please see the output below. The device then boots into recovery but goes no further – i.e. doesn't install ubuntu as the OS.

Could anybody suggest a solution to this to enable a successful install of touch?

frank@UDroid:~$ ubuntu-device-flash touch --channel=ubuntu-touch/stable/ubuntu --bootstrap
2015/09/14 20:40:09 Expecting the device to be in the bootloader... waiting
2015/09/14 20:40:10 Device is |flo|
2015/09/14 20:40:10 Flashing version 1 from ubuntu-touch/stable/ubuntu channel and server https://system-image.ubuntu.com to device flo
2015/09/14 20:40:36 Start pushing /home/frank/.cache/ubuntuimages/ubuntu-touch/stable/ubuntu/flo/version-1.tar.xz to device
2015/09/14 20:40:36 Start pushing /home/frank/.cache/ubuntuimages/gpg/image-master.tar.xz to device
2015/09/14 20:40:36 Start pushing /home/frank/.cache/ubuntuimages/gpg/image-signing.tar.xz to device
2015/09/14 20:40:36 Start pushing /home/frank/.cache/ubuntuimages/pool/custom-16a192b4f7331b257e9a60c659b0ae5f4729d642965ea28415c1ea0e7ca8d7ed.tar.xz to device
2015/09/14 20:40:36 Start pushing /home/frank/.cache/ubuntuimages/pool/device-9569c7c1edb3a4944e1db5d2a966e58a2820a3e2f2d38eb145f27111b2dea978.tar.xz to device
2015/09/14 20:40:36 Start pushing /home/frank/.cache/ubuntuimages/pool/ubuntu-59b0c7aa8af63dda3a06005a6087c1faa4ed8993321293b276e7f7021d0cb0a3.tar.xz to device
2015/09/14 20:40:36 error pushing: failed to copy '/home/frank/.cache/ubuntuimages/gpg/image-master.tar.xz' to '/cache/recovery/': Is a directory

Best Answer

So I also wanted to play with Ubuntu Touch a few days ago and ran into this exact issue.

Problem: Ubuntu Touch as of 09/17/2015 doesn't install correctly following official guide on my Nexus 7.

Nexus 7 is a "reference" device, so it definitely should, and is known to be working. What's wrong with mine?

Poking around the internet (xda, #ubuntu-touch, #ubuntu-kernel) I found that newer Nexus 7 "flo" models, made in/after late 2014 and shipped with Android L have a different revision to their eMMC controller/hardware/something. Asus posted a kernel change:

mmc: add 5.0 emmc support

bug: 17968808 Kernel change for new eMMC v5.0 parts for FLO/DEB

Change-Id: Ia18152457fe3ff70401b199c267fa37374b9d544
Signed-off-by: hsuan-chih_chen <hsuan-chih_chen@asus.com>
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index dc4b125..ea1eca7 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -293,7 +293,7 @@
    }

    card->ext_csd.rev = ext_csd[EXT_CSD_REV];
-   if (card->ext_csd.rev > 6) {
+   if (card->ext_csd.rev > 7) {
        pr_err("%s: unrecognised EXT_CSD revision %d\n",
            mmc_hostname(card->host), card->ext_csd.rev);
        err = -EINVAL;

So I had a hunch that this was it. The kernel you're getting using the official tool doesn't have the patch applied. We need to build a patched kernel, and replace it in both the boot and the recovery images. The flo branch of the Ubuntu kernel doesn't have the fix applied (yet?).

I built a patched kernel using ubuntu-wily source on the flo branch and created boot and recovery images that appear to work. We aren't touching the bootloader so this should be safe, but I carry no responsibility if the following procedure bricks your device.

Again, follow these steps ONLY if you have a Nexus 7 (2013) "flo" that shipped with Android L.

Download boot.img and recovery.img from here: https://github.com/ddagunts/UTCWM_N7_patch/blob/master/boot.img?raw=true https://github.com/ddagunts/UTCWM_N7_patch/blob/master/recovery.img?raw=true

1) Return your device to stock:

a. Obtain Google Factory image "razor-lmy48m-factory-7c77e178.tgz"

b. Unpack the archive and run "flash-all.sh" with device in the bootloader

c. Let the tablet boot up, then power it off.

2) Boot to bootloader.

3) Run 'fastboot flash boot boot.img'

4) Run 'fastboot flash recovery recovery.img'

5) Boot device to recovery

6) Run 'ubuntu-device-flash touch --channel=ubuntu-touch/stable/ubuntu' # This should run through and say: "Rebooting into recovery to flash" - wait until the program exits.

7) The device should reboot automatically and start spinning the Ubuntu logo. Wait this out - takes 5 to 10 minutes. I believe this is Ubuntu installing itself.

8) The device will reboot and get stuck on the Google logo. Power the device off.

9) Boot the device into the bootloader. Repeat steps 3 and 4 to reflash the boot and recovery images.

10) Power off and start the device. Ubuntu should start booting.

Related Question