Virtual Machines on RaspberryPi 5

RaspberryPi computers are now moving into the realm of being powerful enough to replace the traditional desktop PC. My most recent purchase, a RaspberryPi 500+ is proof of this as it has been my daily desktop PC since it’s arrival.

One of the things I use heavily are virtual machines. They’re great for developing, prototyping and running new services. With the ability to snapshot, rollback and backup in an instant, virtualisation helps to reduce the development and test time for many of the programs and services that I’m playing with.

With RaspberryPi computers now supporting 16GB of RAM and M.2 SSD drives there is no reason for not taking advantage of virtualisation.

To this end I decided to test running some virtualised loads on my new 500+ with the plan to deploy to 16GB Pi5’s with SSD drives in place of more expensive Intel based computers.

On my Intel based machines I use QEMU, KVM and Virt-Manager to manage the multitude of virtual machines (VMs) I have running here. Since this is a solid, high performance platform for running VMs I decided to take the same route on the 500+

Installing the necessary packages is extremely simple, just one simple apt command:

sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients virt-manager bridge-utils

Note: If you’re using Debian 13 (Trixie) then the apt command to use is:

sudo apt install qemu-system-arm libvirt-daemon-system libvirt-clients virt-manager bridge-utils

The qemu-kvm package doesn’t exist in Debian 13 and so you have to replace it with the qemu-system-arm package.

To be able to create and run VMs you need to add yourself to the libvirt and libvirt-qemu groups.

sudo usermod -a -G libvirt your_username
sudo usermod -a -G libvirt-qemu your_username

Of course you can do it the old-fashioned way by editing the /etc/group file and adding your username to each group.

You’ll need to create a bridged ethernet device for the VMs to use to access the ethernet interface on your RaspberryPi.

If like me you don’t use NetworkManager the easiest way to create a bridge is to define it in your /etc/network/interfaces file.

For this example I am using an IP Address of 192.168.0.100, gateway on 192.168.0.1 with a netmask of 255.255.255.0 and DNS nameserver on 192.168.0.5.

The normal entry in the interfaces file would look like this:

# Main ethernet
auto eth0
iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 192.168.0.5
dns-domain lan.local
dns-search lan.local
#
#

To create a bridge this entry needs to change to:

# Main ethernet
# Setup Bridge called br1 on eth0
allow-hotplug eth0
iface eth0 inet manual
auto br1
iface br1 inet static
address 192.168.0.100
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 192.168.0.5
bridge_ports eth0
bridge_stp off
#
#

Once this is done reboot your RaspberryPi and check you have access to your local LAN and of course the internet. You will now also inherit the two new groups that you added yourself to above.

Note: If you are using NetworkManager open the network settings app and create a bridge on eth0. You can also use the nmtui copmmandline app if you prefer.

At this point you’re ready to create your first virtual machine.

It’s important to have an arm64 version of Linux in ISO format that you can use to install into your VM. My preferred distro is Debian and so I downloaded the Debian 13 Arm64 netinst ISO from the debian.org website.

From the main menu start “Virtual machine Manager” or on the commandline type:

virt-manager
QEMU Virtual Machine Manager
QEMU Virtual Machine Manager

Click the Create new VM button and then navigate to where you saved your ISO file and select it as the installation media.

Virtual Machine Manager - Local install media
Virtual Machine Manager – Local install media
Virtual Machine Manager - Select ISO file
Virtual Machine Manager – Select ISO file

Once you’ve chosen your ISO you’ll need to configure the actual VM. Start by setting the amount of RAM and number of virtual CPUs you want the VM to have.

Virtual Machine Manager - Configure RAM and CPU
Virtual Machine Manager – Configure RAM and CPU

Next set the size of the virtual disk that the VM will use.

Virtual Machine Manager - Create virtual disk
Virtual Machine Manager – Create virtual disk

Finally, give the VM a name and set its network device to br0 as created above. Click finish and your VM will boot.

Virtual Machine Manager - Name VM and select bridge interface
Virtual Machine Manager – Name VM and select bridge interface

Now it’s just a case of going through the standard Debian install process to build your Debian VM.

Virtual Machine Manager - Boot ISO
Virtual Machine Manager – Boot ISO
Virtual machine Manager - Running standard Debian install
Virtual machine Manager – Running standard Debian install

Once the installation is complete and the VM has rebooted you will have a functional Debian computer ready to use for whatever you like, just like a physical PC but, in virtual form. You’ll find that the VM runs as fast as the actual physical machine thanks to the kernel based virtualisation.

Virtual Machine Manager - Running VM
Virtual Machine Manager – Running VM

For more information on Virtual Machine Manager take a look at the Ubuntu Server documentation.

More soon …

RaspberryPi OS 13 Networking tidy up & broken lm-sensors

Since RaspberryPi are now forcing users of its SBC to use RaspberryPi OS 13 (via the RaspberryPi Imager tool) instead of the reliably stable Debian 11 or 12 several issues have come to light.

Firstly if like me you run most of the your Pi4/5 SBCs headless/lights out you’ll notice that networking is now ridiculously managed via Network Manager and Netplan.

This is a ridiculous method of managing such a simple device, it’s over complicated, messy and ill thought out. Yet another classic example of change for the sake of change and not to actually improve things.

This combination of Network Manager (often referred to as Network Mangler for good reason) and Netplan is fraught with bugs. Try setting a second IP address on an interface and you’ll find it doesn’t work. nmtui will show the ip address as being configured however, netplan never actually puts the config into play.

Having to use nmtui on the command line to manage ethernet interfaces is also ridiculous. Its badly laid out menu system takes an age to get through to do the simplest of config changes. What’s wrong with just editing the /etc/network/interfaces file?

After much frustration trying to configure the ethernet interface on my headless Pi5 I decided to get rid of this hideous method of managing ethernet interfaces and put it back to using the simple interfaces file.

I’ve documented the steps just in case anyone else wants to do the same.

Step 1: Make sure the traditional networking stack is installed:

sudo apt install ifupdown

Step 2 – Disable NetworkManager:

sudo systemctl stop NetworkManager.service
sudo systemctl disable NetworkManager.service
sudo systemctl mask NetworkManager.service

(Optional but tidy: )

sudo apt purge network-manager

Step 3 – Disable Netplan

sudo apt purge netplan.io
sudo rm -f /etc/netplan/*.yaml

Also ensure /lib/systemd/systemd-networkd is disabled, since Netplan can trigger it:

sudo systemctl disable systemd-networkd
sudo systemctl mask systemd-networkd

Step 4 – Create your /etc/network/interfaces file

# Example /etc/network/interfaces for Ethernet (eth0) with static IP:
#
# Loopback
auto lo
iface lo inet loopback

# Ethernet
auto eth0
iface eth0 inet static
    address 192.168.1.10
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameservers 1.1.1.1 8.8.8.8

Example for DHCP:

auto eth0
iface eth0 inet dhcp

If you use Wi-Fi:

auto wlan0
iface wlan0 inet dhcp
    wpa-ssid "YourSSID"
    wpa-psk "YourPassword"

Step 5 – Enable the traditional networking service

sudo systemctl enable networking.service
sudo systemctl restart networking.service

Then confirm:

ip a

You should see your interfaces up with the expected IP addresses, managed by ifupdown.

Step 6 – (Optionally) Clean residual files

Remove leftover NetworkManager/Netplan configs to avoid confusion:

sudo rm -rf /etc/NetworkManager
sudo rm -rf /etc/netplan

Verification

Check which subsystem is active:

systemctl is-active NetworkManager
systemctl is-active networking

Expected output:

inactive
active

The /etc/network/interfaces method works perfectly on Pi 5 and is lighter weight and ideal for embedded or headless servers.

If you later reinstall NetworkManager, it will override interfaces again unless you mark them as unmanaged in /etc/NetworkManager/NetworkManager.conf.

You can still use ifup / ifdown commands manually for control.

You now have your Pi running the classic, lightweight networking stack which is ideal if you use your Pi as a 24/7 server like I do.

Note: This method is still supported on RaspberryPi Debian 13 but, it’s no longer the default.

As a final note, if you want to add a second IP Address to your Ethernet interface it’s extremely simple to define in the /etc/network/interfaces file. I’ve created an example of how to do this below for reference.

# Loopback
auto lo
iface lo inet loopback

#
# Primary interface - static IP
#
auto eth0
iface eth0 inet static
    address 192.168.1.10
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameservers 1.1.1.1 8.8.8.8

#
# Secondary IP on same interface
#
auto eth0:1
iface eth0:1 inet static
    address 192.168.1.11
    netmask 255.255.255.0

Check both IP Addresses appear on the same interface:

ip a show eth0

For the example above you’ll see:

inet 192.168.1.10/24
inet 192.168.1.11/24

Finally, if like me you use lm-sensors to keep check on how hot your Pi is running you’ll find that the sensors command no longer works, it just throws a segmentation fault. This is a nuisance as I use this as part of my Node-Red Monitoring Dashboard.

A partial work around is to use the vcgencmd command as it can return the temperature of the system on a chip (SOC) device.

vcgencmd measure_temp

You can create an alias for this command in your ~/.profile file, I’ve named the alias ‘cputemp’ in this example:

alias cputemp="vcgencmd measure_temp"

Once you’ve saved your .profile file logout and back in again and you’ll now have a new command to use to get the CPU temp.

More soon …

Venturing into the world of AllStarLink

Please note: This build is now deprecated and will no longer work. Please use the new AllStarLink 3 build process as documented on the AllStarLink website.

We’ve recently added a new room to the Matrix HAM Radio Space for Digital Voice modes as this was an area of interest that didn’t really fit into any of the other rooms.

The new Digital Voice room has attracted a lot of attention from members, with a lot of the focus being on the AllStarLink system. Michael, DK1MI built an AllStarLink node in the cloud for us all to use for Matrix Nets and so I decided I had to get in on the fun.

The Jumbospot SHARI SA818 Amateur Radio AllStarLink Radio Interface was originally designed by N8AR and implements a RaspberryPi 2/3/4 hosted AllStarLink node using a NiceRF SA818 embedded VHF/UHF radio module and sound card.

The two USB connectors on the SHARI device are position such that they plug into two of the available 4 USB ports on the RaspberryPi without the need for cables. This keeps the whole solution together in one neat package.

Before you start you will need to obtain a node number and secret (password) from the AllStarLink Portal. To get this you will need to provide proof to the AllStarLink administrators that you are a licensed Amateur Radio (HAM) operator. This is done by uploading a copy of the first page of your HAM licence to the website for the admin team to check. This can take 24hrs to be completed so make sure you get this all done before trying to build your node. You cannot build a node successfully without a node number and secret.

Of course you will also need a transceiver that can operate on the 438.800Mhz frequency or other frequency of your choice on the 2m or 70cm HAM band.

You will also need to open port 4569 on your internet router and setup port forwarding to the IP Address that you will be using on your RaspberryPi node. It’s important to use a static IP Address on your RaspberryPi.

There are quite a few different Linux based operating system (O/S) images that are available for the RaspberryPi devices that have been specifically tailored for the AllStarLink node and include all the necessary software and library packages out the box.

I decided to use the Raspbian GNU/Linux 10 (buster) based distribution as it is based on the very stable and reliable Debian Linux distro. You can download the exact version I am using from the Raspbian link above or directly from my website here.

Once downloaded you need to burn the ISO image onto a suitable SD card for your RaspberryPi. I use BalenaEtcher as it’s extremely quick and reliable at burning ISO images to SD cards.

Of course if you are a hardline Linux command line junkie you can always use dd to create the SD card.

Once you’ve got your O/S onto your SD card, slot it into your RaspberryPi making sure your SHARI device is connected to the two USB ports and then power it up. Make sure you have a good PSU for the RaspberryPi as the two devices together draw around 3A of current during the transmit cycle. (I use a 3.6A PSU from Amazon).

The default login for the Raspbian O/S is shown below. Login via SSH and configure your RaspberryPi for your local network. It’s important to use a static IP Address configured either directly on the RaspberryPi or via DHCP in your router.

Login: repeater
Passsword: allstarlink
SSH port: 22

Once you have your RaspberryPi connected to your LAN you are ready to start configuring it for AllStarLink.

The first thing you need to do is login to the raspi via SSH and then become root user using sudo as shown below:

sudo su -

Once you are root user, you need to add the AllStarLink repo to the sources file and update the operating system using the following command:

curl -s http://apt.allstarlink.org/repos/repo_signing.key | apt-key add
apt update --allow-releaseinfo-change
apt dist-upgrade

Copy and paste each line one at a time into your terminal. Once the last command finishes, the system is up to date and can be rebooted as follows:

reboot

Once the raspi has rebooted, login again via SSH as user repeater and then become root user again.

You now need to install a couple of Python components that are required by the system to function. Use the commands below as user root:

apt-get install python3-dev python3-pip
pip3 install pyserial

Next you need to change directory into the asterisk config file directory using the command shown below:

cd /etc/asterisk

In this directory you will find all the default config files that come as part of the distro. For this build we’re not going to use them and so we need to move them out of the way ready for a set of config files that have already been configured correctly.

Using the following commands create a new directory, move into that new directory and then move all the unwanted configuration files into it:

mkdir ORIGINAL-CONF-FILES
cd ./ORIGINAL-CONF-FILES
mv ../*.conf ./
ls -la
cd ../

You should now be back in the /etc/asterisk directory which will now be empty apart from the custom directory which we left in place.

You now need to copy the correctly configured configuration files into the /etc/asterisk directory. Start by downloading the zip file containing the new configuration files

Download removed as deprecated.

Once downloaded, copy the .zip file into the repeater users home directory (/home/repeater) using either scp on the Linux command line or if using Windows you can use the FileZilla Client in SFTP mode using the login details above.

Once you have the .zip file in the repeater user’s home directory you need to copy the file into the /etc/asterisk directory as user root:

cp /home/repeater/AllStarLink-Config-v3.zip /etc/asterisk/

Next as user root, change directory into the /etc/asterisk directory and unzip the .zip file:

cd /etc/asterisk
unzip ./AllStarLink-Config-v3.zip

Once the file is unzipped you will have a directory called AllStarLink-Config in the /etc/asterisk directory. You now need to cd into the directory, copy all the files out of it into the /etc/asterisk directory leaving a copy in the AllStarLink-Config directory for future reference:

cd /etc/asterisk/AllStarLink-Config
cp ./* /etc/asterisk
cd /etc/asterisk

You now need to move a couple of files into the repeater users home directory using the following commands:

mv ./SA818-running.py /home/repeater
mv ./gpio /home/repeater

Once the files have been moved you need to set the correct ownership and privileges on the files using the following commands:

chown -R root:root /etc/asterisk/*.conf
chown repeater:repeater /home/repeater/gpio
chown repeater:repeater /home/repeater/SA818-running.py
chmod 755 /home/repeater/gpio
chmod 755 /home/repeater/SA818-running.py

The gpio BASH script and configuration details were supplied by Mark, G1INU in the Digital Voice room on the Matrix. It adds the COS light functionality to the setup. The COS light will now light every time the SA818 hears RF on the input.

The next thing you need to do is configure the SA818 radio device in the SHARI. The script I used was originally from https://wiki.fm-funknetz.de/doku.php?id=fm-funknetz:technik:shari-sa818 all I’ve done is change the entries to switch off CTCSS and change the frequency to 438.800Mhz. Configuring the SA818 is done by running the SA818-running.py Python programme that you moved into the repeater user home directory. Making sure you are still user root, run the following commands:

cd /home/repeater
./SA818-running.py

At this point your SHARI SA818 device will be configured to operate on 438.800Mhz and CTCSS will be disabled.

If you want to change the frequency or enable and set a CTCSS tone to access the node you will need to edit the Python programme using your favourite text editor and change the entries accordingly. Once changed rerun the program as shown above and your SHARI will be reconfigured to your new settings.

Next you need to move the allmon.ini.php file into the correct directory so that it enables access to the Allstar Monitor web page on the device so that you can manage connecting/disconnecting nodes. Use the following commands as user root to achieve this:

cd /etc/asterisk
mv ./allmon.ini.php /var/www/html/allmon2/
chown root:root /var/www/html/allmon2/allmon.ini.php
chmod 644 /var/www/html/allmon2/allmon.ini.php

The allmon.ini.php file needs to have your node name entered into it to work correctly. As user root, change directory and edit the file using your favourite editor.

cd /var/www/html/allmon2

Using your text editor, search for the line starting [XXXXX] and change the XXXXX to your node number. Save the change and exit the file.

At this point you are almost complete, all that is left to do is add your node number and node secret into the appropriate configuration files in the /etc/asterisk directory.

Since I am a Linux command line junkie I use vi to edit all the configuration files on the command line as user root, but you can use any editor of your choice.

cd /etc/asterisk

Start with the extensions.conf file. Search for the line starting with NODE = and delete the XXXXX entry and insert your node number. Save the file and exit it.

Next you need to edit the iax.conf file. This time search for the line starting with
register= and change the XXXXX for your node number and the YYYYYYYYYYYY for your node secret. Be careful not to accidentally delete any other characters in the lines otherwise it will corrupt the configuration file.

In the same file search for the two lines that start with secret = and change the YYYYYYYYYYYY for your node secret. Once you have changed both of the secret entries, save and exit the file.

The final file to edit is the rpt.conf file. Once again open the file using your favourite editor and search for the line starting with XXXXX = radio@127.0.0.1:4569/XXXXX, change the XXXXX entries for your node number making sure not to delete any other characters next to the XXXXX entries.

Further down in the same file there is a line that starts with [XXXXX], once again change the XXXXX for your node number making sure to keep the square brackets at each end of the node number as you edit it.

Finally move down to the very bottom of the file and find the two lines that start with /home/repeater/gpio, once again change the XXXXX entries for your node number.

The final thing to change in the rpt.conf file is to replace my callsign with your own callsign so that the node identifies itself correctly. Scroll through the file until you find the two lines shown below, delete M0AWS and add your own callsign instead making sure you keep all the spaces between words as shown below.

idrecording = |i DE M0AWS
idtalkover = |i DE M0AWS

Once this is done, save and exit the file. At this point your node should be fully configured and will only require a reboot to get it working.

As user root, reboot your raspi using the reboot command.

reboot

Once your raspi comes back online, login using SSH as user repeater and then become root user using the sudo command detailed above.

You now need to create the admin user password for the Allstar Monitor web page on the device. This is done using the following commands as user root:

cd /var/www/html/allmon2
htpasswd -c .htpasswd admin

You will be asked to enter a password twice for the admin user. Make sure you make a note of this user/password as you will need it to login to the web page.

Finally check that the controlpanel.ini.php file is in the /var/www/html/allmon2 directory:

ls -la /var/www/html/allmon2/controlpanel.ini.php

If the file isn’t shown in the directory, enter the following commands to create the file in the correct place as user root and then exit the SSH session:

cd /var/www/html/allmon2
cp ./controlpanel.ini.txt ./controlpanel.ini.php
cd
exit

Once this is done your configuration is complete, logout from the terminal session by entering exit once more and your SSH session will terminate.

Using your favourite web browser enter the IP Address of your raspi into the URL bar as shown below:

http://<Your-Raspi-IP>/allmon2

Note: remove the <> from the URL once you have entered the required information.

Once this is done you should be presented with your node control panel as shown below.

First visit to the AllStar Monitor Web Page
First visit to the AllStar Monitor Web Page

Login using Admin and the password you set above and you are now ready to start using your node.

It’s a good idea to connect to node 55553 which is a parrot test node to check your audio levels. You can do this by entering the node into the field at the top left and pressing the connect button.

M0AWS AllStarLink Node 61928 connected to 55553 Parrot
M0AWS AllStarLink Node 61928 connected to 55553 Parrot

Once connected, tune your radio to 438.800Mhz FM and transmit a test message using your callsign and test123, or something similar. The parrot will then play your recording back to you so that you can hear how you sound. It will also comment on your audio level as to whether it is OK or not.

You are now connected to AllStarLink network and have the world at your finger tips. Below is a small list of nodes in the UK, Australia and America to get you started chatting with other HAMs via your node.

57881	Matrix HAM Radio Space AllStarLink Node (Hosted by Dk1MI)
55553	ASL Parrot for testing
41522	M0HOY HUBNet Manchester, UK
60349	VK6CIA 439.275 Perth, Western Australia
51077	VK6SEG South West Hub B Albany WA
2167	M0JKT FreeSTAR UK HUB 2 freestar.network
53573	NWAG NW AllStar Group Lancashire, UK
27339	East Coast Hub Wilmington NC USA
M0AWS AllStarLink Node 61928 sitting on the equipment rack
M0AWS AllStarLink Node 61928 sitting on the equipment rack

Thanks to Michael, DK1MI for building and hosting the Matrix HAM Radio Space AllStarLink Node (57881) and getting us all started in the world of AllStarLink!

We hope to be having regular Matrix Net’s on the node soon for all Matrix members and visitors. We’ll organise days/times via the Digital Voice room.

More soon …