11 KiB
title | summary | date | categories | tags | draft | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
MMDVM hotspot on Archlinux | I wrote down the installation of a forked DStarGateway with a slim dashboard based on Javascript on a Raspberry Pi 2. | 2024-01-29T09:41:00+0100 |
|
|
true |
Installation ala wiki pages
I usually setup any Raspberry Pi without screen and keyboard but I make use of the serial console.
Preparations (microSD card)
Partition the microSD card.
$ sudo fdisk /dev/sda
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 411647 409600 200M c W95 FAT32 (LBA)
/dev/sda2 411648 15759359 15347712 7.3G 83 Linux
Format filesystems.
$ sudo mkfs.vfat /dev/sda1
$ sudo mkfs.ext4 /dev/sda2
I am curerntly in ~/mnt
.
$ mkdir boot root
$ sudo mount /dev/sda1 boot
$ sudo mount /dev/sda2 root
$ wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-armv7-latest.tar.gz
$ sudo bsdtar -xpf ArchLinuxARM-rpi-armv7-latest.tar.gz -C root
$ sync
$ sudo mv root/boot/* boot/
$ sudo umount boot root
So, place the microSD card in the Raspberry Pi and boot it up (with the serial console connected).
First start
There are the following two users pre-defined:
Username | Password |
---|---|
root | root |
alarm | alarm |
I prefer my username as dominic, so I changed it:
# usermod -l dominic -d /home/dominic -m alarm
# groupmod -n dominic alarm
{{< alert circle-info >}} The user alarm may come from ArchLinux ARM. {{< /alert >}}
So the first real thing is upgrading the system. We start as this:
# pacman-key --init
# pacman-key --populate archlinuxarm
# pacman -Syu
Some general system administration tasks as time setup network setup etc...
I'm using NetworkManager on the Raspi so I install it
# pacman -S networkmanager
# nmcli device wifi connect {network-ssid} --ask
Now we may login via ssh.
Installation of DStarGateway
I prefer compiling as normal user so I login as dominic. We will need some packages.
$ sudo pacman -S --needed base-devel wget boost man-db gtest
I hope I got all that we need, if you run into errors, just install the missing ones 😉
$ mkdir git && cd git
$ git clone https://github.com/F4FXL/DStarGateway.git
$ cd DStarGateway
$ make
This ran for 38 minutes -- I will not forget to add -j4
the next time :face_with_rolling_eyes:
You would now typically install the files but this is the part that made me stop for a while.
Whatever I was doing, it won't work automated. I'm not a developer, but to me this looks like as
if make -C
enters the directory before it runs the top-level Makefile so the export ...
lines
never get executed and the Makefiles in the sub-directories will never know about them. I didn't
want to dive deeper into this and decided to just install the rest by hand.
$ sudo make install
It will break, but at least install the binary files into /usr/local/bin
. Also install the
hostfiles (will need the program wget).
$ sudo make newhostfiles
Copy the systemd unit files to the right directory per hand:
$ sudo cp debian/* /usr/lib/systemd/system/
{{< alert >}} Inspect them because you may edit some paths. {{< /alert >}}
Also have a look at the configuration files in /usr/local/etc/
.
Enable the services, but I don't start them yet (except for a short test) because the hotspot will connect to the DSTAR reflector but we can't talk or hear anything. Once they are enabled, they will autostart at the next reboot.
To enable the services:
$ sudo systemctl enable dstargateway.service
$ sudo systemctl enable dgwtimeserver.service
Because the make install
did not finish before, I have to manually install the
Data
folder contents (AMBE files, Hostfiles). I could not get this to work the
way it was described in the repository, but I installed them this way:
Move to the Data
directory and add the following line on top of the file:
export DATA_DIR=/usr/local/share/dstargateway.d/
Then rund sudo make install
within the Data
directory again and all should be fine.
Installation of MMDVMHost
Also this requires special packages, although I think those are for the new FM features -- that a hotspot won't use at all...
$ sudo pacman -S libsamplerate
$ git clone git@github.com:g4klx/MMDVMHost.git
$ cd MMDVMHost
$ make -j4
$ sudo make install-service
That would fail, but we can do it by hand.
Setup the user mmdvm:
$ sudo useradd --user-group -M --system mmdvm --shell /bin/false
$ sudo usermod --groups uucp --append mmdvm
So we run the command one more time:
$ sudo make install-service
Binaries are installed and the systemd unit files too.
Modify the configuration file /etc/MMDVM.ini
.
Enable the service:
$ sudo systemctl daemon-reload
$ sudo systemctl enable mmdvmhost.service
Setup the UART
We can't start MMDVMHost right away (well, we can, but it will not work yet).
We need to disable the serial console because we need the UART at the GPIO pins for our modem hardware.
Disable the service, that accesses the serial console:
$ sudo systemctl disable serial-getty@ttyAMA0.service
Open /boot/cmdline.txt
and remove console=serial0,115200
from the line. Save
and reboot.
Configuration
DStarGateway
MMDVMHost
dgwtimeserver
Install a dashboard
I will install the dashboard from John Hays (K7VE) as my first look at it looked promising (using Javascript (which is executed on the client and not the server) may reduce the load on the webserver). [Past installations of dashboards]({{< ref "/posts/2022/26-raspberry-pi-4-64bit-dual-hat-hotspot-without-pi-star" >}}) did usually include a form of request limitation because the many websocket requests of other dashboards put too much pressure on the small Raspberry Pies 🤯
I will not install this as per instructions, because I don't like when these kind of applications (simple dashboards for example) have to be run as the root user. I will therefore create a new user called dashboard as which the "webserver" (which is a NodeJS application) will run.
We need a few packages for this:
$ sudo pacman -S nodejs npm
Create and impersonate our new user:
$ sudo useradd --user-group -m --system dashboard --shell /bin/bash
$ sudo su - dashboard
Now we are the user dashboard and we will install the dashboard:
$ git@github.com:johnhays/dsgwdashboard.git
$ cd dsgwdashboard
$ node -v
$ npm install -save
Create and install some self-signed certificates into the dsgwdashboard
directory because the server needs them to start. I personally would like
to have the possibility to only serve the pages via plain old HTTP
(without SSL/TLS) because I run most of my pages through a reverse-proxy
that takes care of all the certification.
If you don't need to use HTTPS you may find this patch interesting:
diff --git a/index.js b/index.js
index 0c71092..502933e 100644
--- a/index.js
+++ b/index.js
@@ -1,4 +1,4 @@
-const https = require("https");
+const http = require("http");
const fs = require("fs");
const ini = require("ini");
const lineReader = require('line-reader');
@@ -32,12 +32,8 @@ updatelinks();
let serverPort = inifile.config.port;
-const server = https
+const server = http
.createServer(
- {
- key: fs.readFileSync("key.pem"),
- cert: fs.readFileSync("cert.pem"),
- },
app
)
.listen(serverPort, ()=>{
Next we will modify the dashboard.ini
file because we will change the
port from 443 to 8443. Why? Because1!
[config]
dgwconfig=/usr/local/etc/dstargateway.cfg
host=hotspot.oe7drt.net
port=8443
{{< alert circle-info >}} This might be confusing now, the host above does not listen to port 8443 because there is a reverse-proxy in-between (and actually a firewall/router too). {{< /alert >}}
This configuration is now as slim as I could make, removing encryption on the dashboard made it even better in terms of performance and maintainability as we don't have to worry about our certificates on this host and no direct port-forwarding to this host has been made -- but our dashboard can still be accesses from the internet in encrypted form.
The actual path of this host and how it will be routed:
{{< mermaid >}}
%%{init: {"flowchart": {"htmlLabels": false}} }%%
graph LR;
A([Internet user]):::usr -- "**HTTPS**
" -->B["router/firewall _hotspot.oe7drt.net_
"]:::fw;
B-- "**HTTPS**
" -->C["reverse-proxy _proxy.lan_
"]:::rev;
C-- "**HTTP**
" -->D["hotspot dashboard _hotspot.lan_
"]:::dash;
classDef usr stroke:#faa
classDef fw stroke:#f55
classDef rev stroke:#9f9
classDef dash stroke:#0f0
{{< /mermaid >}}
We will disable the shell for the dashboard user because we normally won't have to login as dashboard user again.
$ sudo chsh -s /bin/false dashboard
DSTAR Registration
A DSTAR registration is mandatory if you want to be transmitted on original ICOM repeaters. Otherwise your transmission will not be forwarded properly and you may look for errors for a long time...
I registered in 2020 at https://regist.dstargateway.org/ but there is one important thing to add to the webui there: do not choose long passwords (like those from a password manager) because it will get cut off somewhere and it took me quite a while to find that error.
{{< alert skull-crossbones >}} I can't believe that there are still websites in 2024 that limit the lenght of a password! {{< /alert >}}
I do have 12 characters now, I usually use 20 or more.
-
Ports below 1024 can only be used as the root user. Those are socalled privileged ports. To run the program as non-root user we need to set the port to something above 1024. ↩︎