--- title: MMDVM hotspot on Archlinux summary: On a Raspberry Pi 2 date: 2024-01-28T10:10:11+0000 lastmod: 2024-01-28T10:12:11+0000 categories: - amateur-radio tags: - archlinux - dstar - hotspot - linux - mmdvm - raspberry-pi # showBreadcrumbs: true # showDate: false # showReadingTime: false # showWordCount: false # showPagination: false # feed_exclude: true # site_exclude: true # some help # # highlighting with highlights # # use table, as inline creates a padding around # and it pushes the text more to the right side (end of screen) # # ~~~html {linenos=table,hl_lines="3-6"} # ~~~html {linenos=inline,hl_lines="1,3-6"} draft: true --- ## Installation ala wiki pages I usually setup any Raspberry Pi without screen and keyboard but I make use of the [serial console](https://www.raspberrypi.com/documentation/computers/configuration.html#configuring-uarts). ![Raspi 2 with wires connected to GPIO Pins GND, RXD and TXD](setup_console.jpg "I haven't changed a thing of the initial configuration") ### Preparations (microSD card) Partition the microSD card. ~~~console $ 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. ~~~console $ sudo mkfs.vfat /dev/sda1 $ sudo mkfs.ext4 /dev/sda2 ~~~ I am curerntly in `~/mnt`. ~~~console $ 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: ~~~console # usermod -l dominic -d /home/dominic -m alarm # groupmod -n dominic alarm ~~~ {{< alert circle-info >}} The user _alarm_ may come from **A**rch**L**inux **ARM**. {{< /alert >}} So the first real thing is upgrading the system. We start as this: ~~~console # 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 ~~~console # 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. ~~~console $ 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 :wink: ~~~console $ 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. ~~~console $ 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_). ~~~console $ sudo make newhostfiles ~~~ Copy the systemd unit files to the right directory per hand: ~~~console $ 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: ~~~console $ 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: ~~~make 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... ~~~console $ sudo pacman -S libsamplerate ~~~ ~~~console $ 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_: ~~~console $ sudo useradd --user-group -M --system mmdvm --shell /bin/false $ sudo usermod --groups uucp --append mmdvm ~~~ So we run the command one more time: ~~~console $ sudo make install-service ~~~ Binaries are installed and the systemd unit files too. Modify the configuration file `/etc/MMDVM.ini`. Enable the service: ~~~console $ 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: ~~~console $ sudo systemctl disable serial-getty@ttyAMA0.service ~~~ Open `/boot/cmdline.txt` and remove `console=serial0,115200` from the line. Save and reboot. Another problem occurs, I will probably have to flash an actual firmware to the modem. ~~~console E: Received a NAK to the SET_CONFIG command from the modem I: MMDVMHost-20240126 exited on receipt of an unknown signal ~~~ But we need another compiler. I install [paru](https://github.com/morganamilo/paru) to get that compiler with its dependencies. The installation of paru is very easy: ~~~console $ sudo pacman -S --needed base-devel $ git clone https://aur.archlinux.org/paru.git $ cd paru $ makepkg -si ~~~ ~~~console $ paru -Syu $ paru -S arm-linux-gnueabihf-gcc ~~~ Oh hell, this is going to take ages on the Raspberry Pi 2... ## 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 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.