Ubuntu on BeagleBone Black

Recently, I have decided to try another hardware which is a little bit faster and there are numerous Linux distributions available for that.
The name of the new toy is BeagleBone Black. Successfully tested application on this configuration:
- FTP server
- Web / Apache server
- NAS / Samba server
- USB 3G Mobile Internet Dongle

BeagleBone Black

Processor
Connectivity
Software Compatibility

Processor: AM335x 1GHz ARM® Cortex-A8
512MB DDR3 RAM
2GB 8-bit eMMC on-board flash storage
3D graphics accelerator
NEON floating-point accelerator
2x PRU 32-bit microcontrollers

Connectivity
USB client for power & communications
USB host
Ethernet
HDMI
2x 46 pin headers

Software Compatibility
Ångström Linux
Android
Ubuntu
Cloud9 IDE on Node.js w/ BoneScript library
plus much more

I have ordered online from a Swiss shop and I bought a DC 3A adapter for the board, as a recommendation from the shop.
Important difference compared to the Raspberry Pi, that the BeagleBone Black has got an embedded 2GB eMMC flash storage, so when you buy it comes with a Ångström Linux loaded into its eMMC.
So, when you receive the unit just connect the LAN and Power cable and the board will boot into the Ångström Linux.

Default username is root, and no password set, just hit ENTER and you are in via SSH.

I was playing around with the Ångström Linux but soon decided to change it to the system I know much much better.
Change to Ubuntu Precise 12.04.3 LTS

Step 1 Download the Ubuntu image
Step 2 Boot into Ubuntu
Step 3 Load the Ubuntu into the internal eMMC
Step 4 Expanding the image on the microSDHC card


BeagleBone Black Ubuntu Precise 12.04.3 LTS

4 Steps to follow:
Step 1) Download and write the Ubuntu image onto a microSDHC flash card.
I bought a Sandisk 8GB microSDHC class10 card as they seems to be fast and reliable.
I used a linux computer to write the image onto the microSDHC card with the following commands:

# sudo su
Note these instructions apply equally to mmc block devices such as /dev/mmcblk0 if you are booted to a device with an SD card. Please be careful as writing this image to the wrong device will corrupt the device. Run an ls /dev/sd* command before and after inserting the microSD card so you can be 100% certain which device is your microSD.

# xz -cd ./ubuntu-13.10-armhf-minfs-*.img.xz > /dev/sdb

It takes a few minutes. After the file has finished decompressing and copying to the microSD card, need to reload the partition table.

# partprobe /dev/sdb

If you have only a Windwos computer you can use “win32 disk imager” to load the Ubuntu image onto the microSDHC card.


BeagleBone Black Ubuntu Precise 12.04.3 LTS

Step 2) Boot into Ubuntu

Insert the microSDHC card into the BeagleBone Black.
The BeagleBone Black will try to boot the internal Angstrom image by default. To boot from microSD, you’ll need to hold down the USER/BOOT button (located near the microSD end of the board) while powering-on the device.
Once it has booted you can SSH into the board. Default username is ubuntu and default password is ubuntu.
You can run a update and upgrade now to make your system up to date:

# sudo apt-get update
# sudo apt-get upgrade

BeagleBone Black Ubuntu Precise 12.04.3 LTS

Step 3) Load the Ubuntu into the internal eMMC

Now you have a Ubuntu system on your microSDHC card but you still have the default Ångström Linux inside the embedded eMMC storage.
It is now to load the Ubuntu into the internal eMMC too.

Writing to Internal eMMC
To install the image to the internal eMMC, boot from the SD card. While booted from an external SD card, the internal eMMC will be available as /dev/mmcblk1. To write the image to eMMC, execute:

#
sudo su
# xz -cd ubuntu-12.04-armhf-minfs-*.img.xz > /dev/mmcblk1

BeagleBone Black Ubuntu Precise 12.04.3 LTS

Step 4) Expanding the image on the microSDHC card to use the full card storage. (example using a 4GB microSDHC card)

Depending on the size of the uSD card, this could leave a significant amount of space left unused. This article shows how to repartition the uSD card to utilize all of the space on the uSD card. This can be done on an unmounted filesystem or even on a live filesystem. In the example below, the live filesystem of a BeagelBone Black will be resized to take advantage of the full 4GB of space available on the uSD card used in this example.

Step 4.1: Start fdisk
To get started, list the volumes available on a BeagleBone Black that is booted from a uSD card:

root@debian-armhf:/# ls -l /dev/mmcblk*

brw-rw---T 1 root floppy 179, 0 Jan 1 2000 /dev/mmcblk0
brw-rw---T 1 root floppy 179, 1 Jan 1 2000 /dev/mmcblk0p1
brw-rw---T 1 root floppy 179, 2 Jan 1 2000 /dev/mmcblk0p2
brw-rw---T 1 root floppy 179, 8 Jan 1 2000 /dev/mmcblk1
brw-rw---T 1 root floppy 179, 16 Jan 1 2000 /dev/mmcblk1boot0
brw-rw---T 1 root floppy 179, 24 Jan 1 2000 /dev/mmcblk1boot1
brw-rw---T 1 root floppy 179, 9 Jan 1 2000 /dev/mmcblk1p1
brw-rw---T 1 root floppy 179, 10 Jan 1 2000 /dev/mmcblk1p2

The listing above shows an external uSD card is currently booted as indicated by the /dev/mmcblk0 entries and the lack of /dev/mmcblk0boot entries. When booted from the internal eMMC, the device with the /dev/mmcblk1boot entries would instead be at the device zero location as shown here:

root@debian-armhf:/# ls -l /dev/mmcblk*
brw-rw---T 1 root floppy 179, 0 Jan 1 2000 /dev/mmcblk0
brw-rw---T 1 root floppy 179, 1 Jan 1 2000 /dev/mmcblk0p1
brw-rw---T 1 root floppy 179, 16 Jan 1 2000 /dev/mmcblk0boot0
brw-rw---T 1 root floppy 179, 24 Jan 1 2000 /dev/mmcblk0boot1
brw-rw---T 1 root floppy 179, 2 Jan 1 2000 /dev/mmcblk0p2
brw-rw---T 1 root floppy 179, 8 Jan 1 2000 /dev/mmcblk1
brw-rw---T 1 root floppy 179, 9 Jan 1 2000 /dev/mmcblk1p1
brw-rw---T 1 root floppy 179, 10 Jan 1 2000 /dev/mmcblk1p2

To get started, run fdisk /dev/mmcblk0 to examine the partitioning of the external uSD card that is currently booted:

root@debian-armhf:/# fdisk /dev/mmcblk0

Command (m for help): p

Disk /dev/mmcblk0: 3947 MB, 3947888640 bytes
4 heads, 16 sectors/track, 120480 cylinders, total 7710720 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: 0x80000000

Device ...................Boot .....Start ........End ..........Blocks .......Id ....System
/dev/mmcblk0p1 ......* ........2048.........4095.........1024 ..........1......FAT12
/dev/mmcblk0p2 .................4096 .....3751935.....1873920......83 ....Linux

Command (m for help):

Take a moment to examine what fdisk is reporting. The first line indicates that the uSD card is 3947888640 bytes in size. The 4th line reports the sector size to be 512 bytes. Some quick math shows that 3947888640 bytes / 512 bytes per sector = 7710720 sectors as is also reported on the second line. The default “block” size is 1024 bytes, but it does not actually report this unit anywhere. The Start and End columns are reporting 512 byte sectors, and the Blocks column is reporting 1024 byte blocks. The way this .img is partitioned makes the relationship easy to see in this case, but it would not be immediately apparent if this were a large hard disk and the numbers were not as magic. The starting block of the partition table at position 2048 reveals that blocks 0-2047 are not being used for user data. This amounts to a full megabyte (2048 * 512 bytes per block = 1048576 bytes), and this is the default of fdisk. The first partition is 2048 sectors in size, or 1024K, which confirms the block size being 1K.

To calculate the total size of the space used on the disk, there are 2048 sectors at the head reserved for partitioning, 2048 sectors in mmcblk0p1, and 3,751,936 sectors in mmcblk0p2 for a total of 3,756,032 sectors. With each sector using 512 bytes, this totals 1,923,088,384 bytes. The choice of 1,923,088,384 bytes was used to make this image the exact size of the BeagleBone’s available eMMC space (note that 1,923,088,384 bytes / 1024^2 = 1834 MB). It is also a good size because not all external 2 GB uSD cards are exactly 2048 * 1024^2 in size. Having it a bit under 2 GB makes it a sure fit.

Repartitioning the disk is rather easy since fdisk will prompt with smart default choices. The steps below will begin by deleting partition 2, then recreate it as a larger size, and finally write the new table to the disk only at the end. Notice the emphasis on the last part: No changes are actually committed to disk along the way — only by pressing ‘w’ at the end will cause changes to be written. If you make a mistake or panic, just hit ‘q’ to quit and no changes will have been made.

Step 4.2: Delete Partition 2

Press ‘d’ for delete and ’2′ for partition 2.

Command (m for help): p

Disk /dev/mmcblk0: 3947 MB, 3947888640 bytes
4 heads, 16 sectors/track, 120480 cylinders, total 7710720 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: 0x80000000

Device ...................Boot ......Start........End .........Blocks ........Id .....System
/dev/mmcblk0p1...... * .........2048 ......4095..........1024 ..........1.......FAT12
/dev/mmcblk0p2.................. 4096 .....3751935 ...1873920.......83 .....Linux

Command (m for help): d
Partition number (1-4): 2

Command (m for help): p

Disk /dev/mmcblk0: 3947 MB, 3947888640 bytes
4 heads, 16 sectors/track, 120480 cylinders, total 7710720 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: 0x80000000

Device ..................Boot ......Start ......End ....Blocks ...Id ....System
/dev/mmcblk0p1 .... * ........ 2048 ......4095 .....1024 ... 1 ....FAT12


Step 4.3: Recreate Partition 2

Press ‘n’ for new, ‘p’ for primary, and ’2′ for partition 2. Specify start and end sectors for the new partition — just select the default values by pressing enter. In fact, outside of the the first ‘n’ they were all default choices and pressing enter alone to confirm the choice is all that is needed.

Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (1-4, default 2): 2
First sector (4096-7710719, default 4096):
Using default value 4096
Last sector, +sectors or +size{K,M,G} (4096-7710719, default 7710719):
Using default value 7710719

Command (m for help): p

Disk /dev/mmcblk0: 3947 MB, 3947888640 bytes
4 heads, 16 sectors/track, 120480 cylinders, total 7710720 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: 0x80000000

Device................ Boot......Start..........End...... Blocks .......Id.......System
/dev/mmcblk0p1 ... *....... 2048 ....... 4095 ......1024 .........1........ FAT12
/dev/mmcblk0p2 ..............4096 ......7710719 ...3853312 ....83...... Linux

Command (m for help):

That is it! Select ‘w’ to commit the changes to the uSD card. Notice that the partition table in this example was “busy” so a reboot was needed to cause the changes to be reflected. Even if it were not busy, it seems like it could be a good idea to reboot at this point if you want to be extra safe.

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
root@debian-armhf:/# reboot


Step 4: Expand the Filesystem

This is the last step. Now that the second partition is larger, expand the filesystem to match the larger partition using resize2fs.

root@debian-armhf:/# df
Filesystem ....1K-blocks ....Used Available Use........% .......Mounted on
rootfs ..........1811704 .......740184 .... 977824 ......44% ........../
/dev/root .....1811704 ......740184 .... 977824 ...... 44% ........./
devtmpfs....... 253920 ............ 0 ........253920 ..... 0% ......../dev
tmpfs..............50816 .............216.......50600 ...... 1% ........../run
tmpfs..............5120................. 0 ........5120 .........0%.......... /run/lock
tmpfs ............ 101620.............. 0......101620 ....... 0% ........./run/shm
/dev/mmcblk0p.... 11004 ..... 474 ......530 ............48% ........./boot/uboot
root@debian-armhf:/#

root@debian-armhf:/# resize2fs /dev/mmcblk0p2
resize2fs 1.42.5 (29-Jul-2012)
Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mmcblk0p2 is now 963328 blocks long.

root@debian-armhf:/# df

Filesystem......1K-blocks .....Used ........Available .....Use% .....Mounted on
rootfs ...........3761680 .....741096.... 2851404 .........21% .........../
/dev/root ......3761680 ....741096 ....2851404 .......... 21% ........../
devtmpfs .......253920 ......... 0 ..........253920 ......... 0%............ /dev
tmpfs .............50816 ........ 216 ....... 50600 ......... 1%.............../run
tmpfs ............. 5120 .......... 0 ......... 5120 .............0%.......... /run/lock
tmpfs ............. 101620 ........ 0 ........ 101620 ......... 0%......... /run/shm
/dev/mmcblk0p1 1004 .... 474 ........... 530 ..... .......48% ......./boot/uboot
root@debian-armhf:/#..










BeagleBone Black 3G USB Dongle Mobile Internet

If you would like to have a small size linux computer with mobile broadband this can be one option for you. Possibilities nearly infinite regarding the applications of such device. For e.g. you want to place it to a remote location where you need Internet access and other linux based functionality (web/file server, monitoring, VPN, etc) and all with a low power solution.

I have got an unlocked Huawei 3G Dongle and made it work with the BeagleBone Black running Ubuntu.
All we need is to install one additional software called wvdial.

Have a look at my log of the process.

ubuntu@ubuntu-armhf:~$ sudo apt-get install wvdial

ubuntu@ubuntu-armhf:~$ sudo wvdialconf

Editing `/etc/wvdial.conf'.

Scanning your serial ports for a modem.

Modem Port Scan<*1>: S0 S1 S2 S3
ttyUSB0<*1>: ATQ0 V1 E1 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 Z -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyUSB0<*1>: Modem Identifier: ATI -- Manufacturer: huawei
ttyUSB0<*1>: Speed 9600: AT -- OK
ttyUSB0<*1>: Max speed is 9600; that should be safe.
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 Z -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyUSB1<*1>: Modem Identifier: ATI -- Manufacturer: huawei
ttyUSB1<*1>: Speed 9600: AT -- OK
ttyUSB1<*1>: Max speed is 9600; that should be safe.
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK

Found a modem on /dev/ttyUSB0.
Modem configuration written to /etc/wvdial.conf.
ttyUSB0<Info>: Speed 9600; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"
ttyUSB1<Info>: Speed 9600; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"
ubuntu@ubuntu-armhf:~$

Now we have to edit the configuration file:
I am using Swisscom mobile network here in Switzerland, so the mobile internet parameters should be changed according to your operator.

ubuntu@ubuntu-armhf:~$ sudo nano /etc/wvdial.conf

###################################################

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
; Phone = <Target Phone Number>
ISDN = 0
New PPPD = yes
Modem = /dev/ttyUSB0
Baud = 9600

[Dialer thenet]
Phone = *99***1#

Username = 9180******
Password = 9180******
Stupid Mode = 1
Baud = 460800
Init3 = AT+CGDCONT=1,"IP","gprs.swisscom.ch"

;[Dialer mypin]
;Init4 = AT+CPIN=1234

###################################################

Let`s connect to the Internet now



ubuntu@ubuntu-armhf:~$ sudo wvdial thenet
--> Ignoring malformed input line: ";[Dialer mypin]"
--> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CGDCONT=1,"IP","gprs.swisscom.ch"
AT+CGDCONT=1,"IP","gprs.swisscom.ch"
OK
--> Modem initialized.
--> Sending: ATDT*99***1#
--> Waiting for carrier.
ATDT*99***1#
CONNECT
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Thu Dec 12 21:49:29 2013
--> Pid of pppd: 781
--> Using interface ppp0
--> pppd: [18]f[02]
--> pppd: [18]f[02]
--> pppd: [18]f[02]
--> pppd: [18]f[02]
--> pppd: [18]f[02]
--> pppd: [18]f[02]
--> local IP address 10.80.216.102
--> pppd: [18]f[02]
--> remote IP address 10.64.64.64
--> pppd: [18]f[02]
--> primary DNS address 195.186.216.33
--> pppd: [18]f[02]
--> secondary DNS address 195.186.152.33
--> pppd: [18]f[02]



You can verify while you are connected that there is new interface called ppp0 is created



ubuntu@ubuntu-armhf:~$ ifconfig
eth0 Link encap:Ethernet HWaddr c8:a0:30:b0:f1:18
inet addr:192.168.0.15 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::caa0:30ff:feb0:f118/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5716 errors:0 dropped:0 overruns:0 frame:0
TX packets:1802 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2213903 (2.2 MB) TX bytes:207719 (207.7 KB)
Interrupt:56

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

ppp0 Link encap:Point-to-Point Protocol
inet addr:10.80.216.102 P-t-P:10.64.64.64 Mask:255.255.255.255

UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:7 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:130 (130.0 B) TX bytes:181 (181.0 B)

On the BeagleBone Black running Ubuntu, I have tested the following applications.:

- FTP server
- Web / Apache server
- NAS / Samba server
- USB 3G Mobile Internet Dongle

All works perfectly well. Same instructions as it shown for the Raspberry Pi.

Ubuntu 14.04 and Skype

Making work SKYPE with Ubuntu 14.04

Please follow the steps to make skype work with Ubuntu 14.04

[1] sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"
[2] sudo apt-get update
[3] sudo apt-get install skype && sudo apt-get -f install

if running 64 bit version you may have a problem with the skype audio.
Here is the fix:

sudo nano /etc/pulse/default.pa

here search for

load-module module-udev-detect

and change it to

load-module module-udev-detect tsched=0

and run these from terminal:

pulseaudio -k
pulseaudio -D

and your audio should work

you may need to add the following commands to the autostart of your Ubuntu.

bash -c "sleep 8 && pulseaudio -D &"

bash -c "sleep 15 && skype &"

Admin