Tuesday, 27 December 2016

Solution for the power problem of Banana Pi R1

One of the problems of Banana Pi R1 is the insufficient power supply. I was hit by this problem when I added a 1gb disk drive to my R1. The problem revealed when the R1 began stopping to work at once and had to be repowered to work again.

My solution is a different power unit.


I bought a power unit that is normally used for external hard disks. I adapted a Molex y-cable. I replaced the molex socket on one end with a micro USB plug. Now the disk on my R1 is powered directly by the power unit and not by the board. No I have no power problems anymore.


Wednesday, 30 November 2016

Syncthing

I just bought the LG Stylus 2 smart phone, which won't give me access to the SD card as mass storage device, so I installed syncthing as first service on my BPI-R1.

Repository

The first thing to do is to attach the syncthing repository.

curl -s https://syncthing.net/release-key.txt | apt-key add -
echo "deb http://apt.syncthing.net/ syncthing release" | tee /etc/apt/sources.list.d/syncthing-release.list

Next I updated the package cache.

apt-get update

Installation

apt-cache search syncthing
apt-get install syncthing
apt-get install syncthing-inotify

Then I checked what was installed

dpkg-query -L syncthing

Next step was to add a syncthing user

useradd syncthing

Then I linked
  /lib/systemd/system/syncthing@.service
to
  /etc/systemd/system/multi-user.target.wants/syncthing@syncthing.service
in order to start the service in multi user target.

Now enable the Service

systemctl enable syncthing@syncthing.service

First settings

Before I started the service I had to adjust the adress setting in ~/.config/syncthing/config.xml. Normally the syncthing web frontend listens to localhost. I want to be able to access the GUI from everywhere, so I replaced localhost within the address file

    <gui enabled="true" tls="false" debugging="false">
        <address>0.0.0.0:8384</address>
        <apikey>xxxxxxxxxxxxxxxxxxx</apikey>
        <theme>default</theme>
    </gui>

Now it possible to access the GUI from every PC on the LAN. Open a browser and enter the servername
   myserver:8384
in the URL field of the browser.

Share directory

Make a directory

mkdir /mnt/data/syncthing/doc

Enter it in the syncthing web GUI


follow the instructions in the syncthing manual to share directories with other devices.

Hint: If you want to sync to an SD card in an Android phone you have to place the local directory on the phone under the path ...sdcard.../Android/data/com.nutomic.syncthingandroid.files.  Only in this subtree on the SD card syncthing is allowed to write.


   

Monday, 14 November 2016

Very basic NFS configuration

My R1 should work as file server. My other clients have also Linux installed, so I decided to use NFS to get fast and simple access the the R1 hard disk.

Install the NFS server:
apt-get install nfs-kernel-server
Share the fixed disk (mounted on /mnt/data) via NFS:
exportfs *:/mnt/data/
To make the share persistent add in
/etc/exports
the following entry
/mnt/data/       *(rw,sync,no_subtree_check)

Tuesday, 25 October 2016

Installing armbian

 

Now - over a year later - I think it is time for a "relaunch".  I will give armbian a try.

Installation

Before you can install armbian on the board you have to download it from http://www.armbian.com/. At the moment one can choose between an older legacy kernel and an newer vanilla kernel. I took the newer vanilla kernel because I have no need for video acceleration. I want to use my R1 as home server.  When the download is finished you can extract the image of the archive:
7z e archive.7z
Now you have an IMG file. In the next step write the IMG file to the sd card.
dd if=archive.img of=/dev/sdx # replace x by your device number
 After dd stops, sync the file buffers.
sync
Now remove the sd card from your sd card reader and insert it into your R1. Turn it on. If you've done everything right, armbian boots. At the end of the boot process the login prompt is displayed. Log on as root and follow the instruction - you have to change the root password and add a user.

Network

Now you're logged in as root and your network is configured via DHCP.  The default configuration prevents network connections between the ports of the switch. I want my R1 to behave like a simple switch. Fortunately the armbian developers already prepared a network configuration file for this purpose. In /etc/network there is a file interfaces.r1switch. It is the base for my configuration. I copied this file to /etc/network/interfaces an added a static IP address.

auto lo
iface lo inet loopback

auto eth0.101
iface eth0.101 inet manual
    pre-up swconfig dev eth0 set reset 1
    pre-up swconfig dev eth0 set enable_vlan 1
    pre-up swconfig dev eth0 vlan 101 set ports '0 1 2 3 4 8t'
    pre-up swconfig dev eth0 set apply 1

auto wlan0
iface wlan0 inet manual

auto br0
iface br0 inet static
bridge_ports eth0.101 wlan0
  address 192.168.178.2
  netmask 255.255.255.0
  gateway 192.168.178.1
  dns-nameservers 192.168.178.1
At his point I discovered a problem with the swconfig tool. The problem and solution are discussed here. After I installed swconfig from the forum thread everything worked fine.

Update

Now that we have a network connection it is time to update the os.
apt-get update
apt-get upgrade

SATA Disk 

Hint:
When I installed my SATA drive I was hit by one of the shortcoming of this board. Every time I tried to format the disk the board crashed. First I thought the board is defect but then I found out it was the insufficient power supply of this board. I disconnected the USB keyboard and everything worked fine.

To find out the device name list all block devices:
lsblk
Output looks like this:
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 931.5G  0 disk
└─sda1        8:1    0 931.5G  0 part /mnt/data
mmcblk0     179:0    0  28.8G  0 disk
└─mmcblk0p1 179:1    0  28.5G  0 part /
Then format the disk:
mkfs.ext4 /dev/sda1
 Now mount the disk:
mkdir /mnt/data
mount /dev/sda1 /mnt/data
 Add an entry to fstab to make the mount persistent:
/dev/sda1       /mnt/data   ext4   defaults 0 0


Wednesday, 28 September 2016

How it started

Last year I saw this little board with those features I searched so long for.

A mixture of:
  • switch
  • access point
  • home server
It looked like a "eierlegende Wollmilchsau". A device that meets all my needs and a whole bunch of operating systems available. So I ordered it on the Internet. A few days later I had my device at home. At the same evening my enthusiasm was replaced by disillusion. Nothing seemed to work out of the box. I recognized I was at the beginning of a long and rocky track. I was able to knock a basic configuration together based on Bananian 15.04. This included compiling the WLAN driver and hostapd. Then I paused my work.

The technological shortcomings of this boards are:

Links:
Site of the bananian operating system. 
Site of armbian operating system