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
wget http://rcn-ee.net/deb/rootfs/quantal/ubuntu-12.10-r2-minimal-armhf-2012-11-29.tar.xz
  • 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 ./setup_sdcard.sh --mmc /dev/<sdx> --uboot bone

Finished flashing the Ubuntu image into the SD card.

For the record (Older releases):

Release 1: http://rcn-ee.net/deb/rootfs/quantal/ubuntu-12.10-r1-minimal-armhf-2012-10-19.tar.xz
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.

Voilà

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
passwd

Connect the Beaglebone to the internet


I plugged an Ethernet cable into the Beaglebone, and checked if the connection was OK.
# On the Beaglebone
ping www.google.com
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.

Autocompletion


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
127.0.0.1 localhost
127.0.1.1 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
arm
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
sshbeaglebone

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?



Acknowledgements



21 comments:

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

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

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

      It's fixed now.

      Delete
    2. Verified=Tools=Available

      Kali Linux Master Class
      D33p/D@rk Web Complete Course
      Spamming Tools/Tutorials
      BTC Cracker/Flasher
      Key LOggers
      Hacking Stuff/Books/Tuts
      SMTP's
      RDP's
      C-panel's
      Shells
      Web-mailers
      Mailers/Senders/Bomber
      Combos
      Carding Cashout/Spamming Methods
      Brutes
      Premium Cracked Versions
      Viruses/RAT's
      Scam Page Scripting

      7528 22040 I.C.Q
      @killhacks Tel Gr

      Fresh Spammed & Legit Fullz/Pros/Leads

      High CS Fullz (700+)
      CC Fullz
      SSN+DOB FULLZ
      SSN+DOB+DL+Emp Details Fullz
      Premium Fullz
      Dumps With Pin Codes 101/202 (Good Balanced)
      Business Fullz with EIN

      7528 22040 I.C.Q
      @killhacks Tel Gr

      All stuff will be legit & Verified
      Invalid found will be replace instantly
      Just hit me up Guys

      Delete
  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.

    ReplyDelete
    Replies
    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

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

    Rick B

    ReplyDelete
  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?

    Thanks.

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  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 #.

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

      Delete
  8. This comment has been removed by the author.

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

    ReplyDelete
  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 192.168.7.1
    ubuntu@arm:~$ sudo su
    [sudo] password for ubuntu:
    root@arm:/home/ubuntu# sudo apt-get update && sudo apt-get install bash-completion
    Err http://ports.ubuntu.com saucy InRelease

    Err http://ports.ubuntu.com saucy-updates InRelease

    Err http://ports.ubuntu.com saucy Release.gpg
    Could not resolve 'ports.ubuntu.com'
    Err http://ports.ubuntu.com saucy-updates Release.gpg
    Could not resolve 'ports.ubuntu.com'
    Reading package lists... Done
    W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/saucy/InRelease

    W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/saucy-updates/InRelease

    W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/saucy/Release.gpg Could not resolve 'ports.ubuntu.com'

    W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/saucy-updates/Release.gpg Could not resolve 'ports.ubuntu.com'

    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:
    bash-completion
    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 http://ports.ubuntu.com/ubuntu-ports/ saucy/main bash-completion all 1:2.0-1ubuntu3
    Could not resolve 'ports.ubuntu.com'
    Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/b/bash-completion/bash-completion_2.0-1ubuntu3_all.deb Could not resolve 'ports.ubuntu.com'
    E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

    ReplyDelete
  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?

    ReplyDelete
  12. hi how should i download beaglebone image file?

    ReplyDelete
  13. This comment has been removed by the author.

    ReplyDelete
  14. Selling USA FRESH SPAMMED SSN Leads/Fullz, along with Driving License/ID Number with EXCELLENT connectivity.

    **PRICE**
    >>1$ FOR EACH FULLZ WITHOUT DL NUMBER
    >>2$ FOR EACH LEAD/FULLZ/PROFILE
    >>5$ FOR EACH PREMIUM LEAD/FULLZ/PROFILE

    **DETAILS IN EACH LEAD/FULLZ**

    ->FULL NAME
    ->SSN
    ->DATE OF BIRTH
    ->DRIVING LICENSE NUMBER WITH EXPIRY DATE
    ->ADDRESS WITH ZIP
    ->PHONE NUMBER, EMAIL, I.P ADDRESS
    ->EMPLOYEE DETAILS
    ->REALTIONSHIP DETAILS
    ->MORTGAGE INFO
    ->BANK ACCOUNT DETAILS

    >All Leads are Tested & Verified.
    >Invalid info found, will be replaced.
    >Serious buyers will be welcome & I will give discounts on bulk orders.
    >Fresh spammed data of USA Credit Bureau
    >Good credit Scores, 700 minimum scores
    >Bulk order will be preferable
    >Minimum order 20 leads/fullz
    >Hope for the long term business
    >You can asked for samples, specific states & zips (if needed)
    >Payment mode BTC, ETH, LTC, Paypal & PERFECT MONEY

    Email > leads.sellers1212@gmail.com
    Telegram > @leadsupplier
    ICQ > 752822040

    ''OTHER GADGETS PROVIDING''

    >SSN Fullz
    >Dead Fullz
    >Carding Tutorials
    >Hacking Tutorials
    >SMTP Linux Root
    >DUMPS with pins track 1 and 2
    >Sock Tools
    >Server I.P's
    >USA emails with passwords (bulk order preferable)

    **Contact 24/7**

    Email > leads.sellers1212@gmail.com
    Telegram > @leadsupplier
    ICQ > 752822040

    ReplyDelete
  15. Verified=Tools=Available

    Kali Linux Master Class
    D33p/D@rk Web Complete Course
    Spamming Tools/Tutorials
    BTC Cracker/Flasher
    Key LOggers
    Hacking Stuff/Books/Tuts
    SMTP's
    RDP's
    C-panel's
    Shells
    Web-mailers
    Mailers/Senders/Bomber
    Combos
    Carding Cashout/Spamming Methods
    Brutes
    Premium Cracked Versions
    Viruses/RAT's
    Scam Page Scripting

    7528 22040 I.C.Q
    @killhacks Tel Gr

    Fresh Spammed & Legit Fullz/Pros/Leads

    High CS Fullz (700+)
    CC Fullz
    SSN+DOB FULLZ
    SSN+DOB+DL+Emp Details Fullz
    Premium Fullz
    Dumps With Pin Codes 101/202 (Good Balanced)
    Business Fullz with EIN

    7528 22040 I.C.Q
    @killhacks Tel Gr

    All stuff will be legit & Verified
    Invalid found will be replace instantly
    Just hit me up Guys

    ReplyDelete