Notes on installing and running LINBPQ.

Introduction

LINBPQ is a Linux version of the BPQ32 Node,  BBS and Chat Server components. Other BPQ32 applications may be added later. Although all testing was done on Linux systems (Raspberry PI running Raspbian and a PC running Ubuntu) it should work on other Unix systems.

LINBPQ normally runs as a console application but can be run as a daemon. I usually have it set to run in a virtual console, started by init.

Management is via a Web Browser.

The current version includes drivers for KISS, AXIP, BPQEther, Kantronics Pactor Modems, Telnet, SCS Tracker, SCS PTC, AGWPE, UZ7HO Soundmodem, WINMOR and an I2C Driver for PITNC on the PI. Others to follow. As AGWPE, UZ7HO and WINMOR only run on Windows, these must be run on a separate PC. The Linux Soundmodem can be used by configuring it to present a virtual KISS interface.

Note - The Tracker seems to crash the PI - it works fine on PC linuc systems. This is under investigation.

Installation.

The i386 Ubuntu version can be downloaded from

  https://dl.dropbox.com/u/31910649/linbpq

and the  pi version from

 https://dl.dropbox.com/u/31910649/pilinbpq

The source will be available soon for those who want to try it on another platform.

I suggest you create a directory linbpq to hold the software and files. The simplest way to download is to use wget. You will need to make it executable.

chmod +x linbpq

If you want to use UDP or TCP ports below 1024, or the BPQEther Driver, you must also set some capabilites on the file (or run as root, wihch is not advisable). You may need to install setcap if it isn't already on your system - sudo apt-get install libcap2-bin (or the equivalent for your disatribution.

sudo setcap "CAP_NET_RAW=ep CAP_NET_BIND_SERVICE=ep" linbpq

You also need some web pages for the management interface. Create directory HTML (capitals) under your linbpq directory, and download and unzip https://dl.dropbox.com/u/31910649/HTMLPages.zip into it.

Configuration.

The Node configuration is read from file bpq32.cfg, the format of which is the same as for the Windows version. (note like all Unix names it is case sensitive – BPQ32.cfg won’t work).

You also need some web pages for the management interface. Create directory HTML (capitals) under your linbpq directory, and download and unzip https://dl.dropbox.com/u/31910649/HTMLPages.zip into it.

As serial port names are pretty variable in Linux, the code accesses them via symlinks in the linbpq directory to ports called com1 – com255. So, for example, to access a TNC connected to the serial port on the PI, enter

 ln –s /dev/ttyAMA0 com1 (lower case!)

and specify IOADDR (or COMPORT) 1 in the bpq32.cfg.

As management is web based, you must have a Telnet port with an HTTPPORT line and a user record for yourself. Set the SYSOP flag on the user record – something like:

USER=john,pass,g8bpq,””,SYSOP

You may also need TCPPORT and FBBPORT lines for access using telnet or bpqtermtcp

The BBS config is stored in linmail.cfg. . This will be created when software first runs if it doesn’t already exist. If you want to copy the bbs configuration from an existing bpqmailchat installation, there is a version of mailchat available from https://dl.dropbox.com/u/31910649/BPQMailChat.exe that will save your configuration to linmail.cfg in the MailChat folder when it closes.

The Chat Server config is stored in chatconfig.cfg. This will be created the first time the software runs, and can be updated using the web management interface.

Running.

If run without a parameter, ie ./linbpq only the node will run. If you add mail as a parameter, ie ./linbpq mail the BBS will be started. If you add chat, the Chat Node will be started. See below for details of how to run LinBPQ automatically when Linux loads.

You can also add the lines

LINMAIL
and/or
LINCHAT

to bpq32.cfg to enable the Mail or Chat servers

Management.

The management is via a Web browser, I’ve tested with Chrome and Firefox, but others may work. Just point the browser to host:HTTPPORT, and the rest should be obvious. If you access locally as 127.0.0.1 (not localhost) you don’t need a password to access the mail pages. If not you will have to sign in using the user and password from the telnet port configuration.

Debuging

Problems are likely in the early stages. Set your system up to create core files when a program fails if this isn’t enabled by default. On my systems this needs the command

  ulimit -c unlimited

I added it to file .bashrc



The following instructions were originally written for the Raspberry PI, with the LinBPQ software running as user pi. The user name can be changed to suit your installation. It is possible to run as root, but this is not advisable

Running LinBPQ automatically

You can have LinBPQ start automatially when the OS is loaded, and restart if it fails. I suggest running it in a Linux Virtual Console - the examples use tty2, but you can change to suit you requirements The mechanism uses  the init process, but the details depend on the disribution.

Create a script to run linbpq

/home/pi/linbpq/runbpq

cd /home/pi/linbpq
sudo -u pi mv linbpq.new linbpq
sudo -u pi ./linbpq

Set runbpq ax executable:

chmod a+x /home/pi/linbpq/runbpq

For Rasbian

Add the following lines to /etc/inittab

##Start LinBPQ on bootup and respawn it should it crash
BPQ:2345:respawn:/home/pi/linbpq/runbpq >/dev/tty2

Remove (or comment out) the line

2:23:respawn:/sbin/getty 38400 tty2

For Ubuntu

Create a file bpq.conf in directory /etc/init

/etc/init/bpq.conf

#
start on runlevel [2345]
stop on runlevel [!2345]

respawn

exec "/home/pi/linbpq/runbpq" >/dev/tty2

In directory /etc/init rename tty2.conf to tty2.save

For those unfamilair with Linux Virtual Consoles, the linux system has several console windows (usually 7) that you can switch between using the key combination alt/fn1 to alt/fn7. If you are running the X gui this nomally runs in 7, and you can switch to the others using ctrl/alt/fn1 etc. If you are accessing remotely, for example using ssh, there is a program conspy that allows to to interact with the virtual consoles.You''ll probably need to install it - eg sudo apt-get install conspy.

Running Spider DX Cluster with LinBPQ

Install Spider following instructions in Pi Yahoo group

The following sets up the linux kernel ax.25 and NETROM code to provide a link from LinBPQ to spider.
There are other ways of doing this, but this way only needs one callsign/alias,
and gives access to both local RF and network users.

Install socat, ax25-apps, ax25-tool

I've found that some systems run rc.local more than once, so the following instructiions have been changed from the original document

Add to /etc/rc.local

/etc/rc.local

modprobe netrom
ifconfig nr0 down
nrattach netrom
ifconfig nr0 10.0.0.2 up

ax25d
netromd -i -t 15
exit 0

Replace  /etc/ax25/axports. /etc/ax25/nrports, /etc/ax25/nrbroadcast, /etc/ax25/ax25d.conf. with the following

ReplaceGM8BPQ-1 and BPQDX with the call and alias you want to use for Spider

/etc/ax25/axports

#
# The format of this file is:
#
# name callsign speed paclen window description
#
bpq GM8BPQ-1 1200 236 6 Link to LinBPQ


/etc/ax25/nrports

#
# The format of this file is:
#
# name callsign alias paclen description
#
netrom GM8BPQ-1 BPQDX 236 Switch Port


/etc/ax25/nrbroadcast

#
# The format of this file is:
#
# ax25_name min_obs def_qual worst_qual verbose
#
bpq 5 255 1 0


/etc/ax25/ax25d.conf

#
# ax25d Configuration File.
#
# AX.25 Ports begin with a '['.
#
#
# NET/ROM Ports begin with a '<'.
#

NOCALL * * * * * * L
default * * * * * * - sysop /spider/src/client client %u ax25
#

Add to bpq32.cfg

PORT
ID=COM11 Link to Kernel ax25
TYPE=ASYNC
PROTOCOL=KISS
QUALITY=255
COMPORT=11
CHANNEL=A
SPEED=9600
MAXFRAME=6
FRACK=5000
RESPTIME=1000
RETRIES=10
PACLEN=236
ENDPORT

APPLICATION 1,DX,C GM8BPQ-1,GM8BPQ-1,BPQDX


Create a script to create the socat pair and run kissattach and LinBPQ

/home/pi/linbpq/runbpq

killall kissattach
killall socat

socat -d -d -ly pty,raw,echo=0,link=com10 pty,raw,echo=0,link=com11&
sleep 1
chmod a+rw com11

kissattach com10 bpq 10.1.1.1

sudo -u mv linbpq.new linbpq
sudo -u pi ./linbpq

Set runbpq as executable using chmod: chmod a+x /home/pi/linbpq/runbpq


Using 3rd party APRS Clients

LinBPQ includes an APRS digipeater/IGate, but not an APRS client. It is possible to run other APRS clients (eg Xastir), and configure the LinBPQ APRS code up to bridge packets to/from it.

This uses a pair of socat virtual serial ports, with one defined to the APRS Client and the other to LinBPQ

socat -d -d -ly pty,raw,echo=0,link=com5 pty,raw,echo=0,link=com6&

Add a KISS port definiton to bpq32.cfg - something like

PORT
ID=COM5 Bridge to XASTIR
TYPE=ASYNC
PROTOCOL=KISS
QUALITY=0
COMPORT=5
CHANNEL=A
SPEED=9600
MAXFRAME=6
FRACK=5000
RESPTIME=1000
RETRIES=10
PACLEN=236
ENDPORT

Add the following to the APRSDIGI section. This assumes your APRS RF port is Port 1 and the virtual port is Port 2

 APRSPath 2=APRS

Bridge 1=2
Bridge 2=1

Any packet received on Port 1 will be sent unchanged to Port2, and vice versa. Note this is not the same as if they were digipeated - the digi stings are not examined or updated. It looks to the APRS client that is has direct access to the RF port. The Client should not be set to digi anything - that is done by LinBPQ. The Client is just providing the messaging and display/mapping functions.

Using TNC-PI

The TNC-PI  is configured much the same as a normal KISS port, but with the following line added

KISSOPTIONS=PITNC,NOPARAMS

This will prevent the Node sending KISS Parameters, and thus overriding the values set using the pitnc_setparams program.

   via Serial port.

Note that SPEED must be set to 19200

   via i2c Port

TYPE is set to I2C instead of ASYNC, and IOADDR/COMPORT are replaced with I2CBUS and I2CDEVICE:

 TYPE=I2C
PROTOCOL=KISS
I2CBUS=0 ; 0 for Version 1 board, 1 for Version 2
I2CDEVICE=16 ; This is in decimal

John Wiseman G8BPQ
10th March 2013