Beaglebone Linux 101: Configuring Angstrom Linux

My previous two articles about the Beaglebone (here and  here) focused on using it as a development platform for handling Arduino-like tasks: interacting with digital, analog and serial devices.

In this article I’m going to cover the basics of using the Beaglebone in a different but complementary role: as a network-connected Linux computer.

If you’re not already familiar with Linux you might be tempted to ignore this aspect of the Beaglebone — once you’ve figured out how to copy programs onto the Beaglebone and run them,  you’re good to go.  However,  by doing some basic Linux configuration you can open up a lot of extra functionality, such as editing files on the Beaglebone directly from your desktop PC, or making the Beaglebone command line more user friendly.

I’m going to focus on the Angstrom Linux distribution that is included in the microSD card packaged with each Beaglebone. Angstrom is not as widely used as other flavours of Linux, like Ubuntu or Fedora. This can be a frustrating to newcomers, since you’re less likely to figure out how to do things by Googling for the answer. However, Angstrom is well suited to a memory and storage-constrained platform like the Beaglebone, being bloat-free and able to squeeze out more performance from the ARM processor.

I should also mention off the top that I’m not going to show you how to run a spreadsheet, browser or any other GUI applications on the Beaglebone. That is possible, even without a cape that has a video port (by using VNC), but I think you’re likely to be disappointed. The Beaglebone’s memory and CPU constraints will cause a GUI system to be annoyingly slugglish . Think of it more as an Arduino on steroids, not a poor man’s PC.

Configuring a terminal on Windows

(Sorry Mac and Linux users – the first couple of sections are Windows-centric.)

Whether you connect to the Beaglebone via USB or over the network using SSH, the best terminal software to use on Windows is PuTTY.

You might be scared off after a glimpse of PuTTY’s plain Jane website – it looks like a relic from the early days of the Internet. Trust me, though: PuTTY is the way to go. Unlike other Windows terminal programs, it “gets” Linux. It may not be the best all-around terminal program, but it’s the best Windows client for a Linux server.

PuTTY is bristling with options, but for the most part the default settings are fine.  When the Beaglebone is connected via USB, select Serial, fill in the COM port ID, and change the Speed to 115200.  When connecting over the network, select SSH and fill in the IP address.  You should also fill in a  name in the Saved Sessions textbox and click Save.

With the default settings, you’ll find that some keys don’t work as expected.  For example, neither Home nor End will work when editing the command line.  To fix this, under Connection –> Data, change the Terminal-type from the default of xterm to linux.

While you are in this window, you can also fill in a default username for logins. (Which, come to think of it, must be “root”, since you haven’t read the “Creating a user” section yet).

One other less-than-obvious thing about PuTTY is the way it handles copy-and-paste: Ctrl-C and Ctrl-V won’t work.  Instead, any text you highlight on the terminal is automatically copied to the Windows clipboard, and Shift-Insert is the shortcut for Paste.

Transferring and editing files from Windows

The other important piece of software you should install on Windows is something to  transfer files to the Beaglebone. If you aren’t yet comfortable with using Linux command line editors, then this tool is vital, since you are going to need to edit some files below.

For this, you’ll need to access the Beaglebone over the network (i.e. not a COM port), and use a Windows program called WinSCP.  The only default setting you’ll have to change is the File Protocol: the Angstrom demo image’s SSH server, Dropbear, doesn’t support SFTP.

You can use WinSCP to transfer files back and forth between Windows and the Beaglebone but, more importantly, you can also use it to edit files directly on the Beaglebone, safely from the comfort of your Windows desktop.

I know, I know, eventually you’ll want to cut the Windows apronstrings and learn to Esc-Alt-whatever in a command line editor. But having GUI training wheels will save you a lot of frustration as you get started

Creating a user

Angstrom Linux initially contains just a root user. I suspect a lot of people like it that way – root is God, so why bother running as a mere mortal instead? I would actually agree: since you’re almost certainly using it as a single user development platform, go crazy, have fun, be root.

However, if your Beaglebone is going to be accessible from a network, and especially if it’s going to be accessible over the Internet, disabling the root login is a wise security precaution: having to guess the user-ID makes the Beaglebone much harder to crack.

(Needless to say, if you aren’t going to disable root logins, then for-the-love-of-God give the root user-ID a password!)

My own approach is to login with my user-ID, then switch to root when needed (generally about 10 seconds after logging in, admittedly).

To create a new user-ID, johndoe:

beaglebone:~#useradd johndoe
beaglebone:~# passwd johndoe
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

To give the root user a password:

beaglebone:~# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Switching to root

So you’ve logged in as an ordinary user, and have quickly discovered that you need to be root to actually do anything, including pretty much all of the steps below. To switch to root

beaglebone:~$ su

The password you enter is the root password, not the user’s. This ain’t Ubuntu, son.

If you find that you prefer Ubuntu’s way of doing things, you can install the sudo package:

beaglebone:~# opkg install sudo

I think this is well worth doing, if only for the comedy element.  sudo is the most uptight piece of software that I’ve come across.   The first time you use sudo, you’ll get a bossy warning:

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

After you enter your password, sudo will shriek and run off to tell on you:

johndoe is not in the sudoers file.  This incident will be reported.

To fix this, you don’t directly edit the /etc/sudoers file — oh no, that would be too easy.  Instead, you (logged in as root, of course) run visudoer, which forces you to grapple with the notorious vi editor.

If you haven’t lost your nerve yet, you can add your user-ID to the User Privilege section:

##
## User privilege specification
##
root ALL=(ALL) ALL
johndoe ALL=(ALL) ALL

I suspect that the creator of sudo would have a conniption if he saw you make such a crude change (the rules governing sudoer configuration are rather elaborate), but what do you have to lose: your actions have already been reported.

Disabling root SSH login

This step is optional, especially if your Beaglebone isn’t accessible from the Internet.  In fact, if you’re using WinSCP to edit system files then don’t disable the root login – you can’t switch to root from within WinSCP.

If you still want to do it, you can disable root login by specifying the “-w” command line parm when running the SSH server, Dropbear.

Ordinarily, Dropbear configuration is done by setting options in file /etc/default/dropbear.  This used to work in Angstrom.  However, they’ve recently switched to launching Dropbear in a way that doesn’t use any configuration file.

As far as I know, the only way to change the dropbear configuration now is to edit the ExecStart line in a well-hidden file: /lib/systemd/system/dropbear@.service:

beaglebone:/lib/systemd/system$ cat dropbear@.service
[Unit]
Description=SSH Per-Connection Server
Requires=dropbearkey.service
After=syslog.target dropbearkey.service
[Service]
ExecStart=-/usr/sbin/dropbear -i -r /etc/dropbear/dropbear_rsa_host_key -p 22 -w
ExecReload=/bin/kill -HUP $MAINPID
StandardInput=socket

Note the “-w” at the end of the ExecStart line – I added that to disable the root login.

To restart Dropbear, you still reference the old (but ultimately unused) init.d script:

/etc/init.d/dropbear restart

Changing the host name

This is purely optional, unless you have multiple Beaglebones, but it’s an easy way to personalize things:

Edit /etc/hostname and change beaglebone to your new host name.

Then, edit /etc/hosts and make the same change there. Leave the rest of the file as is: it should look something like this when are done, with yourhostname being replaced with – yeah, you got it:

cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
127.0.0.1 yourhostname

Your command line prompt won’t display your shiny new device name until you reboot:

shutdown –r now

Using a static IP address

Updated 2/6/12: The instructions in this section don’t work when using Connman to handle network connections (which is the default for Angstrom Linux on the Beaglebone) — it will revert to using DHCP after rebooting.  See Beaglebone Linux 101: Assigning a Static IP Address with Connman)

This step is also optional, if you have a DHCP server and don’t mind using its choice of IP address. Unlike the Beagleboard XM, the Ethernet adapter on the Beaglebone always uses the same MAC address, which means that the IP address assigned by the DHCP server won’t change each time you boot.

Setting a static IP  address requires editing /etc/network/interfaces.  The default version of this file in the Angstrom demo image looks like this:

beaglebone:~$ cat /etc/network/interfaces
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
auto lo
iface lo inet loopback
# Wireless interfaces
iface wlan0 inet dhcp
wireless_mode managed
wireless_essid any
wpa-driver wext
wpa-conf /etc/wpa_supplicant.conf
iface atml0 inet dhcp
# Wired or wireless interfaces
auto eth0
iface eth0 inet dhcp
iface eth1 inet dhcp
# Ethernet/RNDIS gadget (g_ether)
# ... or on host side, usbnet and random hwaddr
iface usb0 inet static
address 192.168.7.2
netmask 255.255.255.0
network 192.168.7.0
gateway 192.168.7.1
# Bluetooth networking
iface bnep0 inet dhcp

You need to replace the “iface eth0 inet dhcp” line with hard-coded settings for your IP address, gateway, and DNS servers. (Oh, and you might want to do it while connected to the Beaglebone via the USB cable, rather than Ethernet, in case you mess things up).

Comment out the ”iface eth0 inet dhcp” line and add new lines with the correct IP addresses in the address, gateway, and dns-nameservers address (don’t just copy mine – that’s cheating):

#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 192.168.1.1

To test your settings, cross your fingers and enter:

/etc/init.d/networking restart

Then check to see that you have the new IP address:

ifconfig eth0

and gateway…

netstat –nr

and DNS server:

 
cat/etc/resolv.conf

Ha, were you worried? Me neither!

Setting the time zone

You probably noticed shortly after connecting your Beaglebone to the Internet that it  automatically figured out the date and time, sort of: everything except the time zone.

The demo image includes a “cron” job that uses NTP to get the correct date and time. You can see this by entering:

crontab -l
30 * * * * /usr/bin/ntpdate -b -s -u pool.ntp.org

Every 30 minutes, it will run the ntpdate command to update the system date and time.

The system determines the time zone using a file called /etc/localtime. Don’t try editing this file – instead, you point it at the correct time zone under /usr/share/zoneinfo. To see what’s available:

 ls -lr /usr/share/zoneinfo/

These files in the zoneinfo directory are installed by package tzdata.

Don’t feel bad if they don’t include your town – they missed mine too. However, you should be able to find your time zone, or another city in it. For me, I set the timezone by entering:

rm /etc/localtime
ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

Note that “ln -s” creates a pointer to an existing file – make sure you get the parms in the right order.

Reboot to update the system time.

Updating packages

If you haven’t updated the Linux packages on your Beaglebone before, and you’re using one of the early Angstrom images (the original 11-16-11 image, or the 12-26-11 image) you’re in for a treat. A movie, perhaps, or dinner, or a long romantic walk on the moonlight. As long as it takes an hour or two, cause the first package update is sloooooow.

I don’t know why, but there has been a steady stream of package updates released since the Beaglebone came out. Usually, Angstrom is a “sleepier” distribution – just the occasional bug fix or security update. I’m guessing that package development for the Beaglebone is more active because the platform is new, and package updates will become less frequent over time.

The basics of updating packages is to remember 2 commands:

Opkg update
Opkg upgrade

The first updates your local copy of the list of available packages, and the second does the updating. It’s all automated – you shouldn’t see any prompts, so no need to stand around watching it go… and go ….

.. phew, done! After the first batch of updates, it’s a good idea to reboot.

After awhile, the “opkg upgrade” will begin to mutter complaints when it’s done – stuff like:

Collected errors:
* check_data_file_clashes: Package shadow wants to install file /etc/login.defs
But that file is already provided by package * shadow-sysroot
* check_data_file_clashes: Package shadow wants to install file /etc/login.defs
But that file is already provided by package * shadow-sysroot

Yada yada yada.  Whatever.

Honestly, you generally don’t have to do anything to fix the errors – as other packages get updated, the problems get fixed. If they don’t, there is always Google.

Installing packages

The demo image comes with a lot of software, but there are thousands of other packages available. To see everything that is out there, you can enter:

opkg list

That’s a lot of packages! If you have an idea of what you are looking for, use grep to filter the results:

Opkg list | grep "python"

To install the package

Opkg install <packagename>

If you can’t find what you want that way, try the online Angstrom package browser. It has a more convenient interface, and it’s possible that the package you’re looking for isn’t listed by opkg but can be found on the web site (in the dreaded “unstable” branch – scary!).

For example, my preferred command line editor is Emacs, but that doesn’t appear in the output of “opkg list”.  It is, however, listed in the package browser.

The “available versions” section lists 2 options:

The 2 available versions are for the “Angstrom 2011.03″ release, and the Beaglebone is running a more recent release, currently Angstrom 2012.01.  That’s why “opkg list” didn’t include emacs.

I don’t know why emacs isn’t made available in the new release — it could be lack of popularity, or a lower priority for conversion and testing, or a horrendous incompatibility with other packages.  However, since emacs is a user app that few other packages make use of, a horrendous incompatibility seems unlikely.  (And I’ve been running emacs on the Beaglebone for several weeks with no problems).

The Beaglebone is compatible with armv7a packages, so when that platform is available you should select it.  (Packages compiled for earlier versions of ARM processors will generally also run on the Beaglebone, but more slowly)

You can just click on the link to download it, and copy the package over via WinSCP, or use wget to download it directly to the Beaglebone:

 wget http://www.angstrom-distribution.org/feeds/unstable/ipk/glibc/armv7a/base/emacs_22.3-r1.6_armv7a.ipk

To install it, just specify the filename instead of the package name:

opkg install emacs_22.3-r1.6_armv7a.ipk

You’ll likely find that it complains about a missing dependency file, liblockfile:

Installing emacs (22.3-r1.6) to root...
Collected errors:
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for emacs:
 * liblockfile (>= 1.06) *
 * opkg_install_cmd: Cannot install package emacs.

Yada yada yada.  Actually, this one we can fix.

The package browser web page for emacs, above, lists liblockfile as a dependency.  You can click on the link to open up the liblockfile page and download it from there, or enter the following to download the dependency and install both packages:

wget http://www.angstrom-distribution.org/feeds/2011.03/ipk/glibc/armv7a/base/liblockfile_1.06-r1.6_armv7a.ipk
opkg install liblockfile_1.06-r1.6_armv7a.ipk emacs_22.3-r1.6_armv7a.ipk

Other useful opkg commands

To remove a package

opkg remove <packagename>

To rip a package from the grasp of a protesting opkg (generally because you intend to replace the package with one that provides the same files):

opkg remove <packagename> --force-removal-of-dependent-packages

To get more information about a package:

opkg info packagename

To get a list of files that are installed by the package:

opkg files packagename

(Which only works after you’ve already installed the package - so much for look before you leap!)

To find the package that installed a specific file:

opkg search '<path_to_file>'

e.g.

opkg search '/bin/ps.procps'
procps - 3.2.8-r4

The search function supports wildcards:

opkg search '*bash*'

Automating package updates

There are some people, who we’ll call “sissies”, who would argue that automating package updates is dangerous and irresponsible, since the updates might fail and you don’t want to leave your system in an unstable state.

Others, who we’ll call “real men”, think that the package update process is reliable enough that it rarely requires manual intervention. And, besides, you can always check the logs to detect any problems. It’s not like you’re going to forget to check the logs, right?

Personally, I’m a sissy. I’m also forgetful, so I’ve automated opkg anyway. Needless to say, I rarely bother to look at the output logs. (I know what I’ll find.. “Collected errors: yada yada yada”. Whatever.)

If you’re a real man, you can add a line to the crontab to automatically update your system.

[2/2/12: the following script was updated to add error handling]

First, create a script to run.  I use the following:

#!/bin/sh
# runopkg.sh
# Update packages and append output to log file
/usr/bin/opkg update
# opkg update returns 0 if OK, 1 if error
if [ $? = 0 ]; then
    /usr/bin/opkg upgrade &>> /var/log/opkgupgrade.log
    echo "opkg complete rc $?  $(date)" >> /var/log/opkgupgrade.log
else
    echo "ERROR: opkg update returned $?" >> /var/log/opkgupgrade.log
fi

You can download this file from my site:

beaglebone:~# wget http://www.gigamegablog.com/docs/runopkg.sh

…make it executable…

beaglebone:~# chmod u+x runopkg.sh

…then add this script to the list of scheduled cron tasks:

beaglebone:~# crontab -e
30 * * * * /usr/bin/ntpdate -b -s -u pool.ntp.org
33 3 * * * /home/root/runopkg.sh

By default, the “crontab -e” command invokes the vi editor, which you’ll either love or hate.  Probably hate.

If you stored runopkg.sh in a directory other than the root home folder, be sure to enter the correct path in the crontab line.

The example above runs the update process every day at 3:33 am, and appends both the info and error messages to a log file. It checks the return code after running opkg update. Sometimes it fails to connect to one of the repositories, and it is safest not to do an upgrade with an incomplete list of updates.

Customizing the command line

Angstrom provides a standard Bash command line shell without any customizations: no .profile or .bashrc file.

Everybody’s got their own idea of how to make Bash more useful, but here are some common customizations to get you started.

First, create a file named .profile in  your home directory with the following contents:

# ~/.profile: executed by Bourne-compatible login shells.
if [ -f ~/.bashrc ]; then
 . ~/.bashrc
fi
# path set by /etc/profile
# export PATH
mesg n

If you like, you can download this file directly from my site. Make sure you store it in your home folder .

beaglebone:~# wget http://www.gigamegablog.com/docs/.profile

This is an extremely plain .profile which mainly has one purpose: to activate the .bashrc file.

Next, create a file called .bashrc in your home directory with the following contents:

# ~/.bashrc: executed by bash(1) for non-login shells.
export PS1='\h:\w\$ '
umask 022
# You may uncomment the following lines if you want `ls' to be colorized:
export LS_OPTIONS='--color=auto'
# eval `dircolors`
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'

# Some more alias to avoid making mistakes:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# shell options
# autocorrect cd commands
shopt -s cdspell
# disable Ctrl-D to logout
set -o ignoreeof
# extended pattern matching
shopt -s extglob

This file can be downloaded from my site – it should be stored in your home folder:

beaglebone:~# wget http://www.gigamegablog.com/docs/.bashrc

This does the following:

  • shortens the command prompt to just your hostname and the current directory
  • changes the default permissions for new files you create so that they are writable by you, and just readable for everyone else
  • turns on colors for your “ls” output
  • creates a few shortcuts for common ls options (ll is the most useful, I think)
  • adds the “-i” parm to the copy, move and delete commands, which prompts you for confirmation when you are about to delete or overwrite a file
  • automatically fixes some typos in directory names
  • prevents Ctrl-D from dropping your session
  • enables extra wildcards for matching files and directories

By the way, when switching from a regular user to root using the su command, you need to include a hyphen to ensure that the root .profile and .bashrc are used:

su -

Windows networking

By now, you’re hopefully starting to look upon your Beaglebone with respect and admiration. You are also probably sick of WinSCP and/or command line editors. Why not welcome your Beaglebone into your Windows network and give it equal standing to your other PCs?

For this, you’ll need to install Samba.

opkg install samba

The correct configuration of Samba is actually quite complicated, or so I would assume since there is an entire book on the topic . I haven’t actually read it, so instead I installed a browser-based configuration utility named Swat:

opkg install xinetd swat

The xinetd utility is the standard way of invoking Swat and many other services that are accessed over the network.  It doesn’t start the service until it is accessed, which is quite helpful on a memory constrained platform like the Beaglebone.

The services are configured by entries in /etc/xinetd.conf or files in /etc/xinet.d, but unfortunately the Swat package currently doesn’t update either.  So, create a file at /etc/xinetd.d/swat, and paste the following into it:

service swat
{
   disable = no
   port = 901
   socket_type = stream
   wait = no
   # only_from = localhost
   user = root
   server = /usr/sbin/swat
   log_on_failure += USERID
}

Note that this configuration uses a port number of 901, allows access to other PCs on the network, and specifies that root is allowed to login.

After changing the xinetd.conf file, you need to restart xinetd:

/etc/init.d/xinetd restart

You should now be able to open the following address in a browser on another PC: http://<your-beaglebone-ipaddress>:901

Login as root at the prompt.

The first thing you’ll want to do is add a user to Samba — Samba doesn’t automatically use the same user-IDs and passwords as Linux.  Ideally, you should add a user that has the same user-ID as a Linux user and Windows user, and the same password as the Windows user – you’ll have fewer problems with permissions that way.

Go to the Swat password page and create a user. The interface isn’t terribly intuitive: fill in the user name and password in the Server Password Management area, then click then “Add New User” button.  You’ll get a subtle confirmation that the user was added, but it doesn’t display a list of users.

Next, click on Shares and add a share for your user’s home directory.

This step is advisable since, if there isn’t at least one share that your Windows user-ID is allowed to access, Samba/Windows will keep prompting for your user-ID and password.  If it’s the first time you are accessing a Samba share, you won’t know the cause of the problem: the user-ID, the password, or the share.  So, ensure you have access to something by explicitly sharing your user’s home directory.

The user interface on the Shares page isn’t very intuitive either: you need to fill in the textbox next to the Create Share button, then click the button

Note that, by default, new shares are read-only and are not “available”. (Grrrr.)  So, you’ll need to manually change the “Available” setting and Read-only setting then click the Commit Changes button.

(When sharing directories other than your home directory, you may want to leave the Read-only setting on.  If your user-ID doesn’t have write permissions to the underlying Linux directory, don’t try to make it a writeable share.  It won’t work.)

I’d also suggest you go to the Global page and change the workgroup to whatever your Windows PC uses – this makes your Beaglebone easily discovered by Windows.

After saving your changes you shouldn’t have to manually restart Samba, since it continually scans for configuration changes.  However, I often find that a restart is necessary to get your changes to be recognized by Windows:

/etc/init.d/samba restart

Now, Windows Explorer should be able to see your Beaglebone in your network, with some shares underneath.

If you are prompted for a user-ID and password, use the one you entered into Swat’s password page.  If Windows prompts for a new user-ID and password when accessing a share or file, remember that the Linux permissions come into play – try changing the Linux  directory permissions to give write access to non-root users.

Wrapping Up

There’s been some debate in the Beagleboard Google Group about whether it makes sense to have a separate group for the Beaglebone.

IMHO, no.  While the Beaglebone is quite different as an electronics hobbyist platform, it’s almost completely identical to the Beagleboard when it comes to Linux configuration.  All of the steps I covered in this article also apply to the Beagleboard.

So, when looking for Linux tips and solutions, don’t ignore postings targeted at the Beagleboard.

Furthermore, while Angstrom has its differences from other Linux distributions, the most commonly used software is the same or very similar.  Dropbear is largely the same as OpenSSH, Busybox is largely the same as the core GNU utilities, and Angstrom Bash is Bash.  Don’t be discouraged by the lack of documentation on Angstrom or some its utilities.  There’s a wealth of information out there on SSH, GNU and Bash, and you’ll find that most of it applies to Angstrom.

The stuff that doesn’t apply? Ignore it.  Wouldn’t you rather be coding than reading, anyway?

This entry was posted in Gadgets and tagged , , . Bookmark the permalink.

41 Responses to Beaglebone Linux 101: Configuring Angstrom Linux

  1. Pingback: Quick start to Angstrom on the BeagleBoard | electrons on radio

  2. flymass says:

    Thanks a lot for your BeagleBone articles, being a BeagleBone beginner this is very precious information. As you mentioned, there is indeed relatively few documentation available on BeagleBone running Angstrom.
    Suggestion for your next article: how to cross-compile or compile directly on the BeagleBone. There is documentation about this but many use different approaches, I’m not sure which road to go…
    Anyway, thanks again and keep up the nice work!

    • dwatts says:

      Thanks.

      I haven’t done much with C code on the Beaglebone yet, but the approach to cross-compiling that I used was from an article on Jan Axelson’s site: http://www.lvr.com/eclipse1.htm.

      She refers to the Beagleboard in the article, but the binaries generated are also compatible with the Beaglebone.

      Not being a Linux desktop user, I spent some time dabbling with TI Code Composer on Windows. I was able to generate “hello world” code OK, but haven’t got much beyond that. If I’m ever able to generate more complicated binaries on Windows I’ll definitely blog about that.

      I’m hoping that in 6 months or so, the Internet will be full of Beaglebone-related articles. Also, as new kernel drivers are released, and bonescript fills out, software development will become easier to learn.

      Dan.

      • flymac says:

        Thanks for your reply and the additional pointers.
        The reason why I asked is that I will probably have to compile software not available for the BeagleBone yet, for instance angstrom-x11-base-depends and its dependencies, or other things I might need.
        Speaking of which, you mentioned that packages for earlier ARMs should usually work, do you think that packages like x11-base-depends which only exist (among other ports) for BeagleBoard would work? For my project, I’d need VNC to check a few things even if it’s super slow.
        Thanks, Kevin

        • dwatts says:

          Sorry, I know next-to-nothing but X11, so you’d do better to ask on the Beagleboard Google Group. If you are able to switch your project to Ubuntu, you might want to try using it instead of Angstrom. It has a lot of packages that aren’t available on Angstrom. I see that people have reported running VNC on their Beaglebones using Ubuntu.

          • preben says:

            I did, … VNC works on ubuntu and BB but its SLOOOOOOOW. And analog inputs and some of the other essential IO-stuff is not yet supported… but angstrom is the best choice if you want to use the BB for IO/analog stuff..

          • dwatts says:

            VNC is also available on Angstrom (opkg install x11vnc). When combined with xfce (opkg install task-xfce-base), it is considerably faster than on Ubuntu, but still too slow for my tastes.

            Dan.

  3. preben says:

    Can you please please please do a blog post on what web servers would be ideal to install on the angstrom platform? I know tomcat is in the opkg list, but is there a more lightweight alternative? That preferably runs CGI/Perl?

    • dwatts says:

      lighttpd is a popular lightweight general purpose web server – it supports CGI and Perl, and is available for Angstrom.

      Dan.

  4. Pingback: Beaglebone and ExtJs Web App « Isola Software

  5. Nice work, but i got one problem after use the opkg update command.
    Now when I boot the beagle, it takes some minutes, then give me one error “Failed to mount /sys/kernel/security: No such file or directory” and then everything boots normally.
    Do you know what can I do to solve this problem?
    Thanks.

    • dwatts says:

      Sorry, I’m not familiar with the /sys/kernel/security filesystem. I didn’t even realize it existed until I checked for it after seeing your question.

      It’s possible that the “failed to mount” error is misleading, and something else is responsible for the slow boot time. If it is working normally, you should see the following line in the output of the mount command:

      securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)

      Dan.

  6. Jeeks says:

    I really like the info about setting the correct timezone. Oddly, it’s the most important part of your article for my current project. However, can you add any additional insight into dealing with daylight savings time in the US? I’ve been looking for a proper way to automatically adjust the time at the start and end of DST.
    Thanks in advance for any advice.

    • dwatts says:

      Hi,

      If you’re referring to the system time in Linux, ordinarily the daylight savings time shift “just works”, provided that you have the right timezone set. It always has for me, anyway, in the “America/New York” timezone.

      Dan.

  7. Mark Fisher says:

    Just a quick note to say thank you for your outstanding articles.

  8. Mark Fisher says:

    Is anyone else having trouble installing samba? I have updated, upgraded and rebooted several times. I keep getting the message “Unknown package ‘samba’.” I am very new to linux. is there a way to manually find the correct samba package for Angstrom?

    Thanks

    • dwatts says:

      Mark,

      The package name of “samba” should work. I just tried installing it with the command “opkg install samba” on latest Angstrom Beaglebone image (2012.05.09) and it worked.

      Be sure to run “opkg update” first, and check the results of that command for error messages. If “opkg update” fails, it will likely leave your package lists in a incomplete state. If it fails, just retry the command — it has intermittent failures.

      Also, if you are running an old image (e.g. anything that you first installed in 2011), try using a new image. I don’t understand opkg repository management, but perhaps the repositories for the image you are using have become neglected.

      You can install samba manually by downloading the .ipk file from its Angstrom “Feed browser” page: http://www.angstrom-distribution.org/repo/?pkgname=samba. (Note that there are different .ipk files for different Angstrom images and processors. You can figure out which one you want by looking at the path names in the output of “opkg update” on your Beaglebone. For example, if the path name is http://feeds.angstrom-distribution.org/feeds/v2012.05/ipk/eglibc/armv7a/.., then you want the “v2012.05 eglibc armv7a” version of the .ipk file.)

      After downloading an .ipk file, you install it with “opkg install “.

      However, there are a bunch of prerequisite packages for samba, as listed on that Feed browser page, so if you don’t already have those, you’ll need to install them first.

      I hope that helps,

      Dan.

  9. Pingback: beaglebone startup items | TheFabric.com

  10. Pedro Restrepo says:

    Hello Dan,

    I just got my beaglebone and, searching the web for a good starting set of instructions, I ran into your page. First of all, I should mentioned that the information there is very clear. Thank you for posting it. I ran into a problem with the samba. Samba, xinetd and swat are installed, but, for some reason, I can’t get to the swat page from a different computer. I do have access to the beaglebone through the ethernet via ssh and sftp, and can also access the Beaglebone101 presentation. I tried a different port from 901 with the same result. Also tried rebooting the beagleboard and restarting xinetd without success. I’ll appreciate any insight you can provide.
    Thank you,
    Pedro

    • dwatts says:

      Pedro,

      Hmm, not sure. I just tried it again with a different Beaglebone, and it worked as expected. Be sure to create the /etc/xinetd.d/swat file as shown my article — without that file, it definitely won’t work.

      service swat
      {
      disable = no
      port = 901
      socket_type = stream
      wait = no
      # only_from = localhost
      user = root
      server = /usr/sbin/swat
      log_on_failure += USERID
      }

      These settings require that you login as root — if you haven’t set the root password, then perhaps you need to set a password. I haven’t tried other settings, but you can try changing the user or the port to see if that makes a difference. Also be sure that the “only_from = localhost” line is commented out (with the “#” character) — I probably should have omitted that line entirely to make that clearer.

      Dan.

  11. Pedro Restrepo says:

    Hello Dan,

    Thank you. The problem was just a simple typo…. Everything is working well now. Again, thank you for your great blog.
    Pedro

  12. Using your Samba install seems to work fine for me until I try to actually use the network from a windows machine. Beaglebone PC is there as expected but I cannot get past the login process. This seems to apply whatever I try and set up this to be via swat. Similarly I have tried creating directories in swat (it still thinks they are there) /home/myshare + also /new but cannot see them via the bash screen!

    Any obvious ideas as to me missing something please? I assume to ‘save’ anything set in swat you just click on ‘commit’ – or am I missing something?

    Incidently, I spent days trying to to fix a static IP address in Angstrom – without any success – even a perl orientated one failed – for some reason this site was impossible to connect to until suddenly it worked – so did your (later) static IP setup – thanks

  13. My earlier problem appears to somehow relate to the setup of user + passwords. I was looking @ passbd.tdb and similar with no date change being displayed – then retried again and it all worked this time round – a bit lost @ present but……

    • dwatts says:

      Richard,

      I’ve had a similar experience with installing Samba on Beaglebones and Beagleboards: the Windows PC doesn’t see the share, or won’t let me access it. Then when I try it again later, it works. I wish I knew why. The good news is, once it works, it keeps working. As a result, I don’t get a lot of experience with Samba configuration and troubleshooting.

      The most likely causes of Samba security problems, other than the ones that go away on their own are:

      1. You definitely need to set the Samba password, even for a userid that already has a Linux password. For convenience you can set it to the exact same password, but without setting it in Samba, shares won’t work.
      2. If the Windows PC is in a Workgroup other than the Windows default (“WORKGROUP”), you need to set the same workgroup name in the Samba configuration. If your PC is part of a Windows domain, as opposed to a workgroup (generally that would only be a corporate PC), then good luck with that – it can be done, but it’s trickier and I’ve never done it.
      3. Make sure that the folder you are sharing has Linux permissions that allow the Samba user-ID to access it. So, if you create a new directory when logged in as root (e.g. mkdir /myshare), by default it won’t allow other users writeable access. You need to change the Linux permissions first (e.g. chmod 777 /myshare).

      Dan.

  14. Dan, thanks for your comments. Actually my ‘failure’ to initially setup a password has turned out useful – as I ended up adding a new user using the ‘root’ settings (just that one) which then reflected ‘what could be done to visible files’. A few quick changes to make the shared directory just / and an edit of the smb.conf file to make all shared files read/writeable etc. (create mask = 0666, directory mask = 0775) and now I have got what I had always been looking for – a ‘headless’ unit that can be modifed remotely, plus after a littlt bit more work a local USB stick + can both read + write to remotely – hence tranfer file to/from anywhere etc .

    I managed to get the same results with separate Debian Wheezy and Ubuntu distros too – thanks again

  15. John Laurence Poole says:

    Ha! I felt as if I had ghost written this blog. I basically did
    the very same thing you have done, though I decided not to install
    Emacs, opting for an approach where I run Emacs on another server
    and expose the file system on the Beagle Bone. What you have
    described above is basically what I’ve come to do with SheevaPlugs,
    so I approached the Bone likewise.

    It took about 6 hours to install Samba on the Beagle Bone using a
    Gentoo Linux system. I’m not familiar with NFS, but am going to try
    it out so the Bone (or whatever microserver) is simply exposed to a
    more powerful editing environment on another machine.

    I also recommend tmux, especially if disconnection from your SSH
    session is possible.

    Very thoughtfully organized and written. Bravo.

  16. Evan Thomas says:

    Thanks, great tutorial, can’t live without emacs.

  17. Pingback: BeagleBone first troubles & resolutions | Elene

  18. mike wachowski says:

    Say I’m new at embedded Linux and was wondering if there’s a fix to my bb? I recently did an update and upgrade and it took a while. This is the best site for tutorials by the way but the processes worked well but all I get now is the picture of the dog and it goes no further.

    • dwatts says:

      Hi,

      I’m not sure what you mean by “the picture of the dog and goes no further”, but I’m assuming the result is that Linux doesn’t bootup on the Beaglebone, and you can’t login to it.

      You have a couple of options for fixing the problem:
      1) Look at the messages that are displayed when the Beagleboard boots up. (To see the messages, you’ll need to connect a terminal program like WinPutty to the COM port assigned to the Beaglebone, then reboot the Beaglebone by pressing the little black button on it.) It’s possible that the problem is something you can fix. Since the problem was caused by a failed update, its possibly a corrupted filesystem (fixable, but you’d have to use a PC running Linux) or a defective micro SD card (not fixable).
      2) Start over again by burning a new image onto a micro SD card. Ideally, you should use a different SD card, in case the problem is a defective card. I’d recommend using Ubuntu, since it has caught up to Angstrom in terms of its support of Beaglebone hardware, and it is more stable.

      For me, approach #1 rarely works and can lead to a lot of wasted time, so I would go with approach #2. Starting with a new card isn’t so bad if you’ve made a backup of your configuration.

      I hope that helps. If you can provide more details on what happens when you try booting your Beaglebone, I can probably give you a better answer.

      Dan.

      • mike wachowski says:

        Thank you for response I will try it. I’m using a Ubuntu 12.04 for my PC, and will try make a Ubuntu image for bb.

  19. Mohammed says:

    Hello,
    Thanks for your tutorial, it is a great asset for BeagleBone beginners like me, I have a question that I am hopeful you will be able to answer. When booting with a 5 volt power supply, do you still need to use a USB connection to switch from storage to network mode, I have been trying to get a connection using Ethernet, but it doe not work until I connect a USB and eject the beaglebone under my host Windows or Linux, am I missing anything, is there a way to get it to boot to network mode if you boot with a power supply. Thanks in advance for your help with this matter.

    Mohammed

    • dwatts says:

      No, sorry, I haven’t run into that problem. One of my Beaglebones is always connected to a Windows PC through its USB client port, and the Ethernet network interface starts up normally.

      This might be a bug in the kernel or connman that was fixed in a later version. Are you running Angstrom? If so, do you have a recent kernel version? The current version is 3.2.34.

      You could probably avoid the error by switching to Ubuntu, if that’s possible for you. Angstrom uses connman to handle its network connections, and connman sometimes behaves strangely.

      Dan.

      • Anonymous says:

        I am running the latest angstrom image from beaglebone.org, I am not sure which kernel version this is, is there a way to find out?.

        what I found out so far, is that i don’t have to eject the BeagleBone from my OS, but I need to have a terminal window open with the usb com port, when I reset, I can see the boot process on the screen, until I get to the log-in, at that point I can’t find the beaglebone on the ethernet network, until I log in, only than I can see the bone on the network and establish an ssh with its root@. I am thinking that I may need to get the boot to auto-login. is there an easy way to do this, and is this a secure process if the board is connected to the internet.

        Mohammed

        • dwatts says:

          Hi,

          You shouldn’t have to login through the COM port console in order to enable the Ethernet connection — it should start automatically, whether or not there is a connection through its USB port. It looks to me like connman is having a problem.

          You can display the kernel version using the uname -r command. On my Beaglebone, it displays:

          root@beaglebone:~# uname -r
          3.2.34

          If you have an older version, try upgrading by running opkg then rebooting, ie:

          opkg update
          opkg upgrade
          shutdown -r now

          If you have the latest kernel and it hasn’t fixed the problem, I’d suggest you post on the Beagleboard Google Group: somebody there might have experienced the same problem and know how to fix it.

          Dan.

          • Mohammed says:

            I ran the uname -r command, and it shows the same number, I didn’t do the opkg update before, I will try to do this anyway, maybe other packages need update. I will try to post at the beagleboard google group. thanks for your help.

            Mohammed

          • Mohammed says:

            A final point, my Beaglebone is connected to Ethernet switch not a router, could that cause any issue.

            Mohammed

          • dwatts says:

            No, not that I know of.

            It can take a couple of minutes for the Ethernet connection to become active after booting the Beaglebone, but I guess you’ve waited longer than that.

            The problem sounds like an issue with connman, and debugging connman can be frustrating since it’s not widely used. You can avoid connman entirely by switching from Angstrom Linux to Ubuntu: it’s quite easy to do if you have a Linux PC. See the instructions at http://elinux.org/BeagleBoardUbuntu#Quantal_12.10_armhf

            Otherwise, if you’d rather stick with Angstrom, you might want to try the CircuitCo Angstrom image — in the past, they seem to be better tested than the images from http://downloads.angstrom-distribution.org/demo/beaglebone/. You can get the CircuitCo image from http://circuitco.com/support/index.php?title=BeagleBone#Image_Files

            Dan.

          • Mohammed says:

            Hello Dan,

            It turns out that I wasn’t waiting long enough for my Ethernet connection to become available. Accordingly trying to access Beaglebone IP address makes it change to a different address, which I wouldn’t know until I log in using a COM port console and run an ifconfig eth0 command, I am thinking I need to get the bone to send its IP address once its ready to a host computer, so that I know its available, and start communication with it with ssh or any other application. Any pointers of where to go for such an application.

            Mohammed

          • dwatts says:

            Hi,

            If the IP address changes when you reboot, the DHCP server must be configured to assign a new IP address at boot time.

            To avoid that, you can assign a static IP address to your Beaglebone. I wrote an old blog post about it here: http://www.gigamegablog.com/2012/02/06/beaglebone-linux-101-assigning-a-static-ip-address-with-connman/. The last time I tried it on Angstrom, I found that the connman-tests package was already installed, but otherwise the instructions in that article are still correct.

            Dan.

  20. Graham says:

    Just a thanks for a great write up. It really helped.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>