[Q] DUAL BOOT UBUNTU And JELLY BEAN AND GUIDE

Search This thread

AEblefisk

Member
Aug 18, 2012
21
1
Odense
Finally my version of dual-booting Android and Ubuntu is working too! It seems I was almost there when I had the bootloops when trying to boot Android.

It's been a lot of trial-and-error, but as far as I see these were the important steps which made my Nexus 7 dual-boot Android/Ubuntu. Try them at you own risk:

Start with updating to 4.2 and unlocking. Maybe 4.2 isn't essential, but it should be something for which you have the boot image.
Flash a custom recovery using fastboot, boot it and mount /data
Extract rootfs.tar.gz from the Ubuntu rootfs.img (using simg2img to convert it to ext4 and mounting the ext4 image as a loop filesystem)
Copy rootfs.tar.gz to /data
Reboot to bootloader
Flash the Ubuntu boot.img to recovery using fastboot.
Start recovery. Ubuntu will now install.
(It seems the Ubuntu install touches the boot partition at this point, making it unable to boot Android.)
Reboot to bootloader.
Flash the original boot image (mine was 4.2) to boot using fastboot.

Now enjoy dual boot! :D Normal boot will start Android, recovery boot will start Ubuntu.

There may be an easier way to do this, but this is more or less what worked for me.
 
  • Like
Reactions: lardman

technolust109

Senior Member
May 22, 2011
342
15
Melbourne
awesome! you mind making some kind of easier or video tutorial for those that arent reallysure about what you mean? also, with the both OS on the tab, is there any issues with it sharing the same user partition? thanks.
 

AEblefisk

Member
Aug 18, 2012
21
1
Odense
I think I know how to make this process more simple. Maybe both the custom recovery and the simg2img conversion can be avoided, if the remaining steps are rearranged a bit. Once I try it (and if it works) I'll try to make a more user-friendly tutorial.

I tried playing around with both OS'es today and everything seems to work like it would in single boot Android or Ubuntu, so they seem to co-exist quite well once installed. But I'd like to know why Android on boot breaks when installing Ubuntu to recovery, so boot has to be re-installed. If the Ubuntu installation is trying to write something to its own boot image I'd like to redirect it to the new location in recovery.
 

lardman

Senior Member
Oct 20, 2007
125
28
Bath
The Ubuntu installer carries out the following commands in this order:

fastboot erase boot
fastboot flash boot ./boot.img
fastboot erase userdata
fastboot flash userdata ./rootfs.img
fastboot reboot

I guess that changing the first one to replace boot with recovery might fix the issue.

What's the deal with userdata then? From Android does one see the Ubuntu filesystem? /me goes to read exactly what the partitions are used for.


Ah, what I've said above isn't so important, it's what the on-device setup does that's important. /me goes back to sleep ;)
 
Last edited:

AEblefisk

Member
Aug 18, 2012
21
1
Odense
Ah, what I've said above isn't so important, it's what the on-device setup does that's important. /me goes back to sleep ;)

Right. I did a fresh install of Ubuntu now. It's boring to watch the screen as Ubuntu is installed - no fancy animated presentation of the blessings of this new OS, like we usually get at a time like this. :D But after maybe 10 minutes, right at the end of the install, I noticed it wrote something about flashing initrd to mmcblk0p2. When I was back in Android I checked /dev/block/platform/.../by-name/ and saw mmcblk0p2 is marked LNX, so at the end of the install Ubuntu flashes a new boot image! It doesn't seem to work, since I get bootloops when trying to boot normally afterwards, but still I'd like to find where in the Ubuntu install process this is done.

The installation boot image (which I flash to recovery instead) starts up Ubuntu just fine, so there's no need for flashing a new boot at that time, but maybe the new boot is better or I may break Android if updating the Ubuntu kernel?

---------- Post added at 02:22 AM ---------- Previous post was at 01:48 AM ----------

Here's a less complicated procedure for getting dual boot Android/Ubuntu. This will erase your data, void your warranty etc. It might even blow up your device and curdle the milk in your fridge. It worked OK for me, but now you've been warned!

Start with updating to 4.2.1 and unlocking. 4.2.1 isn't essential, but it should be something for which you have the boot image.

Download the Ubuntu boot and root files using the Ubuntu installer, but don't let it install.

Flash Ubuntu
Code:
fastboot erase recovery
fastboot erase userdata
fastboot flash recovery ~/Downloads/UbuntuNexus7/boot.img
fastboot flash userdata ~/Downloads/UbuntuNexus7/rootfs.img

Start recovery. Ubuntu will now install.
(The Ubuntu install flashes the boot partition at this point, making it unable to boot Android.)

Reboot to bootloader.

Flash the original boot image (mine was 4.2.1) to boot using fastboot.
Code:
fastboot flash boot nakasi-jop40d/boot.img

As before, normal boot will start Android, recovery boot will start Ubuntu.:)

If the Ubuntu install should want to update its initrd at some later time, it will probably flash to boot instead of to recovery. :p That has to be looked into.
Edit: I found the culprit. In /usr/share/flash-kernel/functions the last partition with a working boot image is picked for flashing the new boot image. Since recovery is in mmcblk0p1 and boot is in mmcblk0p2 the latter is chosen.
And since the abootimg call only updates the boot image instead of creating a new one, a mix of Android and Ubuntu is created which explains why I got bootloops.
Now I just have to figure out how to modify the script so it picks the right partition. Maybe abootimg can determine if the existing image is Android or Ubuntu? But I'll save that fun for another night


Edit again: This procedure no longer works. I tried installing a new 13.04 Ubuntu but now the installation boot.img won't serve as an ordinary boot. It stops if the initial tarball has already been unpacked. So the script above must be modified and run so mmcblk0p1 is updated with an ordinary boot image.
 
Last edited:

Raudi1

Senior Member
Jun 11, 2008
326
21
Ostwestfalen
Just discovered this, finished the entire process and am now just waiting for ubuntu to boot.

... But man its been several minute on the "Preparing the root filesystem, please, this will take a few minutes ...." will it always take this long or am i actually stuck on some boot loop thing?...

First Boot takes a while.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    hey guys, for those that havnt seen it today Ubuntu has been released for the Nexus 7 and for both 8GB and 16GB Models! wondering if anyone in the community has figured out how to dual boot it or if it is even possible? thanks all!

    Heres the link of how to install if your wondering


    What you will need:
    Nexus 7 Tablet (8GB or 16GB)
    Standard MicroUSB Cable (should come with the device)
    Ubuntu Nexus 7 Desktop Installer installed on your development system
    Ubuntu 12.04 LTS or Later
    Optional

    Micro USB Host Cable (OTG Cable) - used for attaching keyboard, mouse, etc. Directions on how to get and use one of these are towards the bottom of this page.
    Ubuntu Nexus 7 Desktop Installer
    A simple one-click installer has been provided, and is available in a PPA.


    sudo add-apt-repository ppa:ubuntu-nexus7/ubuntu-nexus7-installer
    sudo apt-get update
    sudo apt-get install ubuntu-nexus7-installer
    Usage instructions for the installer are provided below.

    Unlocking the Nexus 7
    The Nexus 7 ships with a locked bootloader. You must unlock it in order to flash different images to the device. Fortunately, this is a trivial process, and you only need to do it once.

    Warning: Unlocking the bootloader erases all data and resets the device to factory defaults.

    Reboot the Android device into the Android boot loader. To do this, hold the volume down button and press the power button. Continue holding the volume down and power buttons until you see the boot loader UI. The device now displays the boot loader GUI, which looks like this:


    Verify fastboot lists the device:

    $ sudo fastboot devices
    1234567891234567 fastboot
    Start the bootloader unlock process:
    sudo fastboot oem unlock
    You are prompted on screen to unlock the bootloader on the Android device screen. Follow the on-screen directions to continue. Your screen should now look like this:


    Complete the process by rebooting:

    sudo fastboot reboot-bootloader
    Or simply press the power button.

    Installing Ubuntu on Nexus 7
    Once all setup has been completed, the installation can start. To install, ensure the Nexus 7 is in fastboot mode, plug it into your computer (and make sure NO OTHER DEVICES are plugged in).

    Find the installer in the dash (search for 'nexus'):

    This will provide a Graphical Interface for installing Ubuntu. This tool will download the latest image automatically, and flash it accordingly. The flashing step should take about 2 minutes. Once the flashing is complete, the device will reboot and finish the installation. This step can take 10-15 minutes.

    Returning your Nexus 7 to Stock Android
    Warning: Disconnect ALL other mobile devices connected from your computer or they might get erased too. This will erase ALL DATA on your Nexus 7.

    In case anything happens while developing, the system image for Nexus 7 can be found here: https://dl.google.com/dl/android/aosp/nakasi-jro03d-factory-e102ba72.tgz

    After downloading the above tarball, uncompress it with the following:

    tar zxvf nakasi-jro03d-factory-e102ba72.tgz
    Then, place your machine into fastboot mode and run the resulting script:

    cd nakasi-jro03d/
    sudo ./flash-all.sh
    You may get the following warnings, which you can ignore, the restoration will continue anyway.

    archive does not contain 'boot.sig'
    archive does not contain 'recovery.sig'
    archive does not contain 'system.sig'
    Troubleshooting the Install
    If you have problems installing the image, please use the following troubleshooting steps:

    Detach the USB cable, restart the tablet back into fastboot mode, and re-attach the USB cable.
    If problems persist, reboot your host PC.
    If you still have issues, try a different USB cable.
    If you have a 16G tablet, try using the 8G image.
    If you still have issues after doing all this, return the image to stock using the directions above and re-try.
    If none of that works, ask a question on Ask Ubuntu using the mobile tag, or ask for help in the #ubuntu-arm channel on freenode. If you believe it's a bug, file a bug against ubuntu-nexus7 in Launchpad.
    1
    Change your thread title,its misleading.
    1
    I would like to try this but what's the best/easiest way to back up my system? (I.e. app and game save data as well as for directory bind and folder structures). I tried clockworks backup process before, but I either did it wrong or it doesn't cover everything.

    Can I just copy paste everything from my root folder?

    you might want to try and use titanuium backup and copy out the entire "titanium backup" folder onto your computer, so when you revert back to android you should be able to copy it back in and restore from titanium backup. hope it works. :)
    1
    Finally my version of dual-booting Android and Ubuntu is working too! It seems I was almost there when I had the bootloops when trying to boot Android.

    It's been a lot of trial-and-error, but as far as I see these were the important steps which made my Nexus 7 dual-boot Android/Ubuntu. Try them at you own risk:

    Start with updating to 4.2 and unlocking. Maybe 4.2 isn't essential, but it should be something for which you have the boot image.
    Flash a custom recovery using fastboot, boot it and mount /data
    Extract rootfs.tar.gz from the Ubuntu rootfs.img (using simg2img to convert it to ext4 and mounting the ext4 image as a loop filesystem)
    Copy rootfs.tar.gz to /data
    Reboot to bootloader
    Flash the Ubuntu boot.img to recovery using fastboot.
    Start recovery. Ubuntu will now install.
    (It seems the Ubuntu install touches the boot partition at this point, making it unable to boot Android.)
    Reboot to bootloader.
    Flash the original boot image (mine was 4.2) to boot using fastboot.

    Now enjoy dual boot! :D Normal boot will start Android, recovery boot will start Ubuntu.

    There may be an easier way to do this, but this is more or less what worked for me.