Startx hostname: No address associated with hostname

Hi,

I’m running an OS balena with “balenalib/coral-dev-ubuntu:bionic-run” image on my Google Coral Dev Board. I want to use “startx” to display my graphics interface with gstreamer on my monitor but get the following error:

hostname: No address associated with hostname
xauth: (stdin):1: bad display name “f20f830:0” in “add” command

X.Org X Server 1.19.6
Release Date: 2017-12-20
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.15.0-109-generic aarch64 Ubuntu
Current Operating System: Linux f20f830 4.14.98-imx #1 SMP PREEMPT Wed May 13 19:42:27 UTC 2020 aarch64
Kernel command line: console=ttymxc0,115200 earlycon=ec_imx6q,0x30860000,115200 root=PARTUUID=fe42e58f-02 ro rootwait net.ifnames=0
Build Date: 04 September 2020 03:33:38PM
xorg-server 2:1.19.6-1ubuntu4.6 (For technical support please see http://www.ubuntu.com/support)
Current version of pixman: 0.34.0
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Markers: (–) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: “/var/log/Xorg.0.log”, Time: Mon Sep 14 14:00:46 2020
(==) Using system config directory “/usr/share/X11/xorg.conf.d”
EGL_MESA_drm_image required.
xinit: connection to X server lost

waiting for X server to shut down (II) Server terminated successfully (0). Closing log file.

xauth: (argv):1: bad display name “f20f830:0” in “remove” command

No idea how to deal with this issue.

Hi, unfortunately X11 is not supported on the Google Coral. Only wayland is supported afaik. We have a sample project that uses weston and a tpu here so you can maybe use that as a guide: https://github.com/balena-io-examples/google-coral-dev-sample

Thanks for the reply, I tried the repo you gave me: the classification works well but I get no display of the image and I get the following error:
Running sample: /usr/share/edgetpu/examples/classify_image.py

Ara macao (Scarlet Macaw)
Score : 0.6796875

Platycercus elegans (Crimson Rosella)
Score : 0.12109375

insmod: ERROR: could not insert module galcore.ko: File exists
mkdir: cannot create directory ‘/tmp/.X11-unix/’: File exists
/usr/bin/weston-launch: TIOCSCTTY failed - tty is in use: Operation not permitted
failed to restore keyboard mode: Bad file descriptor
failed to set KD_TEXT mode on tty: Bad file descriptor
could not reset vt handling

And the program doesn’t stop

Initially I was trying to print the results from this project with gstreamer:


and get the following error:

Model: models/bodypix_mobilenet_v1_075_640_480_16_quant_edgetpu_decoder.tflite
Heatmap size: (41, 31)
Stride: 16 (41, 31)
Inference size: (640, 480)
Source size: (640, 480)
Detected Edge TPU dev board.


NOTE: On a Coral devboard use bodypix_gl_imx.py instead for much faster performance.


Gstreamer pipeline: v4l2src device=/dev/video0 ! video/x-raw,width=640,height=480,framerate=30/1 ! queue max-size-buffers=1 leaky=downstream
! decodebin ! glupload ! glvideoflip video-direction=identity ! queue max-size-buffers=1 leaky=downstream
! glfilterbin filter=glbox name=glbox ! video/x-raw,format=RGB,width=640,height=480 ! appsink name=appsink sync=false emit-signals=true max-buffers=1 drop=true

Traceback (most recent call last):
File “bodypix.py”, line 180, in
main()
File “bodypix.py”, line 176, in main
jpeg=args.jpeg)
File “/home/project-bodypix/gstreamer.py”, line 129, in run_pipeline
pipeline = Gst.parse_launch(pipeline)
gi.repository.GLib.Error: gst_parse_error: could not set property “filter” in element “glfilterbin0” to “glbox” (4)

I think the problem is maybe similar: I cannot display the results through graphics interface

Hi there, what version on balenaOS are you trying to run this on?

Hi, I’m running on balenaOS 2.56.0+rev1 with " balenalib/coral-dev-ubuntu:bionic " image.

Other example: if I try to load and display a simple image with opencv:

img = cv2.imread(’/usr/share/edgetpu/examples/images/parrot.jpg’,0)

cv2.imshow(‘image’,img)
cv2.waitKey(0)
cv2.destroyAllWindows()

I get:

cv2.imshow(‘image’,img)
cv2.error: OpenCV(4.5.0-pre) /root/opencv/modules/highgui/src/window_gtk.cpp:624: error: (-2:Unspecified error) Can’t initialize GTK backend in function ‘cvInitSystem’

Despite all this, I installed all necessary packages like libgtk2.0-dev pkg-config or gstreamer1.0-plugins-good libgstreamer-plugins-base1.0-0 etc…

If I try to launch a video by using wayland:
gst-launch-1.0 playbin uri=file:/home/file_example_MP4_640_3MG.mp4 video-sink=waylandsink

It results as:

Setting pipeline to PAUSED …
Pipeline is PREROLLING …
AL lib: (EE) ALCplaybackAlsa_reset: snd_pcm_hw_params(self->pcmHandle, hp) failed: File descriptor in bad state
ERROR: from element /GstPlayBin:playbin0/GstPlaySink:playsink/GstBin:abin/GstOpenALSink:openalsink0: Unable to prepare device.
Additional debug info:
gstopenalsink.c(859): gst_openal_sink_prepare (): /GstPlayBin:playbin0/GstPlaySink:playsink/GstBin:abin/GstOpenALSink:openalsink0:
ALC error: Invalid Device
ERROR: pipeline doesn’t want to preroll.
Setting pipeline to NULL …
Freeing pipeline …

Hi @thibault, I don’t have a Coral Dev Board myself so my teammate (Alexandru) who authored that sample repo will test it again on the latest balenaOS.

Meanwhile, he noted that you need to make sure you install all the packages as listed here: https://github.com/balena-io-examples/google-coral-dev-sample/blob/ba037f0eb8dc6ed5ba29459cee2c3a559a57a5dd/Dockerfile#L8

Could you please confirm that you tried to install the sample repo as we provided it on github? Have you seen any errors on the console when you pushed this release to balena?

Hi, thanks for your quick response, yes I used the same dockerfile from your repo. I just added the opencv installation:

RUN cd ~ && git clone https://github.com/Itseez/opencv.git &&
cd ~ && git clone https://github.com/Itseez/opencv_contrib.git &&
cd ~/opencv && mkdir -p build && cd build &&
cmake -D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=/usr/local
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules
-D BUILD_EXAMPLES=OFF … &&
make -j4 &&
make install && \
ldconfig

And some additional packages like:

RUN apt-get update -qy &&
apt-get install -y git wget python3.6 gnupg gcc g++ cmake libusb-1.0-0-dev autoconf automake
libtool build-essential libssl-dev tcc libtbb-dev python3-dev libpython3-dev zlib1g zlib1g-dev \ libharfbuzz0b libgtk2.0-dev pkg-config

RUN pip3 install --upgrade pip &&
pip3 install numpy Pillow autopep8

But all of the others commands from my dockerfile are exactly the same than your dockerfile.
Is my additional packages could bring conflicts ?

When I pushed my dockerfile I haven’t seen any errors. I’m checking the installation by installing one by one the necessary packages but still saying me that the package is already installed.

Thanks for the extra info. I forwarded these to my teammate and he’ll look into replicating the issue.

Hi,

I have updated the example to address the issue you encountered with gst-launch. Please make sure to un-comment all packages for this use-case - https://github.com/balena-io-examples/google-coral-dev-sample/blob/master/Dockerfile

Regarding the gtk init error, I think it first needs the XDG_RUNTIME_DIR export, in case it wasn’t done.

I came across this opencv installation example and I think it might need gtk3 for this version of opencv. I can confirm gtk3 and this model of window creation works.

Thanks for the help, I can now display a simple image with opencv:

import cv2
img = cv2.imread("/usr/share/edgetpu/examples/images/parrot.jpg" ,0)
cv2.imshow(‘image’,img)

but still an error if I try to display a stream video:

[ WARN:0] global /home/ubuntu/opencv/modules/videoio/src/cap_gstreamer.cpp (933) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
Unable to init server: Could not connect: Connection refused

Hi,

Looks like the issues with image display and gst-launch are now fixed, and the gstreamer pipeline that Opencv constructs is not able to play that video file.

Are you able to play the same video file with the gst-launch example? Or are you trying to display a video feed from the camera?

I tried to display a video sample of mine and get the following output:

root@2c77110:/usr/src/app# gst-launch-1.0 playbin uri=file:/usr/src/app/file_example_MP4_480_1_5MG.mp4 video-sink=waylandsink

Setting pipeline to PAUSED …
Pipeline is PREROLLING …
Missing element: H.264 (Constrained Baseline Profile) decoder
WARNING: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: No decoder available for type ‘video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)3, profile=(string)constrained-baseline, codec_data=(buffer)0142c01effe100196742c01ed901e08feb0110000003001000000303c0f162e48001000468cb8cb2, width=(int)480, height=(int)270, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true’.
Additional debug info:
gsturidecodebin.c(921): unknown_type_cb (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0
AL lib: (EE) ALCplaybackAlsa_reset: snd_pcm_hw_params(self->pcmHandle, hp) failed: File descriptor in bad state
ERROR: from element /GstPlayBin:playbin0/GstPlaySink:playsink/GstBin:abin/GstOpenALSink:openalsink0: Unable to prepare device.
Additional debug info:
gstopenalsink.c(859): gst_openal_sink_prepare (): /GstPlayBin:playbin0/GstPlaySink:playsink/GstBin:abin/GstOpenALSink:openalsink0:
ALC error: Invalid Device
ERROR: pipeline doesn’t want to preroll.
Setting pipeline to NULL …
Freeing pipeline …

Initially, I would like to display stream video from my camera for the google bodypix project:

Hi,

Can you please pull the updated example? I updated it a few hours ago (see https://github.com/balena-io-examples/google-coral-dev-sample/commits/master) to install gstreamer audio dependencies and start pulse. After pulling the update, please un-comment all packages that are commented, commit the changes and then push the application again.

I think I found the video test sample you mentioned and it works for me with the updated example. But you will need to pull the latest changes entirely in the the test app. Please see below:

root@363e235:/usr/src/app# wget https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4

root@363e235:/usr/src/app# gst-launch-1.0 playbin uri=file:/usr/src/app/file_example_MP4_480_1_5MG.mp4 video-sink=waylandsink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstAudioSinkClock
Got EOS from element "playbin0".
Execution ended after 0:00:30.521618326
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

Please let me know if gst-launch works for you if you follow the steps above.

Hi,

Yes that’s working for me now thanks. I can display a video with gst-launch-1.0
and stream video from my camera with opencv. I just have to deal a problem with gstreamer now from my python script to display my stream video. Is it possible ? Because I cannot launch a pipeline:

print(pipeline):

v4l2src device=/dev/video1 ! video/x-raw,width=480,height=640,framerate=30/1 ! queue max-size-buffers=1 leaky=downstream
! decodebin ! glupload ! glvideoflip video-direction=identity ! queue max-size-buffers=1 leaky=downstream
! glfilterbin filter=glbox name=glbox ! video/x-raw,format=RGB,width=480,height=640 ! appsink name=appsink sync=false emit-signals=true max-buffers=1 drop=true

pipeline = Gst.parse_launch(pipeline)

Results in:
gi.repository.GLib.Error: gst_parse_error: could not set property “filter” in element “glfilterbin0” to “glbox” (4)

Hi @thibault

Looks like the glbox filter is a python plugin for gstreamer.

I have updated the example but you can also install the package manually for testing:

apt-get install python3-edgetpuvision

After this, you will need to

export XDG_RUNTIME_DIR=/tmp/

You can then git clone the bodypix or the posenet projects, execute the install_requirements.sh script and run the examples from there or re-use or adapt their gstreamer pipelines.

1 Like

Hi,

It’s perfectly working for me now thank you very much for the help :grinning: :+1:

Thanks for confirming, great to hear your setup works fine now!