Server Migraton

This blog is run using a cheap VPS with legacy equipment and recently, the vender announced they are shutting down the datacenter this VPS exists in.  As such, I’m migrating to a new VPS machine.  This is the first post on the new install.  Hello World!

PAT – A Winlink Cliet

Here is how I run Pat with AX25. This assumes Direwolf can key your radio for 2M/ 1200 baud connections to local nodes. I’ve yet to get this actually working, as I live in hole which RF can’t seem to escape.

Run Direwolf, with APRS stuff commented out of the config file. The -p and -c flags are needed.

$sudo direwolf -p -c direwolf_noaprs.conf

This will give a symlink, such as:

Virtual KISS TNC is available on /dev/pts/1
Created symlink /tmp/kisstnc -> /dev/pts/1


Take note of the device number, in this case, /dev/pts/1 Bind the port to AX.25

$ kissattach /dev/pts/1 wl2k
AX.25 port wl2k bound to device ax0


Then, run pat. I use a bunch of arguments here, you don need to.

$pat --listen ardop,ax25,telnet http -a 0.0.0.0:8080

Open a browser, and load pat interface on :8080. Please note 0.0.0.0 allows connections from other machines, not just localhost which is useful for VPN.

You noticed that I included ardop in the config – this is a HF modem which needs separate command line arguments for configuration. Basic config is below. 8515 is the port, plughw is the USB sound card for I/O. Find the audio cards by typing aplay -l into the terminal

Download ardop here.

$./ardopc 8515 plughw:1,0 plughw:1,0

Server uptime

This Linux machine has been up for quite a bit of time.  It’s going down soon for a complete refit.  If this post is here in a few days, it means I didn’t break the SQL database!  Whoohoo!

$ uptime

15:16:27 up 858 days,  5:02,  2 users,  load average: 1.43, 1.65, 1.65

 

SVXlink Part 2

This is just notes for myself really, but part one can be found here.

Default path for sound files in Debian.  This path depends on your distro;
/usr/local/share/svxlink/sounds/en_US

What I have done to build custom modules into SVXlink is to use DTMF tones to trigger external scripts.  Those scripts are written in Bash or Python.

Drop a file in the following path, copy and paste below, edit as needed.  As you can see, toggling a DTMF tone will run a script and send me an eMail.
/usr/local/share/svxlink/events.d/local/Logic.tcl

###############################################################################
#
# Generic Logic event handlers (local extension)
#
###############################################################################
# This is the namespace in which all functions and variables below will exist.
#
namespace eval Logic {
# Executed when a DTMF command has been received
# cmd - The command
#
# Return 1 to hide the command from further processing is SvxLink or
# return 0 to make SvxLink continue processing as normal.
#
proc dtmf_cmd_received {cmd} {
global active_module
if {$active_module != "" && [string index $cmd 0] != "*"} {
return 0
}
if {[string index $cmd 0] == "*"} {
set cmd [string range $cmd 1 end]
}
if {$cmd == "99"} {
puts "Executing external command 99"
playMsg "Core" "relay4"
exec mail -a /home/revmook/test.text -s "DTMF command test 99" revmook at echoparklake dot clam < /dev/null &
return 1
}
if {$cmd == "98"} {
puts "Executing external command 98"
playMsg "Core" "relay3"
exec mail -a /home/revmook/test.text -s "DTMF command test 98" revmook at echoparklake dot clam < /dev/null &
return 1
}
if {$cmd == "97"} {
puts "Executing external command 97"
playMsg "Core" "relay2"
exec mail -a /home/revmook/test.text -s "DTMF command test 97" revmook at echoparklake dot clam < /dev/null &
return 1
}
if {$cmd == "96"} {
puts "Executing external command 96"
playMsg "Core" "relay1"
exec mail -a /home/revmook/test.text -s "DTMF command test 96" revmook at echoparklake dot clam < /dev/null &
return 1
}
return 0

External sounds for the above script go in this path.  Please note SVXlink is picky about the file format. I can’t recall what it is (mono 16 bit I think) but it will error out if things are not right.
/usr/local/share/svxlink/sounds/en_US/Core

svxlink – install on a pi

This is going to be the first post in a series on how to setup an Echolink node using cheap hardware. Read more about Echolink here.

EchoLink allows licensed Amateur Radio stations to communicate with one another over the Internet, using streaming-audio technology.  The system allows worldwide connections to be made between stations, or from computer to station, greatly enhancing Amateur Radio’s communications capabilities.  There are more than 200,000 validated users worldwide — in 151 of the world’s 193 nations — with about 5,200 online at any given time.

The first thing we need to do is Install svxlink on a pi. These instructions assume you have a pi running already, and you can log into it with SSH.

Create the user “SVXLink”. The software will not compile corrctly without this user.
sudo adduser svxlink

Download and install the dependencies:

sudo apt-get install libgsm1 libgsm1-dev sigc++ libsigc++-1.2-5c2 libsigc++-1.2-dev libpopt0 libpopt-dev tcl8.4 tcl8.4-dev g++ subversion patch mutt libqt3-mt libqt3-mt-dev libqt3-headers libgcrypt11 libgcrypt11-dev libspeex1 libspeex-dev libboost-dev libasound2 libasound2-dev qt4-dev-tools cmake screen

Grab the source code.

sudo wget https://github.com/sm0svx/svxlink/archive/master.tar.gz
sudo tar xvf master.tar.gz
sudo rm master.tar.gz

Build and install SVXLink

cd /usr/src/svxlink-master/src
mkdir build
cd /buiild
cmake ..
sudo make
sudo make install
sudo ldconfig -v

Download sounds for your language:

cd /~
wget https://github.com/sm0svx/svxlink-sounds-en_US-heather/releases/download/14.08/svxlink-sounds-en_US-heather-16k-13.12.tar.bz2
tar xvf svxlink-sounds-en_US-heather-16k-13.12.tar.bz2
sudo mkdir /usr/local/share/svxlink/sounds/en_US
sudo cp -a en_US-heather-16k/* /usr/local/share/svxlink/sounds/en_US

Please note that this path is different than anything that I could find on the ‘net. If you’re getting warnings like

*** WARNING: Could not find audio clip "deactivating" in context "Default"

or

*** WARNING: Could not find audio clip "name" in context "EchoLink"

then you need to find where SvxLink is looking for these files. The easiest way to do this is search for the ‘events.tcl’ file.

updatedb
locate events.tcl

You should be able to start svxlink from the command line, but maybe you will get a bunch of errors. We need to modify the config file, which defaults in /usr/local/etc/svxlink. More on this in another post.

A thirsty bird and my Pi

A fuzzy picture of a thirsty bird and my Pi.  Note the binder clip which secures the SD card and the USB sound card.

APRS – Position data over amateur radio


Automatic Packet Reporting System (APRS) is an amateur radio-based system for real time tactical digital communications of information of immediate value in the local area. In addition, all such data are ingested into the APRS Internet System (APRS-IS) and distributed globally for ubiquitous and immediate access. Along with messages, alerts, announcements, and bulletins, the most visible aspect of APRS is its map display. Anyone may place any object or information on his or her map, and it is distributed to all maps of all users in the local RF network or monitoring the area via the Internet. Any station, radio, or object that has an attached GPS is automatically tracked. Other prominent map features are weather stations, alerts and objects and other map-related amateur radio volunteer activities including Search and Rescue and signal direction finding.

hpacucli, HP Proliant, Debian

Last time I went to my servers colocation was a year ago. At that time I dropped in a new disk to replace a failed device in the RAID array. Turns out I broke the RAID somehow. The server is an HP Proliant which features a hardware raid with battery backup.

Let’s try and fix this using hpacucli utility. After installing the software, we can query the disks. I have an unassigned disk, which I want to add into Array A. I also want to change Array A into a level 1 RAID.

$ sudo hpacucli ctrl all show config

FIRMWARE UPGRADE REQUIRED: A firmware update is recommended for this controller
to prevent rare potential data write errors on a
RAID 1 or RAID 1+0 volume in a scenario of
concurrent background surface analysis and I/O write
operations. Please refer to Customer Advisory
c01587778 which can be found at hp.com.

Smart Array E200i in Slot 0 (Embedded) (sn: PR7BMU0937 )

array A (SATA, Unused Space: 0 MB)

logicaldrive 1 (931.5 GB, RAID 0, OK)

physicaldrive 1I:1:4 (port 1I:box 1:bay 4, SATA, 1 TB, OK)

array B (SATA, Unused Space: 0 MB)

logicaldrive 2 (931.5 GB, RAID 0, OK)

physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SATA, 1 TB, OK)

unassigned

physicaldrive 1I:1:3 (port 1I:box 1:bay 3, SATA, 1 TB, OK)

For some reason the utility will not start on it’s own. I get this error message.

$ sudo hpacucli
HP Array Configuration Utility CLI 9.40.12.0
Detecting Controllers...

Error: Another instance of ACU is already running (possibly a service). Please
terminate the ACU application before running the ACU CLI. Press ENTER to
exit.

Most of the posts I’ve found on the ‘net suggest removing the lock file at
/opt/compaq/cpqacuxe/bld/locks

This didn’t work in Debian. The lock file is elsewhere.

/dev/shm/sem.hpacu.appLock

Then,

sudo hpacucli
HP Array Configuration Utility CLI 9.40.12.0
Detecting Controllers...Done.
Type "help" for a list of supported commands.
Type "exit" to close the console.

=>

Whoot! I got the command line finally. Let’s add the unassigned disk into the array.

hpacucli
ctrl slot=0 ld 1 add drives=1I:1:3

Error: This operation is not supported with the current configuration. Use the
"show" command on devices to show additional details about the
configuration.
Reason: Transformation size zero

Hmmm… Not sure what this means, but after some Googling around it seems like the internal battery for the hardware RAID has completely failed, or it is unplugged. I might be able to setup a software RAID, which I think is better for my application anyways as I can use the disk in any machine with the same RAID software. When using a hardware raid, failure of the actual hardware could mean data loss. More on this later.

Encryption

Here is my public key. Need more info? Follow the link.

http://www.dewinter.com/gnupg_howto/english/GPGMiniHowto.html

—–BEGIN PGP PUBLIC KEY BLOCK—–
Version: GnuPG v1.4.10 (GNU/Linux)

mQENBFF19FIBCAC8Z172AYEoHvrx+dDIQu/qkn4vfosjQK3EW2CN4ebLQ4ocvRgs
HDPI3TWpJbeGJWSUx1SZ3HyVqoPX+2OqEx/DEOPWnwxRaVSCTElZ4zAQClSLxqBB
btBfRB1OreemmRJ+biblWJahshamJdHfdSddVVg+5dH/zRL39IItEp9d5aMvqJzQ
/nfWNVF5yJU/yl0/42+KDCJJLQivnS+UGPVmpjYwNerz2F5tnpHMYwoitgGZZ++P
qXz1yJo94DFQwfziSg6dU5k3ypefaUraAWDEi3HtZsvLKPHgAVzE+dnDMbvkKnba
4qsyoejyuq+dbR/5es5UCCosXRTQ+xKEm/3zABEBAAG0IHJldiBtb29rIDxyZXZt
b29rQG1vb2tzZXJ2ZS5jb20+iQE4BBMBAgAiBQJRdfRSAhsDBgsJCAcDAgYVCAIJ
CgsEFgIDAQIeAQIXgAAKCRAlhdJswXRclMbxCACRnS3kK/OSDleU+sy2vR8mQ64v
rPrTFHiegbZU0fR52MZo9KUAvSL4qde++lASGzVv9S7QK6zU1JZj5gz+U2Tr2nXI
tzP1QR7XuKW7roqL5dA5FdTYASDBEHrJEXW9AAD/YsYCqqj13G/82B2KpssgiPEL
ByzKYKnr41DqKVCk1AkSEbf+41bq06BCIX3aetaoTaGu1KLubP9VN8+YUghEqxXg
rq/92S2fjwyZFqGVncuz9khmPDAMK0IlBettDIaKthVoGLsnlipy6Y9YMyhzIt4h
ClN7N63W2/99CrvRk5XY67hN/BeoLnqOgVPFG7qE0MzpH4swRxPVHVpfOiSHuQEN
BFF19FIBCADhMEEukpWS9SNO4Fmctk2mwISSEH8z6qz9hDMCj9YjZo7maRBtWSng
zF5UkbEjFWTxayWmUOay2ODFB2VXHCH3yobuPEOE0ixXs5nO6lt2UOhhI4BzDsah
pHiBE1aPP7U7U2ZicHsx7fAWCz0isogzkH8dfXKivyMrw17YyQ4/DQE9SH7u4rFZ
byj3Trvt+n38BxesWCfioxTbN4lpTNq/y8CxOtWamBXkLAqIhyJaUkiZlLFnpii7
n/vOVz9cb5VDfl8kvNRPqRp9KqKIPd6Pti93mDYkxvKdghqaZdPNubwHQGk8tz0J
j9qirklei2fyphnByHMlxLkVQXSv84Y/ABEBAAGJAR8EGAECAAkFAlF19FICGwwA
CgkQJYXSbMF0XJSzwwf/XQdX5GnfWM86wjxXUr6dH2SaV3ukkrx+qC3XrQtM9C+l
MYV9IDBB6xAhKAdsE8Qbf+smZGySqPlcxvD2AZWUmLmXTzGnj11RI20zhHKExpTE
brMVAzprIzl7oe0aJ7jynjb9SgkS5J7FX19RIbQUBN+6KiZVIYyskF3k2RyaLxPS
wRUDJTiLf4naQm1atA/QgmuOVeVjf8kNVPm7TOu4jl0oZGfyODDN6vLaO8pfmJX9
IVJQ16eiEZDdv8pIy1W61DYZJtlT5ubSlQP9g7/vylqJNeJkb/vNH9uLAzy1bI8W
7NaVm6n5KiV453YBVTdvkPusySVCNa/wpmHsmG0dBg==
=AEEx
—–END PGP PUBLIC KEY BLOCK—–

Debian + Darkice

I need to setup Linux machines for streaming audio to an Icecast2 server from time to time and I always forget how to do it. This post will outline the install process on a machine with a minimal Debian Lenny system.

After you first boot into a fresh system, log in as root and install a couple things to make the next steps work.

$ apt-get install openssh-server sudo htop alsa g++ gcc oss-compat

You need to add your username into the sudoers file by running visudo and adding yourusername ALL=(ALL) ALL

once that’s done, find your IP address by

$ ifconfig

write down whatever eth0 says and you can get rid of your keyboard and monitor attached to the target machine.  SSH into the box with your username and download source code for lame, then compile it.

$ tar xfz lame-3.91.tar.gz
$ cd lame-3.91
$ ./configure –with-fileio=lame –without-vorbis –disable-gtktest –enable-expopt=full –prefix=/usr
$ make
$sudo make install
     

For the last step, you need to be root or have write permissions in the target directories.

You might as well use ogg vorbis too.  Go find libogg +libvorbis tarballs somewhere.

$ tar xfz libogg-1.0.tar.gz
$ cd libogg-1.0
$ ./configure –prefix=/usr
$ make
$ sudo make install
$ cd ..
$ tar xfz libvorbis-1.0.tar.gz
$ cd libvorbis-1.0
$ ./configure –prefix=/usr
$ make
$ sudo make install

You need to be root to make install.  Now, grab the darkice source code and compile.

$ ./configure –with-lame –with-vorbis –with-alsa
$ make
$ make install 

You should probably make a configuration fie in /etc as well.  A sample config file is in /usr/local/etc/

Here is my config file for your reference.

[general]

duration        = 0        # duration of encoding, in seconds. 0 means forever
bufferSecs      = 5         # size of internal slip buffer, in seconds
reconnect       = yes       # reconnect to the server(s) if disconnected

# this section describes the audio input that will be streamed

[input]

device          = /dev/dsp    # OSS DSP soundcard device for the audio input
#device = hw:0,0
sampleRate      = 44100   # sample rate in Hz. try 11025, 22050 or 44100
bitsPerSample   = 16        # bits per sample. try 16
channel         = 2         # channels. 1 = mono, 2 = stereo

[icecast2-0]
format          = mp3
bitrateMode     = vbr
bitrate         = 128
quality         = .8
server          = (your server)
mountPoint      = conway128
port            = 8000
password        = (your pass)
name            = rev.mook
description     = rev. mook
url             = mookserve.com
genre           = Mix
public          = yes

[icecast2-1]
format          = mp3
bitrateMode     = vbr
bitrate         = 320
quality         = 1
server          = (your server)
mountPoint      = 320
port            = 8000
password        = (your pass)
name            = rev. mook
description     = rev. mook
url             = mookserve.com
genre           = Mix
public          = yes

GPSCorrelate

What is it?

Digital cameras are cool. So is GPS. And, EXIF tags are really cool too.

What happens when you merge the three? You end up with a set of photos taken with a digital camera that are “stamped” with the location at which they were taken.

The EXIF standard defines a number of tags that are for use with GPS.

The program takes GPS data in GPX format. This is an XML format. I recommend using GPSBabel – it can convert from lots of formats to GPX, as well as download from several brands of popular GPS receivers.

1) The program can “interpolate” between points (linearly) to get better results. (That is, for GPS logs that are not one sample per second)

2) The resolution is down to one second. But that should be good enough for most things. (This is a limit of the EXIF tags format, as well as GPX)

3) For best results, you should synchronise your camera to the GPS time before you start taking photos. Note: digital cameras clocks drift quickly – even over a short period of time (say, a week).

Installing is easy if you are running debian unstable (sid) or Ubuntu you can just run the following command install it.

$ apt-get install gpscorrelate gpscorrelate-gui

So, here we will see if the photo’s end up on the map, and if they do, make sure they are in the correct position.

Total distance: 76.21 mi
Max elevation: 1008 ft
Total climbing: 6127 ft
Total time: 07:37:17
Download file: 20120720.gpx

Well, that didn’t work at all.  The image on the map isn’t anywhere near where I took it!