 |
Northern
Utah WebSDR
Installing a WebSDR on Ubuntu 22.04
(notes)
|
What's this about?
What follows are (mostly raw) notes related to installing the PA3FWM WebSDR on Ubuntu 22.04.
Some of these details related to specific aspects of code running on the Northern Utah WebSDR and are NOT required for the WebSDR: If there are questions, use the contact info at the bottom of this page.
----> For information about removing SNAP from an Ubuntu 22.04 system, click HERE.
* * * * * *
Upgrading a WebSDR from Ubuntu 20.04 to 22.04
Version 202303120222 - Clint, KA7OEI
If you are going to install a WebSDR on a Raspberry Pi:
The "websdr-rpi" binary is compiled for a 32 bit operating system. While it may be possible configure a Pi with a 64 bit operating system to run the 32 bit "armhf" binary it is strongly suggested that you just install a 32 bit version of the OS on the Raspberry Pi. Even on a Raspberry Pi 4, it will take all of the available processing power to handle two RTL-SDRs running at 2048ksps simultaneously (you'd have to overclock it to 2 GHz for this to work reliably) which means that any added abstraction of running 32 bit applications on a 64 bit system may make it unusable.
The
instructions that follow will assume that in the case of the Raspberry
Pi that you are installing it on a 32 bit OS: I don't have any advice
if you insist on trying to make it work on a 64 bit system although if
you do so, I'd be interested in knowing how well it works and what was
required to do this. I have only done this on a RPi4 running 32 bit Ubuntu 22.04.
|
The set of instructions below are appropriate for any installation of the PA3FWM WebSDR on Ubuntu 22.04
- STRONGLY RECOMMENDED: Use server (CLI-only) version rather than version with graphics!
- Create websdr user and directory
- Unzip distro and create directories: e.g. tar -xvzf websdr-dist11a.tgz
- Follow instructions in /dist11/docs/install.txt
- Increase USB buffer from 16 to 64 MB - There is no need to
reboot immediately after this change as other changes will require
reboot:
From: https://github.com/steve-m/librtlsdr/issues/34
It seems that the library supports only 4 parallel transmitting dongles
at the moment. If the fifth dongle is added and started to transfer
data, e.g. rtl_test -d 4, the error message appears:
“Failed to submit transfer 3!”
“Library error -5, exiting…”
The issue is that the Kernel limits the maximum size of all buffers that libusb can allocate to 16MB by default.
To TEMPORARILY change this value:
$ sudo sh -c 'echo 64 > /sys/module/usbcore/parameters/usbfs_memory_mb'
To modify it permanently, do the following: Go to /etc/default/
Edit the file "grub" and look for the line:
GRUB_CMDLINE_LINUX_DEFAULT="<something><something>"
Add to the contents of this "usbcore.usbfs_memory_mb=64" as in
GRUB_CMDLINE_LINUX_DEFAULT="usbcore.usbfs_memory_mb=64"
Now, one must update GRUB: sudo update-grub
It will not take effect until after reboot. To verify that it's
correct, do: cat /sys/module/usbcore/parameters/usbfs_memory_mb
IMPORTANT NOTE:
In the following steps the installation of the deprecated packages libssl1.0 and libpng12-0
are discussed. These packages are getting increasingly difficult to
find - and pretty much impossible to do this if you are installing on a
Raspberry Pi. If you cannot find the packages it is possible to build them using the information found on Reynico's Github page linked HERE.
These steps - and links to the critical files - will be discussed in a separate section at the end of this document.
|
- Install libssl1.0 (for WebSDR) This package is deprecated in recent distros so it must be added manually:
For libcryto:
1) sudo nano /etc/apt/sources.list
2) add to "sources.list: deb [trusted=yes] http://security.ubuntu.com/ubuntu bionic-security main
3) sudo apt update && apt-cache policy libssl1.0-dev
4) sudo apt-get install libssl1.0-dev
- Install libpng12-0 (for WebSDR) This package is deprecated in recent distros so it must be added manually:
- sudo add-apt-repository ppa:linuxuprising/libpng12
- sudo apt update
- sudo apt install libpng12-0
NOTE:
When doing the above you may get an error message saying that
"libpng12" could not be found in the repository. If this is the
case, you may need to build it from the source as follows essentially
using the method mentioned above:
- sudo apt install build-essential zlib1g-dev
-
cd
-
mkdir src
-
wget https://ppa.launchpadcontent.net/linuxuprising/libpng12/ubuntu/pool/main/libp/libpng/libpng_1.2.54.orig.tar.xz
-
tar Jxfv libpng_1.2.54.orig.tar.xz
-
cd libpng-1.2.54
-
./configure
-
make
-
sudo make install
-
sudo ln -s /usr/local/lib/libpng12.so.0.54.0 /usr/lib/libpng12.so
-
sudo ln -s /usr/local/lib/libpng12.so.0.54.0 /usr/lib/libpng12.so.0
Note: If you are performing a "simple" install of the WebSDR
software and do not need most of what follows, jump to the portion
about "SNAPd", below - but read what follows very carefully as some of it may be relevant to your installation.
* * * * * * *
- Install sensors: sudo apt install lm-sensors
- Install html2text: sudo apt install html2text
- Install alsa-utils, alsa-base, linux-sound-base:
sudo apt install alsa-utils, alsa-base, linux-sound-base libasound2-dev
- Install gcc: sudo apt install gcc
- Install make: sudo apt install make
- Install ncurses: sudo apt-get install libncurses5-dev libncursesw5-dev
- Install libusb-1.0-0-dev: sudo apt-get install libusb-1.0-0-dev
- Install lubusb-dev: sudo apt-get install libusb-dev
- Install pgk-config: sudo apt-get install -y pkg-config
- Install sox: sudo apt-get install sox
- If you are using a "Softrock" receiver such as a FiFiSDR or "5-dash" Softrock Ensemble, see if "rockprog" binary is in ~/cfg. If not, create it:
- Make "rockprog" - https://github.com/8cH9azbsFifZ/rockprog
- Dependency: libpopt-dev: sudo apt install libpopt-dev
- Untar: example - tar -xvzf usbsoftrock-1.0.2.tar.gz
- If you are using a "Softrock" receiver such as a FiFiSDR or a "5-dash" Softrock Ensemble, install and make usbsoftrock https://github.com/alexlee188/usbsoftrock-alex
NOTE: Final step requires "sudo make install"
- If you need to do inline signal processing/filtering,
install csdr - https://github.com/ha7ilm/csdr (will need to
install libfftw3-dev: sudo apt install libfftw3-dev )
- If you are using an RSP1a or other SDRPlay receiver: Install sdrplay API ( https://www.sdrplay.com/softwarehome/ )
- Make the .run file executable!
- If you are using an RTL-SDR: Install librtlsdr - this is needed if you are using an RTL-SDR
- NOTE: If you need the "Direct" port for HF reception (without a frequency converter) you CANNOT use the default librtlsdr in the repos.
- For "direct" input, suggest: https://github.com/US1GHQ/librtlsdr_direct_sp
Dependencies: cmake, build-essential, libusb-1.0-0-dev (already done above)
- sudo apt install cmake
- sudo apt install build-essential
- If the "build" directory already exists, delete it
- Do:
- mkdir build
- cd buildcmake ../ -DINSTALL_UDEV_RULES=ON
- makesudo make install
- sudo ldconfig
- NOTE: RTL_SDR tools will probably not work until the udev/rules below are changed and the system rebooted
- Install "fastloop" - see: http://www.sdrutah.org/info/high_rate_loopback_websdr.html
- NOTE: For Ubuntu 22.04, you will have to comment out the line: MODULE_SUPPORTED_DEVICE("{{ALSA,Loopback soundcard}}");
- To compile, do:
- make
- sudo make modules_install
- sudo depmod -a
- Dependencies:
- Create "/etc/modprobe.d/fastloop.conf": options
snd-fastloop index=8,9,10,11,12,13,14,15
id=fl0,fl1,fl2,fl3,fl4,fl5,fl6,fl7 enable=1,1,1,1,1,1,1,1
- Add to "/etc/modules" so fastloop starts on bootup: snd-fastloop
- Test by starting: sudo modprobe snd-fastloop - use "aplay -l" to see loopback devices.
- NOTE: You may have to reboot before the devices show up!
- If you are using FiFiSDR receivers with band-pass filters,
you will need to make sure that they enumerate in a consistent manner
by always plugging them into the SAME USB port and then determining the port ID of each device.
- Put "alsa_name.pl" in /usr/bin for enumeration/setting sound card for FiFiSDRs
- BE SURE TO "sudo chmod 777 alsa_name.pl" to allow execution. (If you need this file, use the contact info, below.)
- Edit as appropriate to make sure that FiFiSDR is assigned
to audio device - use a "high" number (31 and downwards) to prevent
conflict with other devices
- Do "sudo dmesg | grep -i fifi" to find fifi device USB
port, then use USB port numbers to determine FiFi serial number (e.g.
"sudo dmesg | grep -i 7-2")
- Put "fifi-names.rules" in "etc/udev/rules.d" (If you need this file, use the contact info, below.)
- If you are using an RTL-SDR: Put "rtl-sdr.rules" in "etc/udev/rules.d/rtl_sdr.rules" - see the Osmocom rtl-sdr project for this file.
- If you are using a FiFiSDR or Softrock receiver such as the
5-dash Softrock Ensemble: Put "softrock.rules" in
"etc/udev/softrock.rules" if you are using a FiFiSDR or similar device.
This file contains the following line:
- SUBSYSTEM=="usb",ATTR{idVendor}=="16c0",ATTR{idProduct}=="05dc",MODE="0666",GROUP="dialout"
- If you are using an RTL-SDR: Add to "/etc/modprobe.d/blacklist.conf" to prevent kernel from grabbing RTL-SDR device: blacklist dvb_usb_rtl28xxu
- For ephemeral data like "gain" files and various logging, create/define RAMFS for temporary directories - add to "/etc/fstab":
# WebSDR Gainfile and similar - 1 Meg
tempfs /home/websdr/pub/t tmpfs size=1M,mode=0777 0 0
# WebSDR temp data - 100 Meg
tempfs /home/websdr/cfg/temp tmpfs size=100M,mode=0777 0 0
- To have the WebSDR auto-start on boot-up: Create
file in "etc/systemd/system/multi-user.target.wants" - "websdr.service"
- BE SURE to "chmod 777" this file!. In the script below, the
bash file "startsdr" is that which is called to set up/configure
receivers, adjust gain, set frequency, and start the websdr executable.
# Do chmod 777 on this file!
[Unit]
Description= WebSDR
After=multi-user.target
[Service]
User=websdr
Group=websdr
Type=forking
ExecStart=/home/websdr/bin/./startsdr
Restart=on-abort
[Install]
WantedBy=multi-user.target
- IMPORTANT:
Ubuntu 22.x has a known bug with ASUS sound devices which will likely
appear if you have a sound card - particularly if it is an ASUS:
- Issue: "alsactl" will start up on boot (or upon login) and consume an entire CPU core.
- There is NO known fix for this other than modifying/compiling the ALSA kernel
- A kludgy "work-around": Go to "/usr/sbin" and rename
"alsactl" to "alsactl-disabled" (e.g. "sudo mv alsactl
alsactl-disabled" ) to prevent it from starting
- NOW, go around and set to "chmod 774" the binaries and scripts (some of these are specific to the Northern Utah WebSDR):
- In ~/pub: get_user_status.sh duplicate_ip_parse.sh logcpy.sh
- In ~/cfg: rx_stats.sh
config_rtl_devices.sh freq_control.sh temp_comp.sh
config_fifi_devices.sh cpumon.sh
weekend_night_tags.sh weekend_day_tags.sh
weekday_night_tags.sh weekday_day_tags.sh
config_audio_cards.sh sdrplayalsa fplay rockprog
- In ~/bin: startsdr
- In ~/dist11: The WebSDR binary, which could be called "websdr", "websdr64", "websdr65" or similar.
Removing SNAP - READ THE FOLLOWING
- IMPORTANT:
When 22.x is installed, SNAP will also be installed - including GUI
elements, even on a CLI-only system - and this should be removed as
follows or else it will be prone to inconvenient updates and will
likely cause random outages and high CPU utilization on the WebSDR (or WSPRDaemon)
system.
- IT IS STRONGLY RECOMMENDED that you do this from a local console and NOT remotely as SNAP may have control of networking hardware and you may lose connectivity.
- Take note of what packages snap has claimed: snap list
- If you get no results, stop here - snap is not running on your system.
- Get those resources out of snap, one at a time. Be sure start
with LXD - if it is present
- Example: sudo snap remove --purge
[package-name-here]
- DO NOT try to do multiple removals at the same time - remove ONE package per line, only!
- Some SNAP packages have dependencies and you can't
remove one before removing another. Consider the following error:
- sudo snap remove --purge bare
error: cannot remove "bare": snap "bare" is not removable: snap is being used by snap gtk-common-themes.
- In this case you would first need to remove "gtk-common-themes" and whatever (other) dependencies may be involved.
- Clear the snap cache manually, as this is not done when removing? sudo rm -rf /var/cache/snapd/
- Get rid of snapd and the GUI package: sudo apt autoremove --purge snapd gnome-software-plugin-snap
- Clear out your users snap settings: rm -fr ~/snap
- Stop aptitude packages from installing it again as they will try!: sudo apt-mark hold snapd
* * *
Building libpng12-0 and libssl1.0-dev
As noted above, the libpng12-0 and libssl1.0-dev dependencies are required
for the WebSDR binary - but they have been deprecated since at least
Ubuntu 16 and are becoming increasingly difficult to find - and if you
are installing a WebSDR on a Rasperry Pi, it's nearly impossible to do
so. Fortunately, this problem has been addressed on Reynico's Github page linked HERE. We acknowledge and thank Reynico for doing this.
Even if you are NOT
targeting a Raspberry Pi, it is worth reading the Github page as it
contains useful information for any target hardware - and also useful
tips on how to get it working, specifically with and RTL-SDR.
For convenience - and in the event that this Github page disappears,
here are the steps required to build these two packages. You may need to install the approppriate compiler software to do this, but the (standard) distro that we used already included it.
Building libpng12:
- Get the source file "libpng-1.2.59.tar.xz". This is
easily found via a web search, but you can also download it from the
Northern Utah WebSDR site here.
- Do the following:
- Compiling the above may take some time to complete.
Building libssl-1.0.0:
- Get the source file "openssl-1.0.0k.tar.gz". This may
be found via a web search, but you can also download it from the
Northern Utah WebSDR site here.
- Do the following:
-
tar xf openssl-1.0.0k.tar.gz
-
cd openssl-1.0.0k/
-
cat << EOF > openssl.ld
OPENSSL_1.0.0 {
global:
*;
};
EOF
- Note: The above creates a file called "openssl.ld"
and puts the 5 lines - starting with "OPENSSL_1.0.0" and ending with
"EOF" into it: Cut and past all of the lines starting with "cat"
and ending with "EOF" all at once into the Linux command line.
-
./config shared --prefix=$HOME/libssl/openssl --openssldir=$HOME/libssl/ssl -Wl,--version-script=openssl.ld -Wl,-Bsymbolic-functions
-
make
-
sudo make install_sw
-
sudo ldconfig
-
ldd $HOME/libssl/openssl/bin/openssl
-
sudo cp $HOME/libssl/openssl/lib/libcrypto.so /usr/local/lib
-
sudo chmod 0755 /usr/local/lib/libcrypto.so
-
sudo ldconfig
- Compiling the above may take quite a while to complete.
After each of the above completes you should no longer have the "libpng" or "libssl" dependency issues.
Additional
information:
- For general information about this WebSDR system -
including contact info - go to the about
page (link).
- For the latest news about this system and current issues,
visit the latest news
page (link).
- For more information about this server you may contact
Clint, KA7OEI using his callsign at ka7oei dot com.
- For more information about the WebSDR project in general -
including information about other WebSDR servers worldwide and
additional technical information - go to http://www.websdr.org
Back to the Northern Utah WebSDR landing page