camera not working with gst-launch command (onboard camera)

We used this command to use the onboard camera of jetson tx2:

gst-launch-1.0 nvcamerasrc ! 'video/x-raw(memory:NVMM),width=640,height=480,framerate=30/1,format=NV12' ! nvvidconv flip-method=2 ! nvegltransform ! nveglglessink -e

it worked initially but thereafter everytime when we use this command we get error that the pipeline does not want to pause
this is the output of the command:

Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
Got context from element 'eglglessink0': gst.egl.EGLDisplay=context, display=(GstEGLDisplay)NULL;
Setting pipeline to NULL ...
Freeing pipeline ...

Please tell me how to solve the error!
And also if there is any other way i can use the onboard camera for real time face recognition using python?

What has changed when it has stopped working ?

Are you locally logged in with GUI running on a local monitor ?

egl sink needs a display but it seems it has none.

If running remotely with ssh, you may use ssh -Y to get the egl window on host.

Yes we are logged in locally, and not using ssh.
Also not just with eglsink but also other options of sink we have tried but still the same error comes.

What gives:

echo $DISPLAY
sha1sum -c /etc/nv_tegra_release
echo $display

gives me

:0

and

sha1sum -c /etc/nv_tegra_release

gives me

/usr/lib/aarch64-linux-gnu/libv4l/plugins/libv4l2_nvvideocodec.so: OK
/usr/lib/aarch64-linux-gnu/libv4l/plugins/libv4l2_nvvidconv.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvomx.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnveglstreamproducer.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvtx_helper.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvddk_vic.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libglx.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libargus_socketserver.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmmlite.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvddk_2d_v2.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvwinsys.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libargus.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmm.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvjpeg.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvexif.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvdc.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvavp.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvtestresults.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libargus_socketclient.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmm_utils.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvfnet.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvll.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcameratools.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvapputil.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnveglstream_camconsumer.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvrm.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcam_imageencoder.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libtegrav4l2.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvparser.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvtvmr.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvrm_gpu.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvtnr.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcamerautils.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvidia-egl-wayland.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvfnetstoredefog.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvodm_imager.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmmlite_utils.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcolorutil.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmmlite_video.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmmlite_image.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmm_contentpipe.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvimp.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvos.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvrm_graphics.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmedia.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvfnetstorehdfx.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvomxilclient.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcamlog.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmm_parser.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libscf.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvosd.so: OK
/usr/lib/xorg/modules/drivers/nvidia_drv.so: OK
/usr/lib/xorg/modules/extensions/libglx.so: OK

It looks OK. Do you have any idea about what has changed when it stopped working ?

I would suggest to try:

  • Fresh boot (do not launch any command related to camera).
  • Launch a terminal with
tail --follow /var/log/syslog
  • Launch another terminal for gst-launch

You will see some logs from syslog when you launch gstreamer pipeline. You may post these here.

this what i get

Mar 23 15:57:38 tegra-ubuntu rc.local[1012]: Reading package lists...
Mar 23 15:57:38 tegra-ubuntu gnome-session[1587]: Error: Can't initialize nvrm channel
Mar 23 15:57:38 tegra-ubuntu gnome-session[1587]: message repeated 38 times: [ Error: Can't initialize nvrm channel]
Mar 23 15:57:38 tegra-ubuntu systemd-timesyncd[458]: Synchronized to time server 91.189.94.4:123 (ntp.ubuntu.com).
Mar 23 15:57:38 tegra-ubuntu gnome-session[1587]: Error: Can't initialize nvrm channel
Mar 23 15:57:39 tegra-ubuntu gnome-session[1587]: message repeated 17 times: [ Error: Can't initialize nvrm channel]
Mar 23 15:57:39 tegra-ubuntu rc.local[1012]: Building dependency tree...
Mar 23 15:57:39 tegra-ubuntu rc.local[1012]: Reading state information...
Mar 23 15:57:39 tegra-ubuntu gnome-session[1587]: Error: Can't initialize nvrm channel
Mar 23 15:57:39 tegra-ubuntu gnome-session[1587]: message repeated 65 times: [ Error: Can't initialize nvrm channel]
Mar 23 15:57:39 tegra-ubuntu rc.local[1012]: rsync is already the newest version (3.1.1-3ubuntu1.2).
Mar 23 15:57:39 tegra-ubuntu rc.local[1012]: 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Mar 23 15:57:39 tegra-ubuntu gnome-session[1587]: Error: Can't initialize nvrm channel
Mar 23 15:57:39 tegra-ubuntu gnome-session[1587]: message repeated 8 times: [ Error: Can't initialize nvrm channel]
Mar 23 15:57:39 tegra-ubuntu rc.local[1012]: Reading package lists...
Mar 23 15:57:39 tegra-ubuntu gnome-session[1587]: Error: Can't initialize nvrm channel
Mar 23 15:57:40 tegra-ubuntu gnome-session[1587]: message repeated 74 times: [ Error: Can't initialize nvrm channel]
Mar 23 15:57:40 tegra-ubuntu rc.local[1012]: Building dependency tree...
Mar 23 15:57:40 tegra-ubuntu gnome-session[1587]: Error: Can't initialize nvrm channel
Mar 23 15:57:40 tegra-ubuntu gnome-session[1587]: message repeated 2 times: [ Error: Can't initialize nvrm channel]
Mar 23 15:57:40 tegra-ubuntu rc.local[1012]: Reading state information...
Mar 23 15:57:40 tegra-ubuntu gnome-session[1587]: Error: Can't initialize nvrm channel
Mar 23 15:57:41 tegra-ubuntu gnome-session[1587]: message repeated 110 times: [ Error: Can't initialize nvrm channel]
Mar 23 15:57:41 tegra-ubuntu rc.local[1012]: netcat-openbsd is already the newest version (1.105-7ubuntu1).
Mar 23 15:57:41 tegra-ubuntu rc.local[1012]: 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Mar 23 15:57:41 tegra-ubuntu gnome-session[1587]: Error: Can't initialize nvrm channel
Mar 23 15:57:41 tegra-ubuntu gnome-session[1587]: message repeated 50 times: [ Error: Can't initialize nvrm channel]
Mar 23 15:57:41 tegra-ubuntu systemd[1]: Reloading OpenBSD Secure Shell server.
Mar 23 15:57:41 tegra-ubuntu systemd[1]: Reloaded OpenBSD Secure Shell server.
Mar 23 15:57:41 tegra-ubuntu gnome-session[1587]: Error: Can't initialize nvrm channel
Mar 23 15:57:41 tegra-ubuntu gnome-session[1587]: Error: Can't initialize nvrm channel
Mar 23 15:57:41 tegra-ubuntu gnome-session[1587]: Error: Can't initialize nvrm channel
Mar 23 15:57:46 tegra-ubuntu gnome-session[1587]: message repeated 353 times: [ Error: Can't initialize nvrm channel]
Mar 23 15:57:46 tegra-ubuntu whoopsie[1013]: [15:57:46] online
Mar 23 15:57:46 tegra-ubuntu gnome-session[1587]: Error: Can't initialize nvrm channel
Mar 23 15:57:47 tegra-ubuntu gnome-session[1587]: message repeated 11 times: [ Error: Can't initialize nvrm channel]
Mar 23 15:57:48 tegra-ubuntu gnome-session[1587]: [2128:2128:0323/155748.717564:ERROR:page_load_metrics_update_dispatcher.cc(208)] Invalid first_meaningful_paint (unset) for time_to_interactive 13.833 s
Mar 23 15:57:49 tegra-ubuntu gnome-session[1587]: Error: Can't initialize nvrm channel
Mar 23 15:57:51 tegra-ubuntu gnome-session[1587]: message repeated 23 times: [ Error: Can't initialize nvrm channel]
Mar 23 15:57:51 tegra-ubuntu wpa_supplicant[1053]: wlan0: Failed to initiate sched scan
Mar 23 15:57:51 tegra-ubuntu gnome-session[1587]: Error: Can't initialize nvrm channel
Mar 23 15:57:51 tegra-ubuntu gnome-session[1587]: message repeated 2 times: [ Error: Can't initialize nvrm channel]
Mar 23 15:57:51 tegra-ubuntu systemd[1]: Reloading OpenBSD Secure Shell server.
Mar 23 15:57:51 tegra-ubuntu systemd[1]: Reloaded OpenBSD Secure Shell server.
Mar 23 15:57:52 tegra-ubuntu gnome-session[1587]: Error: Can't initialize nvrm channel
Mar 23 15:57:55 tegra-ubuntu gnome-session[1587]: message repeated 29 times: [ Error: Can't initialize nvrm channel]
Mar 23 15:57:56 tegra-ubuntu gnome-session[1587]: [2128:2128:0323/155756.707258:ERROR:page_load_metrics_update_dispatcher.cc(208)] Invalid first_meaningful_paint (unset) for time_to_interactive 13.833 s
Mar 23 15:57:59 tegra-ubuntu gnome-session[1587]: Error: Can't initialize nvrm channel
Mar 23 15:57:59 tegra-ubuntu rsyslogd-2007: action 'action 9' suspended, next retry is Fri Mar 23 15:58:29 2018 [v8.16.0 try http://www.rsyslog.com/e/2007 ]
Mar 23 15:58:00 tegra-ubuntu gnome-session[1587]: message repeated 14 times: [ Error: Can't initialize nvrm channel]
Mar 23 15:58:00 tegra-ubuntu gnome-session[1587]: [2128:2128:0323/155800.145419:ERROR:page_load_metrics_update_dispatcher.cc(208)] Invalid first_meaningful_paint (unset) for time_to_interactive 16.189 s
Mar 23 15:58:00 tegra-ubuntu gnome-session[1587]: Error: Can't initialize nvrm channel
Mar 23 15:58:05 tegra-ubuntu gnome-session[1587]: message repeated 146 times: [ Error: Can't initialize nvrm channel]

Looks you have a startup script rc.local. Can you try to deactivate it ?

I disabled the file using

chmod 600 /etc/rc.local

But still the same error comes after trying the gst command

After boot, in the terminal where you run tail --follow /var/log/syslog, press several times enter so that boot traces go up. Then you will just see the logs related to gst-launch when you’ll run it in the second terminal. Please post only these logs.

Furthermore, do you have nvcamera-deamon running ?

ps aux | grep nvcamera

Last, do you have a custom board, custom kernel or custom device-tree ?

this is the syslog;

Mar 24 18:20:38 tegra-ubuntu ofonod[928]: ofonod[928]: plugins/accounts-settings.c:get_active_seat_uid() seat seat0 with uid 1001
Mar 24 18:20:38 tegra-ubuntu ofonod[928]: ofonod[928]: plugins/accounts-settings.c:get_active_seat_uid() seat seat0 with uid 1001
Mar 24 18:20:38 tegra-ubuntu ofonod[928]: plugins/accounts-settings.c:get_active_seat_uid() seat seat0 with uid 1001
Mar 24 18:20:38 tegra-ubuntu ofonod[928]: plugins/accounts-settings.c:get_active_seat_uid() seat seat0 with uid 1001
Mar 24 18:20:38 tegra-ubuntu systemd[1]: Stopping User Manager for UID 106...
Mar 24 18:20:38 tegra-ubuntu systemd[1223]: Reached target Shutdown.
Mar 24 18:20:38 tegra-ubuntu systemd[1223]: Starting Exit the Session...
Mar 24 18:20:38 tegra-ubuntu systemd[1223]: Stopped target Default.
Mar 24 18:20:38 tegra-ubuntu systemd[1223]: Stopped target Basic System.
Mar 24 18:20:38 tegra-ubuntu ofonod[928]: plugins/accounts-settings.c:get_active_seat_uid() seat seat0 with uid 1001
Mar 24 18:20:38 tegra-ubuntu systemd[1223]: Stopped target Paths.
Mar 24 18:20:38 tegra-ubuntu ofonod[928]: ofonod[928]: plugins/accounts-settings.c:get_active_seat_uid() seat seat0 with uid 1001
Mar 24 18:20:38 tegra-ubuntu systemd[1223]: Stopped target Timers.
Mar 24 18:20:38 tegra-ubuntu systemd[1223]: Stopped target Sockets.
Mar 24 18:20:38 tegra-ubuntu systemd[1223]: Received SIGRTMIN+24 from PID 2248 (kill).
Mar 24 18:20:38 tegra-ubuntu systemd[1]: Stopped User Manager for UID 106.
Mar 24 18:20:38 tegra-ubuntu systemd[1]: Removed slice User Slice of lightdm.
Mar 24 18:20:38 tegra-ubuntu ofonod[928]: ofonod[928]: plugins/accounts-settings.c:get_active_seat_uid() seat seat0 with uid 1001
Mar 24 18:20:38 tegra-ubuntu ofonod[928]: plugins/accounts-settings.c:get_active_seat_uid() seat seat0 with uid 1001

and this is the output i get when i run ps aux | grep nvcamera

nvidia    2733  0.0  0.0   5548   492 pts/17   S+   18:24   0:00 grep --color=auto nvcamera

And no we dont have custom board or kernel or device-tree

I see nothing related to nvcamera in your log, as nvcamera-demon is not running.
You may try to launch it manually with

sudo su
/usr/sbin/nvcamera-daemon &   # then wait for a few seconds and paste here if errors are logged
exit

But further it seems your system has problems. Does it constantly issue these logs before you launch gstreamer ?
If yes, your system may be full of these logs. What gives

df -H -T

.

Do you see errors in kernel logs ?

dmesg

But i have to start the daemon manually Everytime i log in. Is there any way to keep the daemon in auto-start mode.