Installing Ubuntu on the BeagleBone Black

May 18, 2013, 7:16 p.m.

In order to install Ubuntu on the BeagleBone Black, essentially two steps need to be taken. The first step is imaging an SD card with Ubuntu because in order to flash the eMMC memory with Ubuntu, you CANNOT be booted to the eMMC, you need to be booted off of an external source (i.e. an SD card).

Install Ubuntu to the SD Card

On your computer (not on the Beaglebone Black) you need to image an SD card with the Ubuntu image. Luckily a man named Robert Nelson has created an amazing shell script that images SD cards for you and makes them bootable. Note: you must use this method to create the Ubuntu image, I tried using Win32DiskImager and flashnul to image my SD card and both did not work.

On your Linux computer (if you do not have Linux, try Cygwin):

First download the image from RCN-EE:

$ wget [Edit: get an image from the link above, they remove old images.]

Then, unpack the TAR file and change directory into the directory automatically created:

$ tar xJf ubuntu-13.04-console-armhf-2013-04-26.tar.xz

$ cd ubuntu-13.04-console-armhf-2013-04-26

Now probe your computer to find where the SD card is located (assuming you have plugged in the SD card already) and then run the command to start the setup_sdcard.sh script on the selected SD card (in my case /dev/sdc):

$ sudo ./setup_sdcard.sh --probe-mmc

$ sudo ./setup_sdcard.sh --mmc /dev/sdc --uboot bone_dtb

Once the SD card is successfully imaged, you now have a bootable Ubuntu SD card for the Beaglebone Black. Take out the SD card, plug it into the Beaglebone Black's SD card reader and boot the device while holding down the USER/BOOT button (located right next to the SD card reader) to boot to the Beaglebone Black from the SD card.

Installing Ubuntu on the BeagleBone Black's internal eMMC (optional)

Once you have Ubuntu on the SD card, you do not need to image the BeagleBone Black's internal eMMC with the same image, you can just simply use the SD card. I recommend using the eMMC portion because it is much faster than using an SD card.

On the BeagleBone Black:

While booted into the BeagleBone Black on an SD card (NOT on the eMMC!) download the Ubuntu image again:

$ wget http://rcn-ee.net/deb/rootfs/raring/ubuntu-13.04-console-armhf-2013-04-26.tar.xz

Then, unpack the TAR file and change directory into the directory automatically created:

$ tar xJf ubuntu-13.04-console-armhf-2013-04-26.tar.xz

$ cd ubuntu-13.04-console-armhf-2013-04-26

Now probe your BeagleBone Black to verify that the eMMC is located in /dev/mmcblk1 and then run the command to start the setup_sdcard.sh script on the eMMC portion (if you receive a probe readout after running the setup_sdcard.sh file that means you need to edit the shell file like I had to, see below):

$ sudo -s ./setup_sdcard.sh --probe-mmc

$ sudo -s ./setup_sdcard.sh --mmc /dev/mmcblk1 --uboot bone_dtb

Now when I was running the shell file on the mmcblk1 portion, I was unable to get it to work, it kept giving me a probe readout saying it was unable to find mmcblk1. In order to fix this, I had to edit the shell file. Remove this portion of code from the setup_sdcard.sh file in the check_mmc() function:

else
    echo ""
    echo "Are you sure? I Don't see [${MMC}], here is what I do see..."
    echo ""
    echo "$FDISK_EXEC -l:"
    LC_ALL=C $FDISK_EXEC -l 2>/dev/null | grep "Disk /dev/" --color=never
    echo ""
    echo "mount:"
    mount | grep -v none | grep "/dev/" --color=never
    echo ""
    exit

Now rerun the same command as before, and now instead of giving you a probe readout, it should begin formatting the eMMC memory. Once that is done, shutdown the BeagleBone Black, unplug the SD card (NOTE: you CANNOT leave an SD card in the BeagleBone Black that contains an .img file, as it will prioritize boot to the SD card!), and boot the device up as normal.

Once the device boots up without the SD card, you should be running Ubuntu now and not Angstrom.

Update: some users have reported some dependencies are needed to complete the install process. Check the comments for more information.

Discussion

Scott on May 28, 2013, 1:19 a.m.

Hi, when I do:

$ tar xJf ubuntu-13.04-console-armhf-2013-04-26.tar.xz

I get:

"tar: Cannot use multi-volume compressed archives".

Dan on June 6, 2013, 5:50 a.m.

I used this to install ubuntu-13.04-console-armhf-2013-05-29.tar.xz and it worked like charm. I didn't encounter any issues with tar as mentioned above, but did have to remove the "else" clause in the check_mmc function setup_sdcard.sh script.

Zach Rohde on June 8, 2013, 4:11 p.m.

Dan, glad it worked for you! I am also glad to hear I am not the only one who had problems with the shell script.

wolfrum, that image is fine but you do not have to necessarily use that image. That image is a bit out dated now. You should be able to use the newest Ubuntu-arm image that I supplied in my post. But it really does not matter!

Voort on June 16, 2013, 9:38 a.m.

I walked through the tutorial and installed Ubuntu 13.04 on the eMMC on my Beaglebone Black. I even went through and built a 512MB swap file on the eMMC to give me some extra memory to work with. I also uninstalled Apache2 and replaced it with Nginx for a more lightweight web server. I plan on using my BBB for some web app development. I have a nice 32GB class 10 micro SD card that I would like to use as my storage volume. I have seen in the past where folks setup /home on a separate volume but I am not sure if I want to do that. My current plan is to setup a direct on the storage volume for each user and then link to it from their home directory (as an example: the eMMC has /home/voort/Public and I build a symbolic link to /voort/Public on the storage volume). This way each user could develop in their own directory and I can have Nginx point to those Public directories on the storage volume to display web content. My question is, what is the best way to create that storage volume and insure that it is mounted if the BBB gets rebooted? Could you throw together a post that shows that or do have a link to a post that would help with that? Thanks!

Greg Maxwell on June 20, 2013, 5:20 a.m.

So I have gotten ubuntu working with networking, ssh etc, Now I want to clone the image on the BeagleBone Black and use the image on another BBB. What is the best way to do this?
I was also wondering what a barebone OS would be need so I could set it up so a BBB to do a PXE boot.

Xiaorong Liao on June 22, 2013, 2:31 a.m.

Thank you for the turoria.I want to know if Iboot from ubuntu on the sd card.Can i keep login the new system by use the usb cap on putty on 192.168.7.2:22.
I'm not good at english.Hope you can understand me.

Zach Rohde on June 23, 2013, 12:29 a.m.

Voort, to auto-mount a device, you should follow these steps:

1) Create mounting directory and chmod to 777
mkdir /mnt/usb
sudo chmod 777 /mnt/usb 2) Edit the fstab file...
sudo nano /etc/fstab 3) Add entry for the hard drive (find your mount location, mine was sda1):
/dev/sda1 /mnt/usb auto users,auto 0 0 Instead of "users, auto" use "defaults" if you wish to have root be the only user to have access. 4) Save the changes and restart.

Link for reference: https://help.ubuntu.com/community/AutomaticallyMountPartitions

Greg, I have never created a clone image of an OS before, so I have no idea. And Ubuntu or Fedora on the non-GUI version is the most "barebone" OS that I am familiar with (there is probably others, but good luck finding good tutorials or docs haha).

Xiaorong, I am not sure if you can still access the beaglebone through USB, but you can access it over ethernet using SSH. Follow this link, it should work: http://www.liberiangeek.net/2012/03/enable-ssh-secure-shell-in-ubuntu-12-04-precise-pangolin/

Xiaorong Liao on June 23, 2013, 2:55 a.m.

Thank you for you reply.This is my problem.
I don't have a HDMI cable and a monitor.So I need to access the beaglebone black through USB or ethernet.And use a usb cable is really simple(both power and access).
If I access it over ethernet after install the new ubuntu,how can i know the ip address and whether the openssh is up.if not then i can't access it.
So how did you access it after install the new OS.Connect a monitor by use a HDMI cable?

Zach Rohde on June 23, 2013, 9:32 p.m.

Xiaorong, I believe that SSH is initially enabled upon new install, have you tried to connect via SSH yet? Also just for reference, when your beaglebone connects to your router it is assigned an IP address (I would make this a static IP address), so all you need to do is boot up PuTTY, then enter that IP address that your router assigned to the beaglebone and the custom port that you entered when setting up SSH. Then it will prompt you for the root username/password.

Hope this helps!

Zach Rohde on July 6, 2013, 11:05 p.m.

Tim, where is the fun in that? Haha.

Connor, thanks for the heads up, the link should be fixed now (it appears as though they remove old images instead of keeping them).

MrMaxx on July 23, 2013, 4:33 a.m.

Is there any possible way of installing Cloud9 IDE onto Ubuntu again (Like it is on Angstrom) ?

Googled hard, but without success :S

Zach Rohde on July 24, 2013, 4:26 p.m.

MrMaxx, Cloud9 IDE appears to be a fully in-browser IDE, so I think you just go to their website and sign up to use it. It does appear as though you can install it locally after you have logged in. I don't have an account so I can't verify that, but I did find a couple good guides on installing Cloud9 locally:

http://www.samclarke.com/2012/07/how-to-install-cloud-9-ide-on-ubuntu-12-04-lts-precise-pangolin/

if the first one doesn't work:

http://gratdevel.blogspot.com/2011/03/setting-up-cloud9-on-ubuntu-1010-32-bit.html

Edu on Sept. 5, 2013, 9:04 p.m.

Thank you very much for your post!
I have been fighting for a while and your tutorial finally saved me.
I missed just two things along the process that I needed (maybe you want to add them):
# apt-get install xz-utils
# apt-get install parted

Zach Rohde on Sept. 7, 2013, 7:53 a.m.

Edu, glad to hear everyone worked out well. As for your suggestion, I will update the post to tell users about other possible dependencies needed.

Post a Comment

Field names followed by an * are required fields.

Note: comments are queued and moderated before publication.