Recovering Files from Soft-Bricked Ubuntu Touch/Android Device
Okay, that was sad :(
My Ubuntu Touch device, a Nexus 4, suddenly behave strangely. It suddenly restarted, and continuously rebooting. Practically becomes unusable. It seems to become worse as it can't even boot for long, only reaching the Google logo before turning off again (and not restarting). I booted into recovery mode, wiped the cache partition, but it didn't solve the problem. I then planned for a factory reset, but first, I need to recover my data first. I found an instruction on TechGlen
, but sadly it doesn't clearly tell us how to get the location of the user data that needs to be mounted so that we can backup the contents. After some more googling, I got the clue from Stack Exchange
. So, here's how to do it, as a note for myself, or in case someone needs it.
1. Boot into recovery mode
Connect the device to computer via USB cable.
To boot into recovery mode on Nexus 4, with the device turned off, press and hold the volume down button, then press and hold the power button.
You'll enter the bootloader. From the bootloader, use the volume button to find the Recovery Mode
option, and press the power button to select it. You'll then enter the recovery mode.
Ubuntu Touch Recovery Mode
Check that your device is properly connected to the computer. Open the Terminal app and execute adb devices
command. Make sure that on the list of devices attached you see something like a code that indicate your device followed by recovery
, then you are good to go.
2. Find the location of the userdata partition
Now, we'll need to find the location of the things that we want to backup. First, execute adb shell
on the terminal to enter ADB shell mode.
- Use the ls command to list the contents of the root directory of the phone. We are going to mount the user data partition to /emmc, but we need to get the path first
- With cd etc && ls command, we'll change directory to /etc and then lists its contents. It should contain a file called recovery.fstab
- Use cat recovery.fstab to read the file. You should see a list consists of rows like /dev/block/platform/***/by-name/***. We only need to note it until "/by-name/". In my device, it is /dev/block/platform/msm_sdcc.1/by-name/..
- Then, use ls -l /dev/block/platform/msm_sdcc.1/by-name/ to find the path to userdata partition. In my case, it was /dev/block/mmcblk0p23 as shown in the screenshot below.
3. Mount the userdata partition
- Now that we've got the path to mount, head back to the root directory with cd ../
- As the directory /emmc is already exist, we don't need to create it to mount the drive. Simply executing mount /dev/block/mmcblk0p23 /emmc to mount it.
- cd emmc && ls will bring you to the emmc folder and list its content. You can also investigate the content deeper by using cd command to move to a specific folder and ls to list its content, for example cd user-data followed by ls to see what's inside user-data folder.
4. Pull the content to backup
- Use exit command to exit from ADB shell.
- After that, you can pull (copy) the folders and files that you want to the computer with adb pull <path_to_pull> <path_to_paste>. It depends on what you want to recover. You can pull the whole content of /emmc with adb pull /emmc ./backup_folder, or simply the content of the home (phablet) folder with adb pull /emmc/user-data/phablet ./backup_folder. Either way, it will copy what you pull into a folder named backup_folder in your home folder. In the screenshot below, I only pulled the content of phablet folder into a folder named backup_home_ubuntu_mako.
And, there, it's done :)
Still bricked, though
Well, I did successfully backed up the content of my Ubuntu Phone, but sadly the phone itself is still in unusable state. I did a factory reset, but it didn't help. I then restored the phone to Android and it successfully booted up, but it still suddenly shut down by itself after a while. After that, the same happened as before: when I tried to turn it on again, the Google logo appeared but the phone suddenly turned itself off again. :(
Anyone got a solution for this kind of issue? Any help will be appreciated.
Write a comment »