Wednesday 14 October 2015

Start Banana Pi a first time

Hello Friends, 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.
1
2
3
4
5
6
sudo fdisk -l
umount /dev/mmcblk0p1
sudo fdisk -l
tar zvxf Lubuntu_For_BananaPi_v3.1.1.tgz
ls *img
sudo dd bs=4M if=Lubuntu_1404_For_BananaPi_v3_1_1.img of=/dev/mmcblk0

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
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.
1
ssh root@192.168.2.115
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
1
apt-get upgrade
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
1
sudo apt-get upgrade
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.
1
2
passwd root
passwd bananapi

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
1
id bananapi
We add the user bananapi to the group sudo
1
2
usermod -a -G sudo bananapi
id bananapi
uid=1000(bananapi) gid=1000(bananapi) groups=1000(bananapi),4(adm),20(dialout),21(fax),24(cdrom),25(floppy),26(tape),27(sudo),29(audio),30(dip),44(video),46(plugdev),102(netdev),105(fuse),108(scanner),113(lpadmin)
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.
1
sudo fdisk -l
Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
4 heads, 16 sectors/track, 242560 cylinders, total 15523840 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: 0x2b1c25d6
Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            2048      124927       61440   83  Linux
/dev/mmcblk0p2          124928     7167999     3521536   83  Linux

No comments:

Post a Comment