Logicalwebhost Cheatsheet

Linux & Open Source Cheatsheets & Howto's

Skip to: Content | Sidebar | Footer

BeagleBone Black

Beaglebone black comes with a stripped down OS called Angstrom. Here are some tips to manage it.

network setup

from the command line. By default BBB is set to DHCP on eth0, which is the onboard ethernet adapter. Youll need to to get the ‘ethernet_9059af56d414_cable’ identifier for your interface, YOURS WILL BE DIFFERENT THAN THIS, but just insert whatever yours is into the next commands. Also, I’m setting this up for a static IP of with a netmask of and a gateway of, yours will almost certainly be different than this, so change it to reflect your network. My nameservers here are two public Google nameservers, but you can change that to whatever nameserver you want.

/usr/lib/connman/test/get-services <-- shows you what your network settings are, you need the ethernet-blahblahblah for next steps
/usr/lib/connman/test/set-nameservers ethernet_9059af56d414_cable
/usr/lib/connman/test/set-ipv4-method ethernet_9059af56d414_cable manual
SSH - it runs a dropbear daemon by default, you can login on port 22
opkg list | grep ssh <-- lists packages that contain 'ssh'
opkg update <-- updates local software list
opkg upgrade <-- upgrades system

install vim and make it do color syntax:

opkg install vim
vim /usr/share/vim/vimrc <-- uncomment the following lines:
  if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch

get color prompt, color ls, and use vim instead of vi:

vi /home/root/.profile
  # ~/.profile: executed by Bourne-compatible login shells.
  if [ -f ~/.bashrc ]; then
   . ~/.bashrc
  # path set by /etc/profile
  # export PATH
vi /home/root/.bashrc
  # ~/.bashrc: executed by bash(1) for non-login shells.
  PS1='\[\033[0;31m\]\[\033[0;37m\]\[\033[0;35m\]${debian_chroot:+($debian_chroot)}\[\033[0;35m\]\u@\h\[\033[0;37m\]:\[\033[0;36m\]\w >\[\033[0;00m\] '
  umask 022
  export LS_OPTIONS='--color=auto'
  alias ls='ls $LS_OPTIONS'
  alias ll='ls $LS_OPTIONS -l'
  alias l='ls $LS_OPTIONS -lA'
  alias vi='vim'
su -

Beaglebone Black lighttpd web server howto

First you have to disable the weird default control panel (those services are located in /etc/systemd/system/multi-user.target.wants)

systemctl disable bonescript.socket
systemctl disable bonescript.service
systemctl disable bonescript-autorun.service
systemctl stop bonescript.socket
systemctl stop bonescript.service
systemctl stop bonescript-autorun.service

make sure they’re not running by looking for them here:

systemctl list-units

I had to reboot the box, for some reason I couldn’t kill a couple of the processes, if you know how, let me know.

Then install lighttpd and php

opkg install php php-cgi php-cli
opkg install lighttpd lighttpd-module-fastcgi
opke install mysql5
/etc/init.d/lighttpd start

You should set up a root password at least for mysql like:

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h beaglebone password 'new-password'
Alternatively you can run:
which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Then you have to set up your html like:

vi /www/pages/index.html  <--change to whatever besides the default site of 'It Works!'

BeagleBone Black Debian Wheezy Howto

I tried to do a netinstall on the eMMC, but it had broken networking, i.e. it wouldn’t recognize the ethernet port. Thankfully, the folks over at armhf.com had a workaround. With a little help from them and also another image I got from Robert Nelson, I have a working, bootable Debian install on the eMMC. Here’s how I did it:

1. Find a microSD card and a USB adapter so you can insert it into a Linux laptop (well, this howto is using a Linux laptop, there are other ways to do it)

2. Figure out which drive your USB/microSD is. This is VERY IMPORTANT, or you could wipe out the har drive on your laptop. Usually your laptop hard drive will be /dev/sda, and your microSD will be /dev/sdb. On my Mint Linux laptop (VM) I did:

fdisk -l
Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders, total 104857600 sectors      
Units = sectors of 1 * 512 = 512 bytes                                    
Sector size (logical/physical): 512 bytes / 512 bytes    
I/O size (minimum/optimal): 512 bytes / 512 bytes                                                   
Disk identifier: 0x0008bb5a                                                      
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   102762495    51380224   83  Linux
/dev/sda2       102764542   104855551     1045505    5  Extended
/dev/sda5       102764544   104855551     1045504   82  Linux swap / Solaris
Disk /dev/sdb: 7822 MB, 7822376960 bytes
72 heads, 8 sectors/track, 26524 cylinders, total 15278080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1           2048      198655       98304    e  W95 FAT16 (LBA)

This means my distro thought /dev/sda was my main hard drive and that /dev/sdb is my USB stick. It also thought /dev/sdb1 would be the first partition on my microSD/USB stick. It doesn’t matter if you already have a partition on your /dev/sdb drive called /dev/sdb1 (or whatever), the script will blow that away and make its own partition table

3. Now you have to go get the stuff you want to write to your microSD like this:

mkdir /usr/src/beaglebone
cd /usr/src/beaglebone
wget http://s3.armhf.com/debian/wheezy/bone/debian-wheezy-7.2-armhf-3.8.13-bone30.img.xz
MAKE SURE ON THE NEXT STEP /dev/sdb really is your microSD, or this will eat your system
xz -cd debian-wheezy-7.2-armhf-3.8.13-bone30.img.xz > /dev/sdb

The xz command took around 5 minutes on my laptop, so be patient. When it’s done if you run fdisk -l you should see two partitions, one for it to boot, and one for your operating system.

Now you can safely eject your microSD/USB card from your laptop and insert it into a powered down BBB board. Make sure it’s clicked in place, and not just hanging out a bit, you should hear a little click, and it should be stuck in there.

Make sure your power supply will supply at least 1A of power or more, since the build can consume more than 500mA, which can make some USB power supplies puke and the process fail.

After that, hold down the tiny S2 ‘Boot Switch’ button on the corner and plug in the power cable, which will turn the unit on, here’s a picture of it from circuitco.com’s website:

You should continue to hold the button until the first User LED comes on. This means it’s starting to boot off the microSD.

You still don’t have the image that you’ll need to flash your eMMC, you just have an operating system (Debian) that’s booting and running off your microSD, so next we go get the image you’ll need to burn to the eMMC. This two-step process is strange, but you can’t burn an image to the same device you’re booting off of, so that’s the logic. You have to boot into an operating system that’s running on the BBB, but not on the eMMC onboard the BBB.

Once you boot from your microSD, you need to set up your network, well, if your router doesn’t do DHCP. If it does do DHCP, you can *probably* just run the commands to go get the image and burn it. If you can’t ping the outside network (google.com etc), then it won’t go fetch the image you need to download.

Here are the commands to run if you don’t have a DHCP server upstream:

login with username/password of: debian
sudo passwd root
ifconfig eth0 192.168.whatever.whatever netmask up
route add default gw 192.168.whatever.1 eth0
nano /etc/resolv.conf
nameserver <-- add this line to the TOP of that file, then save/exit
ping yahoo.com

If this worked, you should be able to ping yahoo.com. If you already had a working network, then do:

cd /usr/src/
wget --no-check-certificate https://rcn-ee.net/deb/flasher/wheezy/BBB-eMMC-flasher-debian-7.2-2013-11-15.img.xz

Here again, we have to KNOW which partition you’re going to burn the image to, or it will simply overwrite your microSD and you’ll have to start over. I ran fdisk -l, and it told me that my eMMC was /dev/mmcblk1, which would normally be true if you’re booting off microSD. On this drive you might see more than one partition, but you’re really just verifying that it’s around 2G, that’s the main thing. If it is, do (this should take around 5 minutes):

 xz -cd BBB-eMMC-flasher-debian-7.2-2013-11-15.img.xz > /dev/mmcblk1

Once this is done do:

shutdown -h now

and after all the lights go out, remove the power cord, then eject your microSD card, then plug the power back in, it should boot onto your eMMC and be running Debian Wheezy 🙂

Default username/password:
    username: debian
    password: temppwd
Default root user/password
    user: root
    password: root

You’ll shortly thereafter find that the Wheezy you’re running has made use of every bit of space on the eMMC, and you’ll have to delete something to do much of anything useful, like install a package. I did this by deleting some unused locales and then powering down the BBB, inserting a blank microSD and formatting it and mounting stuff on that instead of the root filesystem.

getting serial RS-232 cape to work

find out if your serial port is already enabled by doing:

beaglebone black original images

are available here, in case you need to rebuild stuff

the link to the default image is here

Write a comment

You need to login to post comments!