FlightAware Discussions

Howto Install Piaware 3.8.1 on Ubuntu and Debian amd64

Just running in to this today, glad smart folks are already looking in to it. I’d like to keep my Pi 4 64 bit if possible since I do plan to run other things on it. Thanks for the pointers on librtlsdr, I have worked with that before so will take a shot at building with the mmap/zcp stuff off.

@postl
Great. If you succeed, please dont forget to post step-by -step method for benefit of so many others who want to run 64 bit on Pi4. Thanks

That’s a big if, but I certainly will.

We’re not the first ones to find this. The most promising lead I have so far is a patch someone posted on Reddit - https://www.reddit.com/r/RTLSDR/comments/ds73ow/rtl_process_being_killed_newbie_troubleshooting/f6ynsaw/

I’ve checked out librtlsdr 0.6.0 and applied that patch, so far no luck but I’m trying a few other things, I have a feeling my build with the patch applied is not what was being used in the later rebuild of dump1090-fa.

1 Like

Alright, I was able to get a build working using that patch from Reddit. I’ll explain my process here and also revisit and try to run through the process from scratch in the morning to verify I didn’t miss anything.

First, uninstall all librtlsdr and dump1090 packages that you might already have installed from previous attempts:

sudo apt remove librtlsdr0 librtlsdr-dev dump1090-fa

We will replace them with our patched versions, starting with librtlsdr.

First we’ll fetch the librtlsdr source (I used a GitHub mirror, not the upstream directly but that should also work just fine)

git clone https://github.com/steve-m/librtlsdr
cd librtlsdr
git checkout 0.6.0

I used a text editor to apply the patch from Reddit

ubuntu@ubuntu:~/librtlsdr$ git diff
diff --git a/src/librtlsdr.c b/src/librtlsdr.c
index 433ed5b..cdd2853 100644
--- a/src/librtlsdr.c
+++ b/src/librtlsdr.c
@@ -1748,7 +1748,7 @@ static int _rtlsdr_alloc_async_buffers(rtlsdr_dev_t *dev)
        dev->xfer_buf = malloc(dev->xfer_buf_num * sizeof(unsigned char *));
        memset(dev->xfer_buf, 0, dev->xfer_buf_num * sizeof(unsigned char *));

-#if defined (__linux__) && LIBUSB_API_VERSION >= 0x01000105
+#if defined (__linux__) && LIBUSB_API_VERSION >= 0x01000105 && 0
        fprintf(stderr, "Allocating %d zero-copy buffers\n", dev->xfer_buf_num);

        dev->use_zerocopy = 1;

We’re just adding the ‘&& 0’ to the end of one line to negate the version check. Next we build, package, and install the library with this change.

mkdir build
cd build
cmake ../
make
cd ..
dpkg-buildpackage -b
cd ..
sudo dpkg -i librtlsdr0_0.6git_arm64.deb
sudo dpkg -i librtlsdr-dev_0.6git_arm64.deb

If you run in to issues with these let me know, I can try to reproduce or troubleshoot. With the patched librtlsdr packages installed we can now install dump1090 as folks have been.

git clone https://github.com/flightaware/dump1090.git
cd dump1090
dpkg-buildpackage -b
cd ..
dpkg -i dump1090-fa_3.8.1_arm64.deb

My current diff on this to address BladeRF issues is:

ubuntu@ubuntu:~/dump1090$ git diff
diff --git a/Makefile b/Makefile
index 6343ffb..c608333 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 PROGNAME=dump1090

 RTLSDR ?= yes
-BLADERF ?= yes
+BLADERF ?= no

 CPPFLAGS += -DMODES_DUMP1090_VERSION=\"$(DUMP1090_VERSION)\" -DMODES_DUMP1090_VARIANT=\"dump1090-fa\"

diff --git a/debian/control b/debian/control
index f60de0d..729577a 100644
--- a/debian/control
+++ b/debian/control
@@ -19,7 +19,7 @@ Description: transitional dummy package for dump1090

 Package: dump1090-fa
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, libbladerf1 (>= 0.2016.06), adduser, lighttpd
+Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lighttpd
 Replaces: dump1090 (<< 3.0)
 Breaks: dump1090 (<< 3.0)
 Description: ADS-B Ground Station System for RTL-SDR
diff --git a/debian/rules b/debian/rules
index b97cd02..d31ed38 100755
--- a/debian/rules
+++ b/debian/rules
@@ -20,7 +20,7 @@ ifeq ($(DEB_HOST_ARCH),armhf)
 endif

 override_dh_auto_build:
-       dh_auto_build -- RTLSDR=yes BLADERF=yes DUMP1090_VERSION=$(DEB_VERSION)
+       dh_auto_build -- RTLSDR=yes BLADERF=no DUMP1090_VERSION=$(DEB_VERSION)

 override_dh_install:
        dh_install

After dump1090-fa installed the systemd service came up just fine and piaware picked it up, connected, and started reporting spots.

2 Likes

@postl
Thank you :+1: :+1: :+1:

Just to follow up, I’ve had one issue issue with this now. It is otherwise working great. apt/Ubuntu think that their librtlsdr package is an ‘upgrade’ to the one I manually built and installed:

ubuntu :: ~ » apt list --upgradeable
Listing... Done
debootstrap/focal-updates 1.0.118ubuntu1.1 all [upgradable from: 1.0.118ubuntu1]
landscape-common/focal-updates 19.12-0ubuntu4.1 arm64 [upgradable from: 19.12-0ubuntu4]
librtlsdr-dev/focal 0.6.0-3 arm64 [upgradable from: 0.6git]
librtlsdr0/focal 0.6.0-3 arm64 [upgradable from: 0.6git]

Since I have autoupdates configured at some point overnight Ubuntu ran that and replaced my librtlsdr build with the upstream one which caused dump1090-fa to start crashing again. I manually removed and reinstalled my version this morning and am looking in to how to prevent updates of specific packages.

EDIT: I marked the packages as ‘hold’ using apt which prevents them from being updated automatically by the package manager.

ubuntu :: ~ » sudo apt-mark hold librtlsdr0 librtlsdr-dev
librtlsdr0 set on hold.
librtlsdr-dev set on hold.

ubuntu :: ~ » sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  liblimesuite20.01-1 libosmosdr0 limesuite-udev soapyosmo-common0.7 soapysdr0.7-module-lms7 soapysdr0.7-module-osmosdr
Use 'sudo apt autoremove' to remove them.
The following packages have been kept back:
  librtlsdr-dev librtlsdr0
The following packages will be upgraded:
  debootstrap landscape-common
2 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Need to get 126 kB of archives.
After this operation, 1024 B of additional disk space will be used.
3 Likes

To prevent Ubuntu to upgrade librtlsdr0 and librtlsdr-dev, I tried to build deb package with version number 0.6.0-3 instead of 0.6git

ubuntu@ubuntu:~/librtlsdr$ sudo nano CMakeLists.txt

Scrolled down to this part of code:

# Set the version information here
set(VERSION_INFO_MAJOR_VERSION 0) # increment major on api compatibility changes
set(VERSION_INFO_MINOR_VERSION 6) # increment minor on feature-level changes
set(VERSION_INFO_PATCH_VERSION 0) # increment patch for bug fixes and docs

 
In the last line, changed 0 to 0-3, so it became:

set(VERSION_INFO_PATCH_VERSION 0-3) # increment patch for bug fixes and docs

Then ran:

ubuntu@ubuntu:~/librtlsdr/build$ cmake ../ 

Got this output: :slight_smile:

-- Building for version: 0.6.0-3 / 0.6.0-3 

Ran following commands
cd ../
make
cd ../
dpkg-buildpackage -b

The packages built did not have version 0.6.0-3
They still had version number 0.6git :angry:

librtlsdr0_0.6git_arm64.deb
librtlsdr-dev_0.6git_arm64.deb 
1 Like

For debian/ubuntu packages, the package version is determined by looking at the latest entry in the changelog (debian/changelog)

If you want to bump the version locally then dch can help you add a new entry to the changelog with a new version (in particular see the --local switch). This is how piaware et al change the package version for backports to stretch etc.

2 Likes

OK, modified version number in debian/changelog and built package with version 0.6.0-3, and installed, but Ubuntu repository is smart, refuses to accept bumped version as genuine:

ubuntu@ubuntu:~$ apt list --upgradable
Listing... Done
... ... ...
... ... ...
librtlsdr-dev/focal 0.6.0-3 arm64 [upgradable from: 0.6.0-3]
librtlsdr0/focal 0.6.0-3 arm64 [upgradable from: 0.6.0-3]
... ... ...
... ... ...

 

ubuntu@ubuntu:~/librtlsdr$ git diff 

diff --git a/debian/changelog b/debian/changelog
index 24d97e2..83f63a3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-rtl-sdr (0.6git) unstable; urgency=medium
+rtl-sdr (0.6.0-3) unstable; urgency=medium

   * New upstream release
diff --git a/src/librtlsdr.c b/src/librtlsdr.c
index 433ed5b..cdd2853 100644
--- a/src/librtlsdr.c
+++ b/src/librtlsdr.c
@@ -1748,7 +1748,7 @@ static int _rtlsdr_alloc_async_buffers(rtlsdr_dev_t *dev)
        dev->xfer_buf = malloc(dev->xfer_buf_num * sizeof(unsigned char *));
        memset(dev->xfer_buf, 0, dev->xfer_buf_num * sizeof(unsigned char *));

-#if defined (__linux__) && LIBUSB_API_VERSION >= 0x01000105 
+#if defined (__linux__) && LIBUSB_API_VERSION >= 0x01000105 && 0
        fprintf(stderr, "Allocating %d zero-copy buffers\n", dev->xfer_buf_num);

        dev->use_zerocopy = 1; 

 

ubuntu@ubuntu:~$ ls 

dump1090-fa                          librtlsdr-dev_0.6.0-3_arm64.deb
dump1090-fa-dbgsym_3.8.1_arm64.ddeb  librtlsdr0-dbgsym_0.6.0-3_arm64.ddeb
dump1090-fa_3.8.1_arm64.buildinfo    librtlsdr0_0.6.0-3_arm64.deb
dump1090-fa_3.8.1_arm64.changes      rtl-sdr-dbgsym_0.6.0-3_arm64.ddeb
dump1090-fa_3.8.1_arm64.deb          rtl-sdr_0.6.0-3_arm64.buildinfo
dump1090_3.8.1_all.deb               rtl-sdr_0.6.0-3_arm64.changes
librtlsdr                            rtl-sdr_0.6.0-3_arm64.deb

I think if you just build master, this is already fixed.
There is a flag for zero copy,

–enable-zerocopy Enable usbfs zero-copy support (disabled by default)

which sets the macro ENABLE_ZEROCOPY=1 if set and doesn’t set it if not.
And that line you changed is now

#if defined(ENABLE_ZEROCOPY) && defined (linux) && LIBUSB_API_VERSION >= 0x01000105

2 Likes

Thank you @mikkyo.
I now built it from master branch, and without any modification to file librtlsdr/src/librtlsdr.c.
It works OK .

1 Like

ubuntu-20.04-preinstalled-server-arm64+raspi.img

Installed on PI-4

Tried to build piaware, got stuck with python3-venv

ubuntu@ubuntu:~$ uname -a
Linux ubuntu 5.4.0-1008-raspi #8-Ubuntu SMP Wed Apr 8 11:13:06 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux

 

make[2]: Leaving directory '/home/ubuntu/piaware_builder/package-bionic/dump1090'
pyvenv /home/ubuntu/piaware_builder/package-bionic/debian/venv --without-pip
make[1]: pyvenv: Command not found
make[1]: *** [debian/rules:61: setup_venv] Error 127
make[1]: Leaving directory '/home/ubuntu/piaware_builder/package-bionic'
make: *** [debian/rules:95: build] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2  

 

ubuntu@ubuntu:~$ apt policy python3-venv
python3-venv:
  Installed: 3.8.2-0ubuntu2
  Candidate: 3.8.2-0ubuntu2
  Version table:
 *** 3.8.2-0ubuntu2 500
        500 http://ports.ubuntu.com/ubuntu-ports focal/universe arm64 Packages
        100 /var/lib/dpkg/status

ubuntu@ubuntu:~$ pyvenv

Command 'pyvenv' not found, but can be installed with `python3-venv`

`

ubuntu-20.04-preinstalled-server-arm64+raspi.img, Installed on PI-4

Tried following hack.

$ sudo mv /usr/bin/pyvenv /usr/bin/pyvenv.orig
$ sudo ln -s /usr/share/bash-completion/completions/pyvenv /usr/bin/pyvenv
$ sudo chmod +x /usr/share/bash-completion/completions/pyvenv    

$ ls -l /usr/bin/pyvenv
lrwxrwxrwx 1 root root 45 May 17 23:34 /usr/bin/pyvenv -> /usr/share/bash-completion/completions/pyvenv    

 

After the above hack, the error “pyvenv: command not found” disappeared, but another error appeared: “/usr/bin/pyvenv: 23: complete: not found”. :rage:

ubuntu@ubuntu:~/piaware_builder/package-bionic$ sudo dpkg-buildpackage -b --no-sign
... ... ...
... ... ...
pyvenv /home/ubuntu/piaware_builder/package-bionic/debian/venv --without-pip
/usr/bin/pyvenv: 23: complete: not found
make[1]: *** [debian/rules:61: setup_venv] Error 127
make[1]: Leaving directory '/home/ubuntu/piaware_builder/package-bionic'
make: *** [debian/rules:95: build] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2

Try applying the change to buster/rules from https://github.com/flightaware/piaware_builder/commit/dabf7df28303299d43c8945a05ffed55f962fb58

2 Likes

Thanks to @obj with whose help & guidance I could finally succeed in installing dump1090-fa and piaware on Pi 4B running Ubuntu Server 20.04 arm64.

Thanks also to @postl and @mikkyo for their contribution.

I have created a separate thread for the finished procedure. This will enable users to get the complete and final howto without need to brows through lot of posts.

Howto Install Piaware 3.8.1 on Ubuntu Server 20.04 arm64 / Pi4

 

3 Likes

My AMD64 Ubuntu 19 offers the update to 20. I’m reluctant to do the upgrade…
Will this upgrade work now?

I did not try it, so not sure, but feel that if you have installed piaware and dump1090-fa according to fist post of this thread it should work even after upgrade.

If I find time this weekend (or may be next weekend), I will try upgrade of ver 19 amd64 to ver 20 amd64 on VM, and see what happens.

2 Likes

The installs were done a long time ago, per your other thread, and regular updates applied (with no ill effects).

Ok, upgraded from Ubuntu 19 to Ubuntu 20.

abcd@ubuntu19:~$ update-manager  

Took about 2 hrs to complete :slightly_frowning_face:

 

Piaware knocked-out by upgrade

abcd@ubuntu19:~$ sudo systemctl status piaware
● piaware.service
     Loaded: masked (Reason: Unit piaware.service is masked.)
     Active: inactive (dead)

 

dump1090-fa survived the upgrade

abcd@ubuntu19:~$ sudo systemctl status dump1090-fa
[sudo] password for abcd:
● dump1090-fa.service - dump1090 ADS-B receiver (FlightAware customization)
     Loaded: loaded (/lib/systemd/system/dump1090-fa.service; enabled; vendor p>
     Active: active (running) since Sat 2020-05-23 17:25:01 EDT; 2min 3s ago
       Docs: https://flightaware.com/adsb/piaware/
   Main PID: 2124 (dump1090-fa)
      Tasks: 3 (limit: 4657)
     Memory: 4.2M
     CGroup: /system.slice/dump1090-fa.service
             └─2124 /usr/bin/dump1090-fa --device-index 00001090 --gain -10 --p>

May 23 17:25:01 ubuntu19 systemd[1]: Started dump1090 ADS-B receiver (FlightAwa>
May 23 17:25:01 ubuntu19 dump1090-fa[2124]: Sat May 23 17:25:01 2020 EDT  dump1>
May 23 17:25:02 ubuntu19 dump1090-fa[2124]: rtlsdr: using device #0: Generic RT>
May 23 17:25:02 ubuntu19 dump1090-fa[2124]: Detached kernel driver
May 23 17:25:03 ubuntu19 dump1090-fa[2124]: Found Rafael Micro R820T tuner
May 23 17:25:03 ubuntu19 dump1090-fa[2124]: rtlsdr: enabling tuner AGC
May 23 17:25:04 ubuntu19 dump1090-fa[2124]: Allocating 4 zero-copy buffers
1 Like

Hi,
I have issue with 2.2 point.

dpkg-shlibdeps: error: no dependency information found for /usr/local/lib/librtlsdr.so.0 (used by debian/dump1090-fa/usr/bin/dump1090-fa)
Hint: check if the library actually comes from a package.
dh_shlibdeps: dpkg-shlibdeps -Tdebian/dump1090-fa.substvars debian/dump1090-fa/usr/bin/view1090-fa debian/dump1090-fa/usr/bin/dump1090-fa returned exit code 255
dh_shlibdeps: Aborting due to earlier error

Ubuntu version

ubuntu@ubuntu18:~/dump1090-fa$ uname -a
Linux ubuntu18 5.3.0-53-generic #47~18.04.1-Ubuntu SMP Thu May 7 13:10:50 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Package version

ubuntu@ubuntu18:~/dump1090-fa$ apt list --installed | grep librtl
librtlsdr-dev/bionic,now 0.6.0-myriadrf1~bionic amd64 [zainstalowany]
librtlsdr0/bionic,now 0.6.0-myriadrf1~bionic amd64 [zainstalowany,automatycznie]