MotionWebcamServer plugin - Missing library
-
Just updated to 3.4.0-rc2 and noticed the MotionWebcamServer plugin - thought I'd give it a go.
However, when I try to run it the plugin never starts and theduetpluginservice
log shows:Feb 23 16:51:13 rancor DuetPluginService[651]: [error] Plugin MotionWebcamServer: /opt/dsf/plugins/MotionWebcamServer/dsf/arm/motion: error while loading shared libraries: libvchiq_arm.so: cannot open shared object file: No such file or directory
I've found a few things on the Pi forums about this file but since DuetPi is a custom build I didn't want to just go mucking about until I ran it past you... any thoughts as to why that is missing?
-
@Phaedrux any ideas?
-
@adammhaile It looks like that library is part of
libraspberrypi-dev
. Can you install it and check if you can start the plugin then (sudo apt install libraspberrypi-dev
)? -
@chrishamm apt says latest is already installed
pi@rancor:~ $ sudo apt install libraspberrypi-dev Reading package lists... Done Building dependency tree Reading state information... Done libraspberrypi-dev is already the newest version (1:1.20211201~buster-1).
-
@chrishamm
So I found where that library lives:pi@rancor:~ $ ldconfig -p | grep libvchiq_arm libvchiq_arm.so (libc6,hard-float) => /opt/vc/lib/libvchiq_arm.so
And I attempted to add that directory to my LD path for the dsf user:
dsf@rancor:~ $ echo $LD_LIBRARY_PATH :/opt/vc/lib/
But the plugin still fails with the same error - so seems to not care about LD_LIBRARY_PATH. Is there another way I can set the path for where to find libvchiq_arm for the plugin?
-
@chrishamm Is the actual source code for this plugin somwhere?
All I can find is the binaries on Github: https://github.com/Duet3D/DSF-Plugins/tree/dev/MotionWebcamServer/dsf/armWould love to dig into it more but hard to without the source.
-
@adammhaile Do you mean this? https://github.com/Motion-Project/motion It's linked in the MotionWebcamServer README file.
-
@chrishamm Ah - sorry. I missed that it was really just as simple as you running a pre-existing thing.
I'll look into it more from there - thanks! -
@adammhaile @chrishamm Any follow up on this? I've installed the plugin on 3.4 final with the same results that you had.
-
@luckyflyer Unfortunately, no - I have not been able to solve the problem.
But glad it's not just me at least?
Granted, I've also downloadedmotion
separately and was unable to get it to work... so it seems to be something wrong with the plugin per-se.
I wonder if the DuetPi base image was updated recently and made incompatible withmotion
-
@adammhaile @luckyflyer Very odd, it looks like something changed because this definitely worked for me before on another image. The problem is indeed that motion cannot open
/opt/vc/lib/libvchiq_arm.so
. To fix this, you can edit/etc/apparmor.d/dsf.MotionWebcamServer
and insert a new line below/usr/local/lib
...:/opt/vc/lib/** rm,
Then reboot the Pi or run
sudo apparmor_parser -r /etc/apparmor.d/dsf.MotionWebcamServer
and you should be able to start the plugin from DWC. -
@chrishamm I ssh into my pi and copy/paste
/etc/apparmor.d/dsf.MotionWebcamServer
I get a permission denied message.
-
@luckyflyer you'll need to use sudo to edit the file.
sudo nano /etc/apparmor.d/dsf.MotionWebcamServer
Ctrl+O to save, Ctrl+X to exit once saved
-
@adammhaile Thanks, I tried sudo but without nano but of course that didn't work either.
-
@luckyflyer why are you trying it without
nano
?As @chrishamm said:
@chrishamm said in MotionWebcamServer plugin - Missing library:
To fix this, you can edit /etc/apparmor.d/dsf.MotionWebcamServer and insert a new line below
This means you need to edit the file which is what
nano
does... you can't just "run" that file. -
I have the plugin running and have a grey screen that has a message in the top left corner "unable to open video device". I tried a different (known to work camera) with the same results. I ran
lsusb
and the ports see the camera. I'm using http://192.168.0.181:8081/0/stream Any ideas? Thanks
-
Any ideas why the grey screen?
-
@luckyflyer Your error message says "Unable to open video device" so your webcam is probably not recognized by the Pi or you don't have access to it.
Can you check if/dev/video0
exists? That's the default in the motion settings (seemotion.conf
in the System Files directory).Please run
sudo gpasswd -a dsf video
and reboot your Pi. That should fix it. -
@chrishamm I have just enabled this plugin on a brand new clean duet image install on a pi4 with v3.4. The permissions issues described above were present on the included version of the plugin, and the fix previously posted did indeed work to enable the plugin to start.
However the permissions issues seem to be deeper within the operations of the plugin.
By default the plugin cannot access /dev/video*, neither can it create a log entry in the default logging folder set in the config file (when enabled). I changed the log folder to the tmp directory and I was able to see in the logs that motion was complaining it cannot access the video* device, which results in the grey screen shown in @luckyflyer post.To prove this is a permissions problem I changed the permissions of /dev/video0 in the terminal (chmod), and the plugin was able to start with video working correctly. I looked at
/etc/apparmor.d/dsf.MotionWebcamServer
and I can see there is an entry to set the access permissions to /dev/video* in the file, but this does not seem to be working as expected.
--edit - I see you have updated your post since I started this one. I will try the proposed additional command....
-- Update 2 - Additional command worked. Also I found adding the following line to the Live Stream Configuration Parameters section in motion.conf, improved the output framerate significantly :
stream_maxrate 50
-
If anyone is interested you can show the motion "control" web page inside DWC to allow you access / change some advanced video values (brightness, size etc) in a simple gui provided by motion:
(you will need BtnCmd Plugin to do this)
Set your motion config like below:
& restart the pluginIn BtnCmd add a remote source panel:
And set the URL to
http://[pi ip]:8080/
eg:
Then resize to fit your screen and save the layout.