A first time Banana Pi experience

In this article I will present you with the experiences that I made when installing everything to boot up a Banana Pi with a Lubuntu operating system. I will also show you what went wrong and will sprinkle in some hints on how to configure the system.

How did I get this idea?

I was always wondering how to get my own server up an running at home. I did my first steps with a laptop but that was not satisfactory. I wanted to use the laptop also for other stuff and furthermore I disliked the ratio between power consumption and the time I actually used the server. So when hearing about the Raspberry Pi I was interested but only when reading about the Banana Pi I was hooked as I believed it would suit my requirements:

  • No fan, no noise
  • Small and unobstrusive
  • Constantly on as it consumes low power

Banana Pi Shopping cart

So I bought a few components.

components

  1. Banana Pi board
  2. SD Card SanDisk Ultra 30MB/s 8GB class 10
  3. Micro USB AC/DC Adapter, Model “MAREL-5V2000”

Installation

But the Banana Pi HW itself isn’t booting up on it’s own you need a decent Operating System and there exists a bunch of them. You will find all of them on the lemaker web pages. As I fancy Ubuntu my first choice was the Lubuntu distro. Besides you will find quite a few installation instructions which helped me a lot but there were also pitfalls.
I will show you how it worked in my case and as always I don’t take any responsibilities you use the following instructions at your own risk. ūüėČ

Preparing the SD card

The below is pretty much the same as in the instructions. just the name of the SD card device is different. I used my laptop, which allows me to insert SD cards, with an installed Ubuntu 12.4.

When hiting return on the comamnd in line 6 be prepared to take a break. This took for me about 20 to 30 minutes to finish.

First start, first experience

Now it became interesting. I connected my old tube TV which features an AV input with the AV output of the Banana Pi and pluged in the power. What shall I say? The screen stayed dark. One minute, two minutes, five minutes. The only “eye candy” were two LEDs. Basically a red LED which was constantly on and a green LED which first was on and then went into a slow blinking pattern. An SOS? No actually this is a good sign as it shows that the CPU and SD card talk to each other.

  • RED LED = power
  • GREEN LED = SD Card Access

But then I connected the Banana PI via it’s HDMI plug to the TV and it worked!

Logging in to the Banana PI

I wanted to use the machine remotely so I tried to log in from a console via ssh. For this to succeed you need to know the IP address that the Banana PI got assigned via DHCP.

1_ping_lemaker

In your case the IP might be of course different but in mine the following command will alow you to log in as root.

2_first_login

Congratulations your first log-in!

As you see there are quite some upgrades pending.

Therefor the next thing to try is to call

Please note, as we just logged in using the root account this will work perfectly. If we however use for example the banapi user account where you would call

this will fail as the bananpi user account has no sudo permission. If you paid close attention you probably spotted that the console screenshot above shows a log-in with the bananpi user account. So I actually run into that problem and I will show you some chapters below how to get rid of this limitation.

A second SD card does not work

While using mainly ssh and no monitor. I realized that I am in for an OS change. An OS such as Bananaian without X support might fit better. Besides I find it a realy cool feature to just swap SD cards to fire up another OS and bought an SD card in a shop. Also 8GB, same vendor but this card was just Class 4 and not Class 10 as my initial card.

  • SanDisk SDHC Card 8GB class 4

I repeated the steps I made for the first SD card. This time with no success, it did not work. I had permanently the green LED on, which as I know today, is no good sign. In this case the device is not booting up and is not getting an IP address.

After hours of casting “format” commands and “dd” commands in different variations at the SD cards I felt frustrated and had to accept failure. The card itself is perfectly working in my laptop but it is not tolerated by the Banana Pi.

Trying a third card identical to the first

I wanted to have a second working card and just bought the same class 10 card and of cours it worked! So why does the class 4 not work…? If anyone knows please drop a comment.

Power consumption

As I mentioned, power consumption is a key parameter for me. So I tried to measure the power consumption with the meter that I have used in the past. Well what shall I say, the meter that is working happily on a TV, laptop or radio is not accurate enough to measure the Banana Pi. The Banana Pi does just not consume enough power and my meter does not bother and keeps displaying a 0 consumption.

Do you need a case for the Banana Pi?

If you studied carefully my list of ingredients at the top of the article you may have noted that I did not buy a case. I thought I could save the money but the handling of the naked board is cumbersome if it sits loosly in front of you on your table. So I would suggest that if you can spare the money go an buy a case. I will do the same.

Configuration changes I would recommend

Do not stay with the default passwords

The OS just installed has a password that is known to everyone. Even worse the password of root on that machine is known to everyone, which is dagerous. That should send cold shivers down your spine. So we better go and change it now!

It is no good idea to keep the passwords unchanged!

Just enter the below commands and type and re-type your new cunning password as requested.

Assign SUDO rights to user bananapi

I do not like working as root so to grant to the user bananapi the rights you have to add him to the sudo group as by default it belongs just to the below groups

We add the user bananapi to the group sudo

6_changing_passwords

Good-Bye Root! Now we can exit back to the bananapi account and work with the new sudo rights.

There is one catch, the systm did not reread the groups. The easiest way of getting a reset of the group ids is by exiting the ssh and reopen the ssh connection.

Inflating a 4GB image in an 8GB SSD leaves space

The OS image is apparantly from a 4GB card and I have used a 8GB card which leaves 4GB ununsed as you can see if entering the commadn fdisk -l when being logged in to the Banana PI. In the below you have to look at the used sectors and divide this by 2 to get to the size in kBytes.

Now what to do with it?

As said my aim is to use it as a server but this I will cover in another article where I am going to show how to setup Ruby On Rails with MySQL on that tiny computer.

 Copyright © 2014Georg Schweflinghaus

Mounting FAT drive in Ubuntu with the right permissions

I just plugged an old harddisk with a FAT filesystem on it that was used on a windows machine mounting it to my ubuntu system and ran into a problem of managing the files on that drive. I seldomly do this and if you run into the same issues maybe the following is of help to you. But first as always a word of caution. If you follow the steps I describe you do this at your own risk. I will not be responsible or liable for any damage or loss.

Symptoms

The symptoms were that I was able to see all data but was not able to delete or even move files.

[bash]>ls -l
-rwxr-xr-x 1 root root 113846 Apr 25 2006 TrekStor.ico
drwxr-xr-x 4 root root 32768 Mai 9 2009 Video
-r-xr-xr-x 1 root root 57636 Jul 18 2010 cache_0001.xml[/bash]

Initially I had this in the fstab file. The /dev/sdb1 is the device I mounted and the /media/sdb is the place where I mounted it in the linux file system as a FAT drive. Maybe you have something similar.

[bash]/dev/sdb1                /media/sdb     vfat    rw,user    0    0[/bash]

Thinking into the symptoms I realized that I am mounting a filesystem that does not know user rights into a file system that does. One might think that the “rw” option in the fstab should be sufficient but it is not.

The solution

To come to the point. I wanted the files of the mounted FAT drive to belong to my group and I wanted full read write execute rights on the file. In addition I wanted them to be only invisible for anybody else on the machine. To achieve this, first you need to find out your groups ID by issuing this command. (It shows my return values, yours may look different)

[bash]>id
uid=1000(georg) gid=1000(georg) Gruppen=1000(georg),….[/bash]

So now we know that (in my case) the group ID is 1000 we will enter this together with a mask into the fstab

gid=1000,umask=0007

by issuing.

[bash]sudo gedit /etc/fstab[/bash]

And then adding a line looking something like this.

[bash]/dev/sdb1 /media/sdb vfat rw,user,gid=1000,umask=0007 0 0[/bash]

Now you unmount then mount again, which will only work if you are no longer using the files on that mounted drive. So please close editors or cd out of the directory.

[bash]
>sudo umount /dev/sdb1
>sudo mount /dev/sdb1
[/bash]

And if you now look at the files on the drive you see that the permissions are set properly for you to change whatever files you want to change.

[bash]>ls -l
-rwxrwx— 1 root georg 113846 Apr 25 2006 TrekStor.ico
drwxrwx— 4 root georg 32768 Mai 9 2009 Video
-r-xr-x— 1 root georg 57636 Jul 18 2010 cache_0001.xml[/bash]