2

I am trying to run GNU Radio flowgraphs (no GUI) from within a Docker container. The OS on both the host and docker image is Ubuntu 18.04. I am running GNU Radio v3.7.13.4 and UHD v3.14.0.0.

On the host I can run grcc -e flowgraph.grc and it executes as expected. When I try and run it in the Docker container it reports

Validation failed:

Block - blocks_tagged_stream_multiply_length_0 - Tagged Stream Multiply Length Tag(blocks_tagged_stream_multiply_length):
        Source - out(0):
                Port is not connected.
Error during file compilation.

On both the host and in the Docker container uhd_find_devices returns:

[INFO] [UHD] linux; GNU C++ version 7.5.0; Boost_106501; UHD_3.14.0.HEAD-0-g6875d061
--------------------------------------------------
-- UHD Device 0
--------------------------------------------------
Device Address:
    serial: 30CF9B7
    name: MyB210
    product: B210
    type: b200

So it appears I am sharing the USB devices between the host and the container correctly (although I suspect the problem is some finer detail to do with this).

I am running the container with: docker run -it -v /dev/bus/usb:/dev/bus/usb --privileged csradio:latest

Does anyone know what the problem could be?

Edit 1: added OS, GNU and UHD version details.

Steven Gillies
  • 471
  • 7
  • 18
  • Do you use OOT blocks in your flowgraph? If so make sure all OOT blocks are installed in the container. Can you share your flowgraph or a screenshot of it? Do you use Ubuntu 18.04 on both your host and container and what gnuradio version did you install in both host and container? – Vasil Velichkov Jun 13 '20 at 16:59
  • Yes there are OOT blocks in flowgraph, these are all installed. The block that causes the issue is the one for the USRP source block. I can recreate the error message above by trying to run the command when the USRP is not connected, so I am fairly certain it is some sort of permissions/accesibility issue between the container and the USB USRP. I cant provide a screenshot of the flowgraph inside the container as I haven't managed to forward the display, so GNU Radio errors when it launches. I have added GNU radio and UHD versions, as well as OS details, to the original question. – Steven Gillies Jun 13 '20 at 17:12
  • I doubt that it is a permission problem as I can compile flowgraphs (both in a container and on the host) without having the USRP device connected. The grcc command just generates a python script and does not execute it. My advice is to try compiling two simple flowgraphs - one with one USRP source block connected to a Null Sink and a second one with one Signal Source connected to a Null Sink. Also you can use [x11docker](https://github.com/mviereck/x11docker) to run the Gnuradio Companion inside your container. – Vasil Velichkov Jun 13 '20 at 19:17
  • I just saw that you are using the `-e` option to execute the flowgraph. Can you try doing it in two steps - first build it with `grcc -d . flowgraph.grc` and then if successful run it with `./flowgraph.py` – Vasil Velichkov Jun 13 '20 at 19:48
  • tried it with the -d flag, same error, so I suspect it is something to do with the installation now rather than the usb permissions. Further evidence to this is that I can run uhd_usrp_probe and that functions fine. I've moved on to investigating the installation. The difference between the container and the host machine is the container is installed as root. I'll rewrite it to create a user and use the exact same install script as the host did and see if that works. Thanks for your help so far. – Steven Gillies Jun 14 '20 at 10:20
  • Can you share your dockerfile and install script? BTW how did you install gnuradio v3.7.13.4? I'm asking because the version in the 18.04 repo is 3.7.11 and the version in [gnuradio-releases-3.7 PPA repo](https://launchpad.net/~gnuradio/+archive/ubuntu/gnuradio-releases-3.7) is 3.7.13.5. I doubt it's because of the `root` user. Have you tried building the two simple flowgraphs? – Vasil Velichkov Jun 14 '20 at 11:47
  • Today I tried building the simple flowgraphs but I don't seem to have the USRP blocks now in the library. I must have tweaked the install scripts since I installed on the host and didn't notice. Where do these blocks come from? I can't spot any differences that might cause it. I have uploaded the install script to https://bitbucket.org/machinator/gnuradio/src/master/. The script was built by following the instructions on the Ettus website for 18.04. Thanks. – Steven Gillies Jun 14 '20 at 22:34
  • Oh, I also meant to add, the Dockerfile uses the same method but this problem occurs in a traditional VM I created today, so I think Docker is irrelevant (to the missing block issue anyway). – Steven Gillies Jun 14 '20 at 22:41
  • I switched from installing GNU Radio by source to from PPA and it seems to have worked; the UHD Blocks are back in my GNU Radio Library and I can GRCC on host and docker image. Thank you for your help. If you want to write an answer I'll accept it when I'm finished testing. – Steven Gillies Jun 15 '20 at 01:00

1 Answers1

1

Looking at your Dockerfile the most probable reason for the above error is that UHD blocks are missing because you have installed uhd after you installed gnuradio.

The solution is to first build and install uhd and then build gnuradio.

Vasil Velichkov
  • 1,236
  • 11
  • 17