Installing PAT Winlink client on MacOS

Quick notes:

  • download the .pkg from https://github.com/la5nta/pat/releases and run it
  • run ‘pat configure’ set your callsign, password and gridsquare
  • run ‘pat http’
  • open localhost:8080 in your browser

At this point you can connect using the telnet option to send and receive over the internet.

Will look at using Direwolf for access via radio later.

Building and running a Packet Radio Winlink solution in a Docker container, on a Raspberry Pi

Running Packet Radio apps in a Docker container, on a Raspberry Pi? Are you mad I hear you ask?Isn’t it hard enough to get ax25 and Packet Radio up and running on the Pi anyway? Having done this a few times already, this was my thinking, and I had the crazy idea that encapsulating most of the config and setup in Dockerfiles to build preconfigured containers might be an idea worth exploring.

Installing and configuring ax25 for the Raspberry Pi and Winlink clients that use ax25 like paclink-unix or PAT can be done and work well, but the steps, as for example documented in this comprehensive guide for building and installing paclink-unix which span several pages of instructions – this can be daunting even for those more familiar with building and installing apps from source on Linux.

Since the steps are well documented, I wondered if they could be captured in a Dockerfile to automate building a self-contained and ready to run Docker container.

tldr; The short story

I did eventually did get this working building ax25 from source and using Pat, but it took me down a rabbit hole for several hours. Skip to the end if you just want to find out how to build and run the completed Docker containers.

The Longer Explanation

I could not get ax25 to work self-contained in it’s own Docker container, as I ran into issues either accessing my serial device connected to my TNC Pi from inside the Container, and/or creating an ax0 interface when running kissattach.

If you expose the serial port on the Raspberry Pi to the Container running paclink-unix:

docker run -it --device=/dev/ttyAMA0 rpi-paclink

… When trying kissattach in the container it gives:

kissattach: Error setting line discipline: TIOCSETD: Operation not permitted

Are you sure you have enabled MKISS support in the kernel

or, if you made it a module, that the module is loaded?

Alternatively, starting with –privileged:

docker run -it --privileged  -v /dev/ttyAMA0:/dev/ttyAMA0  rpi-paclink

gives:

sudo kissattach /dev/ttyAMA0 1

kissattach: SIOCSIFMTU: No such device

I was initially trying to get this working because I wanted to run paclink-unix for Winlink email. Part of this app when you run the make script it will create wl2kserial and wl2ktelnet, but not wl2kax25. I had already run into this before, as it seems it doesn’t compile unless it has a later version of the ax25 stack compiled from source.

I changed gears and looked for how you could share an up and running ax25 stack from the Docker host, and it turns out this is easy to do, you just pass the –network=host param, and then ax0 appears in your network interfaces in your container.

The next issue I ran into is that configuring postfix as your email transport take some effort. bazaudi.com have a very detailed set of instructions, but I couldn’t get it working for outgoing email. It was working for incoming via wl2ktelnet and wl2kax25, but only for receiving emails and not sending. Time to try something else.

Installing and configuring Pat in a Container

I tried to get Pat working once before – I think I had it working on either a Debian or Ubuntu box, but couldn’t get it working on Raspbian on a Pi. I decided to try it again in this setup, and reusing the base image with ax25 already compiled from source, it was actually very easy to get Pat up and running.

This is dependent on having ax25 installed and configure on the host Pi OS, and the shared to the container with –network=host. I know, this seems redundant, but this is the only way I managed to get this working.

My base image for Raspbian including ax25 built form source is here: https://github.com/kevinhooke/DockerRPiAX25FromSource 

To build the image passing in the parameterized value for your callsign (passing your callsign in place of ‘yourcall’):

docker build --build-param MYCALL=yourcall -t rpi-ax25 .

Next build an image containing Pat, based on the image we just built – the source for this Dockerfile is here: https://github.com/kevinhooke/DockerRPiPATWinlink.git

Build this image with:

docker build --build-arg MYCALL=yourcall --build-arg MYCALLSSID=yourcall-1 
    --build-arg MYLOC=AA11aa --build-arg WINLINKPASS=yourwlpass 
    -t rpi-wl-pat .

Now to start it up remember we’re relying on an ax25 connection from the host, and we’re going to share it with the guest container. My TNC-Pi board connected to my Raspberry Pi is available on serial device as /dev/ttyAMA0, so I start up my ax0 port like:

sudo kissattach /dev/ttyAMA0 1 10.1.1.1

Next, run the container as a daemon, share the host networking, and expose port 8080 so we can access the Pat webapp:

docker run -d –network=host -p 8080:8080 rpi-wl-pat

Now let’s fire up the webapp:

Looks good, this is the Pat inbox. Let’s send a test email to myself – this is going to be sent using Packet over 2m VHF via my local Winlink gateway, AG6QO-10. I have this preconfigured in my Pat config file. You can configure this yourself before creating the rpi-wl-pat image:

Remember the Pat webapp that we’re interacting with here is running in a Docker container, on a Raspberry Pi. I just happen to be accessing it remotely from my Mac. For mobile operation or out in the field, you could attach a touchscreen to the Pi and connect a keyboard and mouse too.

To send my email over RF to the Winlink gateway, click Action, then Connect:

In the Pat status window we now see a log of the Packet exchange between my station and AG6QO-10 via BERR37:

A few seconds later the email arrives in my gmail inbox:

If I reply to the email in gmail, it will go back over the Winlink network, and be waiting for me when I connect to the Winlink gateway again over RF. Let’s give that a go in Pat – select Action and Connect, we connect to AG6QO0-10 again over 2m VHF, and now the reply is in my inbox in Pat:

Success!

Winlink amateur radio email via paclink-unix on the Raspberry Pi

This is my second attempt to get a Winlink client (see here for a high level overview of Winlink) working on the Raspberry Pi. I first tried Pat /wl2k-go but it crashed (I created a ticket on github to followup), so for my second attempt I took a look at paclink-unix.

This site has a very detailed step by step install and config steps – follow exactly and pay attention to any errors 🙂 : http://bazaudi.com/plu/doku.php?id=plu:install_plu

A few additional notes:

  • wl2kax25 did not compile for me with the ax25 version that I previously had installed, possibly from apt-get from the default repos. Once I noticed this was missing I went back to the steps in the doc above and downloaded the ax25 packages from source, compiled, installed, rebuilt paclink and now I had the wl2kax25 app
  • Editing the /usr/local/etc/wl2k.conf file: the email= value is your local user email address on your local device, in this case on the Pi (e.g. for me, pi@localhost). This is used when wl2ktelnet/wl2kax25 retrieves incoming messages and it sends them to this user. If you see the wl2k app downloading messages but they’re not showing up in your inbox, check this.
  • Checking /var/log/mail.log is very useful to see what’s happening to your outbound and inbound messages!

The usage sequence is:

  • send outbound message with mail client, e.g. alpine
  • run wl2ktelnet to send over an internet connection if you have one
  • or, run wl2kax25 to send over your configured ax25 stack

The setup I got working is:

  • Raspberry Pi, with alpine (regular email client), direwolf (packet soundcard modem) and ax25 (to link paclink to direwolf)
  • Rigblaster Advantage USB soundcard, connected to an Icom 880

To send over vhf to my nearest Winlink gateway, I used:

  • wl2kax25 -a 1 -c KG6SJT-10 via KBERR

Where

-a 1 is port 1 defined in my /etc/ax25/axports

-c is the call of the Winlink gateway I’m connecting to, and I’m connecting via a packet digipeater, KBERR.

Raspberry Pi Winlink client over 2m VHF using Pat/wlk2-go + Direwolf + ax25 (not working yet)

Some rough notes on getting this combination working. This is my first attempt in getting the Pat / wlk2-go Winlink client working on a Raspberry Pi. I’m using:

  • Direwolf as a packet soundcard modem
  • ax25 as the connection between the Pat Winlink client and Direwolf
  • a Rigblaster Advantage, as a USB soundcard interface between the Raspberry Pi and a 2m transceiver (an Icom ID-880H)

I already have Direwolf and ax25 networking configured from using my Pi as a Packet radio client (search for my previous blog posts on Direwolf and you’ll find my notes for installing and configuring). Following the instructions in the Pat wiki here, I added a new ax25 interface as a new line to the end of my /etc/ax25/axports files:

wl2k KK6DCT 0 255 7 2m winlink

The wl2k alias for the new port I think is the default that Pat looks for to connect.

Note: I already have Direwolf configured with a 1200 port for VHF packet so I reused this as my first test, but if you configure a 300 port for HF and then connect the Rigblaster to an HF radio, I think the setup will be much the same (I haven’t tried this yet, but this will be my next test).

Next I installed golang on the pi with:

sudo apt-get install golang

and then installed Pat with:

go get github.com/la5nta/pat

go get failed initially with $GOPATH not set. So I created go-workspace in my home dir, and then did

export GOPATH="$HOME/goworkspace"

and added this export to my .bashrc so it will be set next time I log on too.

Now the go get started downloading to goworkspace, but it seemed to hang before it completed. Alternatively, you can download a prebuild .deb file from the Pat github releases page and install with (I used this approach instead):

sudo dpkg -i pat_0.1.5_linux_armhf.deb

pat configure – opens an editor for the config file. I added my callsign in mycall, my winlink password.

To add an alias in the configuration for a connection via ax25, I added a connection to KG6SJT-10, which is my closes Winlink gateway on 2m:

“connect_aliases”: {
“KG6SJT-10”: “ax25:///KG6SJT-10”,
“telnet”: “telnet://{mycall}:CMSTelnet@server.winlink.org:8772/wl2k”
}

pat http – starts the web interface

From the web gui at localhost:8080 you can select the Connect menu item, select the alias added in the config above, but this blew up Pat when I tried it. Time to log a ticket:

2016/09/07 00:20:53 Connecting to KG6SJT-10 (ax25)…
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x0 pc=0x76f3d774]

runtime stack:
runtime.throw(0x5d0948, 0x2a)
/opt/go/src/runtime/panic.go:547 +0x78
runtime.sigpanic()
/opt/go/src/runtime/sigpanic_unix.go:12 +0x44

goroutine 53 [syscall, locked to thread]:
runtime.cgocall(0x457ff0, 0x10c6b7e4, 0x0)
/opt/go/src/runtime/cgocall.go:123 +0x11c fp=0x10c6b7c4 sp=0x10c6b7ac
github.com/la5nta/pat/vendor/github.com/la5nta/wl2k-go/transport/ax25._Cfunc_ax25_aton_entry(0x0, 0x10ed00b0, 0x0)
??:0 +0x38 fp=0x10c6b7e0 sp=0x10c6b7c4
github.com/la5nta/pat/vendor/github.com/la5nta/wl2k-go/transport/ax25.(*ax25Addr).setPort(0x10ed00a0, 0x10b5a250, 0x4, 0x0, 0x0)
/home/martinhpedersen/go/src/github.com/la5nta/pat/vendor/github.com/la5nta/wl2k-go/transport/ax25/ax25_linux.go:361 +0x64 fp=0x10c6b7f0 sp=0x10c6b7e0
github.com/la5nta/pat/vendor/github.com/la5nta/wl2k-go/transport/ax25.DialAX25Timeout(0x10b5a250, 0x4, 0x10b5a158, 0x6, 0x10d107cd, 0x9, 0x7a358200, 0xa, 0xcb8e4, 0x0, …)
/home/martinhpedersen/go/src/github.com/la5nta/pat/vendor/github.com/la5nta/wl2k-go/transport/ax25/ax25_linux.go:136 +0x16c fp=0x10c6b984 sp=0x10c6b7f0
github.com/la5nta/pat/vendor/github.com/la5nta/wl2k-go/transport/ax25.Dialer.DialURL(0x7a358200, 0xa, 0x10d108d0, 0x0, 0x0, 0x0, 0x0)
/home/martinhpedersen/go/src/github.com/la5nta/pat/vendor/github.com/la5nta/wl2k-go/transport/ax25/ax25.go:114 +0x278 fp=0x10c6ba8c sp=0x10c6b984
github.com/la5nta/pat/vendor/github.com/la5nta/wl2k-go/transport/ax25.(*Dialer).DialURL(0x7c39f8, 0x10d108d0, 0x0, 0x0, 0x0, 0x0)
<autogenerated>:1 +0xb8 fp=0x10c6baac sp=0x10c6ba8c
github.com/la5nta/pat/vendor/github.com/la5nta/wl2k-go/transport.DialURL(0x10d108d0, 0x0, 0x0, 0x0, 0x0)
/home/martinhpedersen/go/src/github.com/la5nta/pat/vendor/github.com/la5nta/wl2k-go/transport/dial.go:29 +0xbc fp=0x10c6bad4 sp=0x10c6baac
main.Connect(0x10d107c5, 0x11, 0x0)
/home/martinhpedersen/go/src/github.com/la5nta/pat/connect.go:108 +0x7b4 fp=0x10c6bc5c sp=0x10c6bad4
main.ConnectHandler(0x76457918, 0x10c1b200, 0x10bf8230)
/home/martinhpedersen/go/src/github.com/la5nta/pat/http.go:357 +0x68 fp=0x10c6bca8 sp=0x10c6bc5c
net/http.HandlerFunc.ServeHTTP(0x6208b4, 0x76457918, 0x10c1b200, 0x10bf8230)
/opt/go/src/net/http/server.go:1618 +0x34 fp=0x10c6bcb8 sp=0x10c6bca8
github.com/la5nta/pat/vendor/github.com/gorilla/mux.(*Router).ServeHTTP(0x10a114a0, 0x76457918, 0x10c1b200, 0x10bf8230)
/home/martinhpedersen/go/src/github.com/la5nta/pat/vendor/github.com/gorilla/mux/mux.go:107 +0x250 fp=0x10c6bd44 sp=0x10c6bcb8
net/http.(*ServeMux).ServeHTTP(0x10a0ea80, 0x76457918, 0x10c1b200, 0x10bf8230)
/opt/go/src/net/http/server.go:1910 +0x164 fp=0x10c6bd70 sp=0x10c6bd44
net/http.serverHandler.ServeHTTP(0x10a75680, 0x76457918, 0x10c1b200, 0x10bf8230)
/opt/go/src/net/http/server.go:2081 +0x190 fp=0x10c6bda0 sp=0x10c6bd70
net/http.(*conn).serve(0x10b841c0)
/opt/go/src/net/http/server.go:1472 +0xee4 fp=0x10c6bfcc sp=0x10c6bda0
runtime.goexit()
/opt/go/src/runtime/asm_arm.s:990 +0x4 fp=0x10c6bfcc sp=0x10c6bfcc
created by net/http.(*Server).Serve
/opt/go/src/net/http/server.go:2137 +0x3bc