Monday, October 22, 2012

Beaglebone: Installing Ubuntu 12.10

I've got my hands on a Beaglebone, and the first thing I did was installing the latest Ubuntu 12.10 on it. Here how I proceeded.

This post is mainly for self-documenting, feel free to follow my footsteps at your own risk. These steps will probably also work on the Beagleboard.

Back up the original image

The Beaglebone comes with the Linux Ångström distribution. So I backed up the original image, in case something failed. Even if I were to stick with the Ångström distro, it's a good idea to back up the original image.

I removed the microSD that shipped with the Beaglebone, and inserted it into my PC SD slot. Then I checked in which partition it got mounted, using the following command.
df -l
/dev/sda is my PC harddrive, and /dev/sdb is the Beaglebone SD card.

After identifying where the SD was mounted, I used the following command to backup the SD.
dd if=/dev/<sdx> | gzip > /path/to/image.gz
In case I needed to restore the image, I'll have to use the following command:
gzip -dc /path/to/image.gz | dd of=/dev/<sdx>

Installing Ubuntu

I followed the instructions from elinux. These are the summarized steps:
  • Download the minimal Ubuntu 12.10 image
cd ~/Desktop
  • Verify the integrity of the image
md5sum ubuntu-12.10-r2-minimal-armhf-2012-11-29.tar.xz
Which should match the following output
b0ee1964a3f8196f4f1a501d1d2ac83a ubuntu-12.10-r2-minimal-armhf-2012-11-29.tar.xz
  • Untar the package
tar xJf ubuntu-12.10-r2-minimal-armhf-2012-11-29.tar.xz
cd ubuntu-12.10-r2-minimal-armhf-2012-11-29
  • Flash the image into your SD
sudo ./ --mmc /dev/<sdx> --uboot bone

Finished flashing the Ubuntu image into the SD card.

For the record (Older releases):

Release 1:
MD5: 31be6761a37af98906c5c1e892601e85

Connecting to your Beaglebone

After flashing the Ubuntu image, I removed the SD from my PC and plugged it back into the Beaglebone. I decided to make the first connection using the tty over USB.

After connecting the Beaglebone to my PC using a USB cable, I had to figure out the exact name of the ttyUSBx with the following command.
dmesg | grep ttyUSB
From documentation, ttyUSB0 -> JTAG, ttyUSB1 -> UART (terminal)

I used GNU screen to stablish the connection:
sudo apt-get install screen
screen /dev/<ttyUSBx> 115200
After the connection was established. I saw no output so I pressed the reset button on the Beaglebone.


The default login information is below.
  • login: ubuntu
  • password: temppwd

Things to do after installing Ubuntu

OK, I logged in! ... Now what?

Change your password

First thing first, I changed the default password to something stronger
# On the Beaglebone

Connect the Beaglebone to the internet

I plugged an Ethernet cable into the Beaglebone, and checked if the connection was OK.
# On the Beaglebone
I let ping run for a while and then I finished it with Ctrl+C.
Notice the "0% packet lost", that's a Win.

OK I lied, it didn't work the first time, I got 100% packet lost, but resetting the Beaglebone solved the problem.


Next, I enabled bash completion - a.k.a. the tab autocompletion:
# On the Beaglebone
sudo apt-get update && sudo apt-get install bash-completion

Change the hostname

The terminal prompt says "ubuntu@arm". This means the Beaglebone hostname is "arm". I changed that with the following commands.
# On the Beaglebone
cat /etc/hosts
I got the following output.
# On the Beaglebone localhost arm
So I changed the second line with:
# On the Beaglebone
sudo nano /etc/hosts
# changed the second line from arm to <new-hostname>
Next, I did:
# On the Beaglebone
cat /etc/hostname
And got:
# On the Beaglebone
I changed that with:
# On the Beaglebone
sudo nano /etc/hostname
# changed the hostname from arm to <new-hostname>
Finally I rebooted the Beaglebone to apply the changes.
# On the Beaglebone
sudo reboot

Change your login name

Now the terminal prompt says "ubuntu@beaglebone", the login is "ubuntu". I also changed that.

I had to enable the root account:
# On the Beaglebone
sudo passwd root
# Entered a temporary password
Pressed "Ctrl + D" to logout and I logged as root:

Logging as root.

I changed the old username with:
# On the Beaglebone
usermod -l <new-username> ubuntu
I also added a comment to my new user:
# On the Beaglebone
usermod -c "<full-name-or-comment>" <new-username>
Next, I moved to my new home:
# On the Beaglebone
usermod -md /home/<new-username> <new-username>
Finally, I also renamed the "ubuntu" group to match my new username:
# On the Beaglebone
groupmod -n <new-username> ubuntu
I logged out (Ctrl + D) and logged with my new username:

Logged with my new username.

Finally I locked the root account:
# On the Beaglebone
sudo passwd -l root

Set up a zeroconf hostname

A zeroconf hostname, simplifies SSHing with a local machine by assigning it a hostname on the LAN. This way I don't need to know the IP (which can change over time) to start a SSH session.
#On the Beaglebone
sudo apt-get install avahi-daemon
Now I can connect to the BeagleBone via ssh using the following command:
# On the PC
ssh <beagle-username>@<beagle-hostname>.local

SSHing the Beaglebone

I finished the screen session, using Ctrl+A and then K. I rebooted the Beaglebone, this way the avahi daemon got launched on the next boot.

ssh jorge@beaglebone.local instead of ssh jorge@192.168.1.x

SSH login without password

Everytime I SSH'ed the Beaglebone I needed to input the Beaglebone login and password. The next commands got rid of that.
# On the PC
ssh-keygen # Don't enter a passphrase
ssh-copy-id <beagle-username>@<beagle-hostname>.local

SSH without login

Install GNU screen

I quickly found out that I needed multiple SSH sessions to open multiple terminals on the Beaglebone. Searching for a workaround I found GNU Screen.

With GNU screen I can create multiple "screens", with one terminal inside each of them. All this can be done with keyboard commands.
#On the Beaglebone
sudo apt-get install screen
To start screen I needed to use the following command on every login.
#On the Beaglebone
screen -S 1
This was annoying, so I automated the task:
# On the PC
gedit ~/.bashrc
I appended the following text:
Now with a single command, I can SSH login into the Beaglebone and enter in a running "screen" or create a new "screen", if it doesn't exists.
#On the PC

SSH session with the Beaglebone splitted in 3 using screen.

Other important software

I also installed additional software:
#On the Beaglebone
sudo apt-get install man-db # Manuals
sudo apt-get install vim # Text editor
sudo apt-get install octave # Numerical package
sudo apt-get install build-essential # make, gcc, et al.

What's next?



  1. muy buen aporte mi amigo estare pendiente de lo de python

  2. The default distro is called Ångström and not Armstrong.

    1. Thank you very much for pointing out my mistake.

      It's fixed now.

  3. Hi, when i type in the second command from the top in vmware which is::

    dd if=/dev/ | gzip > /path/to/image.gz
    I am getting this message:
    bash: /path/to/image.gz: No such file or directory
    dd: opening ' /dev/sdb': Permission denied

    can any one help me please.

    1. Hey Emir,

      Be sure to use the correct paths, like:

      dd if=/dev/sdb | gzip > ~/myBackupts/beaglebone.gz

      As for the permission denied problem, be sure to plug your SD card in your PC SD card slot and then unmount the partition before using the command, because it should automount after plugging it in.

      Hope that helps

  4. Nice work. Thanks, this helped me a lot.

    Rick B

  5. Hi Jorge,

    I also have gone throw these steps, but when I connected Bone to PC only ttyUSB0 was attached. Maybe you know how to resolve this issue and activate ttyUSB1?


  6. This comment has been removed by the author.

  7. I'm trying to follow your instructions on SSH Login Without Password but I'm not getting it to work. I have a few questions so I will post each on a separate comment.

    A) In the instruction for ssh-keygen #, should the phrase "Don't enter a passphrase" actually be typed? I'm thinking this should be within <> as an instruction and not something actually entered along with ssh-h=keygen #.

    1. Oops. I now see the # is meant to identify this as a comment.

  8. This comment has been removed by the author.

  9. Is it possible to install octave on the angstrom distribution

  10. got the following o/p when upgrading.. i was booting from sd card
    .pls help me out
    Last login: Sun Dec 15 18:08:40 2013 from
    ubuntu@arm:~$ sudo su
    [sudo] password for ubuntu:
    root@arm:/home/ubuntu# sudo apt-get update && sudo apt-get install bash-completion
    Err saucy InRelease

    Err saucy-updates InRelease

    Err saucy Release.gpg
    Could not resolve ''
    Err saucy-updates Release.gpg
    Could not resolve ''
    Reading package lists... Done
    W: Failed to fetch

    W: Failed to fetch

    W: Failed to fetch Could not resolve ''

    W: Failed to fetch Could not resolve ''

    W: Some index files failed to download. They have been ignored, or old ones used instead.
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following NEW packages will be installed:
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 173 kB of archives.
    After this operation, 892 kB of additional disk space will be used.
    Err saucy/main bash-completion all 1:2.0-1ubuntu3
    Could not resolve ''
    Failed to fetch Could not resolve ''
    E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

    1. edit the file /etc/apt/sources.list and add to the end

      deb saucy main universe restricted multiverse
      deb-src saucy main universe restricted multiverse

      deb saucy-security main universe restricted multiverse
      deb-src saucy-security main universe restricted multiverse

      deb saucy-updates main universe restricted multiverse
      deb-src saucy-updates main universe restricted multiverse

      deb saucy-backports main restricted universe multiverse
      deb-src raring-backports main restricted universe multiverse


      execute: apt-get update

  11. how do i flash the emmc if i hav copied a ubuntu-13.10-console-armhf-2013-11-15 into sd card and ooted through it successfully?

  12. hi how should i download beaglebone image file?