scratchuser
Posts: 25
Joined: Wed Jul 10, 2013 9:25 pm

motion failing to start as daemon or interactive

Wed Jul 10, 2013 9:37 pm

I am trying to get a webcam working with my new Pi but am having problems.

I am using these instructions: http://pingbin.com/2012/12/raspberry-pi ... er-motion/ but when it comes to running starting the daemon, I get this:

Code: Select all

[email protected] ~ $ sudo service motion start
[warn] Not starting motion daemon, disabled via /etc/default/motion ... (warning).
If I just do motion start, I get this:

Code: Select all

[email protected] ~ $ motion start
[0] could not open configfile /etc/motion/motion.conf: Permission denied
[0] Not config file to process using default values
[0] Motion 3.2.12 Started
[0] ffmpeg LIBAVCODEC_BUILD 3482368 LIBAVFORMAT_BUILD 3478785
[1] Thread 1 started
[1] cap.driver: "spca561"
[1] cap.card: "Camera"
[1] cap.bus_info: "usb-bcm2708_usb-1.3.2"
[1] cap.capabilities=0x85000001
[1] - VIDEO_CAPTURE
[1] - READWRITE
[1] - STREAMING
[1] Config palette index 8 (YU12) doesn't work.
[1] Supported palettes:
[1] 0: S561 (S561)
[1] 1: GBRG (GBRG)
[1] Unable to find a compatible palette format.
[1] ioctl (VIDIOCGCAP): Inappropriate ioctl for device
[1] Could not fetch initial image from camera
[1] Motion continues using width and height from config file(s)
[1] Resizing pre_capture buffer to 1 items
^C[1] Thread exiting
[0] Motion terminating
[email protected] ~ $ ^C
[email protected] ~ $ 
Any idea what else I need to do to get this working? Particularly as a daemon?

--- Alistair.

SirLagz
Posts: 1705
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
Contact: Website

Re: motion failing to start as daemon or interactive

Thu Jul 11, 2013 8:25 am

This line should give you an idea...

Code: Select all

[warn] Not starting motion daemon, disabled via /etc/default/motion ... (warning).
Check what's in /etc/default/motion

Code: Select all

could not open configfile /etc/motion/motion.conf: Permission denied
^ that is from starting motion as a normal user.
If you start it as root, what happens ?
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044

scratchuser
Posts: 25
Joined: Wed Jul 10, 2013 9:25 pm

Re: motion failing to start as daemon or interactive

Thu Jul 11, 2013 7:37 pm

Hmm...

====================
Summary: Service is now working but cannot connect with web-browser. Please see the end for the current situation.
====================

Here's a session trying to start it with sudo:

Code: Select all

[email protected] ~ $ sudo motion start
[0] Processing thread 0 - config file /etc/motion/motion.conf
[0] Motion 3.2.12 Started
[0] Exit motion, cannot create process id file (pid file) /var/run/motion/motion.pid: No such file or directory
[0] Motion going to daemon mode
[email protected] ~ $ sudo mkdir /var/run/motion
[email protected] ~ $ sudo motion start
[0] Processing thread 0 - config file /etc/motion/motion.conf
[0] Motion 3.2.12 Started
[0] Motion going to daemon mode
[email protected] ~ $ 
Sort of implies it is running as a daemon anyway, once I had created the /var/run/motion directory. But explicitly doing so still gets:

Code: Select all

[email protected] ~ $ sudo service motion start
[warn] Not starting motion daemon, disabled via /etc/default/motion ... (warning).
Interestingly, I just realised that the file I have been editing is /etc/motion/motion.conf, not /etc/default/motion. So...

Code: Select all

[email protected] ~ $ more /etc/default/motion
# set to 'yes' to enable the motion daemon
start_motion_daemon=no
So I have set that to 'yes' (could I also just delete the file I wonder? Anyway, now, I get:

Code: Select all

[email protected] ~ $ sudo service motion start
[ ok ] Starting motion detection daemon: motion.
Actually, I had to stop it first since my interactive attempts had already started it. But it seems now to work! Thanks for the pointers.

Now the current situation...
So the service/daemon is running. But when I try to connect to it at 192.168.1.100:8081, I get
Unable to connect
Firefox can't establish a connection to the server at 192.168.1.100:8081.


If I try port 8080, I get
Motion 3.2.12 Running [1] Threads
0


So something is running but I still get nothing on port 8081. Any further suggestions? The full motion.conf is quite large so I have attached it as motion.txt.

--- Alistair.

SirLagz
Posts: 1705
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
Contact: Website

Re: motion failing to start as daemon or interactive

Fri Jul 12, 2013 1:34 am

Are you accessing the motion stream from the Pi itself ?
Some people have had issues accessing the stream from the Pi.

Modify /etc/motion/motion.conf and allow other hosts to connect.
Change lines
webcam_localhost on
control_localhost on
to
webcam_localhost off
control_localhost off

to allow other hosts to connect.
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044

scratchuser
Posts: 25
Joined: Wed Jul 10, 2013 9:25 pm

Re: motion failing to start as daemon or interactive

Fri Jul 12, 2013 7:25 pm

Certainly getting there. control_localhost was off but webcam_localhost was on. I now have a little square in my browser window. Unfortunately, it is plain grey with a caption saying
UNABLE TO OPEN VIDEO DEVICE
SINCE 2013-07-12 19:15:31

Code: Select all

[email protected] ~ $ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 007: ID 046d:092f Logitech, Inc. QuickCam Express Plus
Bus 001 Device 004: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 005: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
[email protected] ~ $ 
So the PI can see the QuickCam, but I have not explicitely pointed motion at it. Is that in the conf file somewhere? I will have a look later.

--- Alistair.

scratchuser
Posts: 25
Joined: Wed Jul 10, 2013 9:25 pm

Re: motion failing to start as daemon or interactive

Fri Jul 12, 2013 8:18 pm

Actually, it turns out that I have pointed the motion at the camera:

Code: Select all

# Videodevice to be used for capturing  (default /dev/video0)
# for FreeBSD default is /dev/bktr0
videodevice /dev/video0
and that device file does exist. Is the QuickCam not compatible with the Raspberry PI? Is there any way of confirming that it works?

--- Alistair.

scratchuser
Posts: 25
Joined: Wed Jul 10, 2013 9:25 pm

Re: motion failing to start as daemon or interactive

Sat Jul 13, 2013 11:04 pm

Just tried with fswebcam:

Code: Select all

[email protected] ~ $ fswebcam -r 640x480 --jpeg 99 --save test1.jpg
--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
Adjusting resolution from 640x480 to 352x288.
--- Capturing frame...
Captured frame in 0.00 seconds.
--- Processing captured image...
Setting output format to JPEG, quality 99
Writing JPEG image to 'test1.jpg'.
[email protected] ~ $ 
This results in a very low-res, grainy image, just about recognisable as my lounge. So the webcam does work after a fashion. Any ideas why motion can't open it? Is it just too old and crap?

--- Alistair.

SirLagz
Posts: 1705
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
Contact: Website

Re: motion failing to start as daemon or interactive

Sun Jul 14, 2013 12:13 pm

Quite possible that the webcam is just too old...
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044

Al6lo6co6
Posts: 1
Joined: Thu Jul 18, 2013 8:58 pm

Re: motion failing to start as daemon or interactive

Fri Jul 19, 2013 1:27 am

I am also trying to run a webcam server. I have everything running the cam light is on and motion service is running how ever i cannot connect from another browser. I am using Ethernet not wireless and I have already set localhost = off what am I missing or is it a problem with my router?

User avatar
Cole_Trickle
Posts: 8
Joined: Sat Nov 09, 2013 11:40 pm

Re: motion failing to start as daemon or interactive

Wed Nov 13, 2013 1:00 am

was there ever a solution to this? I am running set up with PiCam and get the same "unable to open /dev/video0" in my motion webbrowser on port8081. I can capture using raspicam though. so I know the cam works.
ask me about Cisco....

henickr
Posts: 1
Joined: Mon Nov 25, 2013 11:55 pm

Re: motion failing to start as daemon or interactive

Mon Nov 25, 2013 11:57 pm

you need to download a special version of motion optimized to use on raspberry pi.

the device for a built in raspi cam module is /dev/vchiq not /dev/video0

nalin
Posts: 1
Joined: Sat Nov 30, 2013 7:48 am

Re: motion failing to start as daemon or interactive

Sat Nov 30, 2013 7:52 am

hi
i want to write a daemon to start video capture and send to mail

can anybody help

ChadRpi
Posts: 51
Joined: Sat Nov 02, 2013 3:29 pm

Re: motion failing to start as daemon or interactive

Sat Nov 30, 2013 1:34 pm

Hi,
Here is a tutorial that I made to setup and use motion.

http://www.youtube.com/watch?v=D537dG-ndRk

It definitely works if you follow it.

Let me know if it helps :)

gerombo
Posts: 1
Joined: Sat Dec 27, 2014 9:02 pm

Re: motion failing to start as daemon or interactive

Sat Dec 27, 2014 11:38 pm

Hi,
with a similar Logitech QuickCam I made a bit of progress on my model B with raspbmc kernel 3.12.31
I also noticed the following error messages about the missing palette.
My webcam:

Code: Select all

[email protected]:~$ lsusb | grep Logit
Bus 001 Device 007: ID 046d:092f Logitech, Inc. QuickCam Express Plus
i found a hint here:
http://www.lavrsen.dk/foswiki/bin/view/ ... x28x191448
basically you have to

Code: Select all

sudo apt-get install -y libv4l-0
and

Code: Select all

find / -iname "*libv4l*" 2>/dev/null
to find the shared object library

Code: Select all

/usr/lib/arm-linux-gnueabihf/libv4l
for debugging you can now start motion in foreground with

Code: Select all

sudo LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libv4l/v4l2convert.so motion
this works for a about a minute or two

Code: Select all

[0] Processing thread 0 - config file /etc/motion/motion.conf
[0] Motion 3.2.12 Started
[0] ffmpeg LIBAVCODEC_BUILD 3482368 LIBAVFORMAT_BUILD 3478785
[0] Thread 1 is from /etc/motion/motion.conf
[0] motion-httpd/3.2.12 running, accepting connections
[0] motion-httpd: waiting for data on port TCP 8080
[1] Thread 1 started
[1] cap.driver: "spca561"
[1] cap.card: "Camera"
[1] cap.bus_info: "usb-bcm2708_usb-1.3"
[1] cap.capabilities=0x85000001
[1] - VIDEO_CAPTURE
[1] - READWRITE
[1] - STREAMING
[1] Test palette YU12 (320x240)
[1] Using palette YU12 (320x240) bytesperlines 320 sizeimage 115200 colorspace 00000008
[1] found control 0x00980900, "Brightness", range -128,127
[1]     "Brightness", default 0, current 0
[1] found control 0x00980903, "Hue", range 1,127
[1]     "Hue", default 64, current 64
[1] found control 0x00980910, "Gamma (software)", range 500,3000
[1]     "Gamma (software)", default 1000, current 1000
[1] found control 0x00980911, "Exposure", range 1,2372
[1]     "Exposure", default 700, current 700
[1] found control 0x00980912, "Auto Gain (software)", range 0,1
[1]     "Auto Gain (software)", default 1, current 1
[1] found control 0x00980913, "Gain", range 0,255
[1]     "Gain", default 63, current 63
[1] mmap information:
[1] frames=4
[1] 0 length=16777216
[1] 1 length=16777216
[1] 2 length=16777216
[1] 3 length=16777216
[1] Using V4L2
[1] Resizing pre_capture buffer to 1 items
[1] Started stream webcam server in port 8081
[1] Resizing pre_capture buffer to 3 items
[1] File of type 8 saved to: /tmp/motion/01-20141227225526.swf
[1] File of type 1 saved to: /tmp/motion/01-20141227225525-00.jpg
[1] File of type 1 saved to: /tmp/motion/01-20141227225525-01.jpg
[1] File of type 1 saved to: /tmp/motion/01-20141227225526-00.jpg
[1] File of type 1 saved to: /tmp/motion/01-20141227225526-01.jpg
[1] File of type 1 saved to: /tmp/motion/01-20141227225527-00.jpg
[0] httpd - Read from client
[0] httpd - Read from client
[0] httpd - Read from client
[0] httpd - Read from client
[1] File of type 2 saved to: /tmp/motion/01-20141227225559-snapshot.jpg
[0] httpd - Read from client
after that motion is killed

Code: Select all

libv4l2: error dequeuing buf: Input/output error
*** glibc detected *** motion: malloc(): memory corruption: 0x01e75300 ***
restarting motion results in a broken pipe. I had to unplug the webcam and plug it back in order to restart motion

Code: Select all

libv4l2: error turning on stream: Broken pipe
[1] Error starting stream VIDIOC_STREAMON: Broken pipe
[1] ioctl (VIDIOCGCAP): Inappropriate ioctl for device
libv4l2: warning v4l2 mmap buffers still mapped on close()
Note: when preloading v4l1compat.so instead of v4l2convert.so the raspberry became unreachable and kernel messages piled up in /var/log/messages

Code: Select all

Message from [email protected] at Dec 27 22:57:00 ...
 kernel:Internal error: Oops: 17 [#1] PREEMPT ARM

Message from [email protected] at Dec 27 22:57:00 ...
 kernel:Process CECAdapter (pid: 1053, stack limit = 0xd4e2e1b8)

Message from [email protected] at Dec 27 22:57:00 ...
 kernel:Stack: (0xd4e2fd0c to 0xd4e30000)

Message from [email protected] at Dec 27 22:57:00 ...
 kernel:fd00:                            462a1244 00000031 d4473f24 d4e2fd4c d4e2fd28

Message from [email protected] at Dec 27 22:57:00 ...
 kernel:fd20: c027e9c8 c027b774 00000031 46294ef4 00000031 0000c350 00000000 d4e2fe18

Message from [email protected] at Dec 27 22:57:00 ...
 kernel:fd40: d4e2fd9c d4e2fd50 c0043a94 c027e968 c0281348 c0280388 00000003 0000000a

Message from [email protected] at Dec 27 22:57:00 ...
 kernel:fd60: 20000013 00000000 c001a4c8 c005c7b4 2b1d020b 0000c350 00000000 d4e2fe5c
for completeness and inbound search queries, /var/log/messages when plugging in the webcam

Code: Select all

Dec 27 21:58:28 raspbmc kernel: usb 1-1.3: new full-speed USB device number 7 using dwc_otg
Dec 27 21:58:28 raspbmc kernel: usb 1-1.3: New USB device found, idVendor=046d, idProduct=092f
Dec 27 21:58:28 raspbmc kernel: usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Dec 27 21:58:28 raspbmc kernel: usb 1-1.3: Product: Camera
Dec 27 21:58:28 raspbmc kernel: usb 1-1.3: Manufacturer:
Dec 27 21:58:28 raspbmc kernel: gspca_main: spca561-2.14.0 probing 046d:092f
Dec 27 21:58:28 raspbmc kernel: input: spca561 as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/input/input2

pzoco
Posts: 1
Joined: Sun Feb 22, 2015 11:36 am

Re: motion failing to start as daemon or interactive

Sun Feb 22, 2015 11:38 am

I have not read the entire thread. - I'll just answer what I've done to fix this:

Error is:
[email protected] ~ $ sudo service motion start
[warn] Not starting motion daemon, disabled via /etc/default/motion ... (warning).

Change the file: /etc/init.d/motion

Find line: DEFAULTS=/etc/default/$NAME
Replace with #DEFAULTS=/etc/default/$NAME

Save and run "service motion start"

I have no idea if this is the best solution, but it was definitely a quick fix.

Cheers

rodmosh
Posts: 1
Joined: Sun Feb 09, 2014 5:22 pm

Re: motion failing to start as daemon or interactive

Fri Mar 18, 2016 10:04 pm

It works in Ubuntu fine,

pzoco wrote:I have not read the entire thread. - I'll just answer what I've done to fix this:

Error is:
[email protected] ~ $ sudo service motion start
[warn] Not starting motion daemon, disabled via /etc/default/motion ... (warning).

Change the file: /etc/init.d/motion

Find line: DEFAULTS=/etc/default/$NAME
Replace with #DEFAULTS=/etc/default/$NAME

Save and run "service motion start"

I have no idea if this is the best solution, but it was definitely a quick fix.

Cheers

Fruitybit
Posts: 5
Joined: Sat Mar 05, 2016 10:05 am

Re: motion failing to start as daemon or interactive

Mon Apr 11, 2016 5:48 pm

Well, I've been playing with this- trying to get the stream viewable. Lots of others seem to be having the same problem:(
From what I can see, when installing motion, another user is set up- motion- and added to a group- video. When I start motion, the first part of the dialog shows it's unable to open the configfile, so reverts to default settings ie no stream. I cannot amend the privileges of the file, nor find/amend the user 'motion' I'm sure there must be an easy way to get it working, it detects motion/saves files etc, so I know I'm half way there! Any ideas on the user privileges issue?

mrtumnus
Posts: 2
Joined: Thu Apr 27, 2017 6:26 pm

Re: motion failing to start as daemon or interactive

Thu Apr 27, 2017 7:42 pm

pzoco wrote:I have not read the entire thread. - I'll just answer what I've done to fix this:

Error is:
[email protected] ~ $ sudo service motion start
[warn] Not starting motion daemon, disabled via /etc/default/motion ... (warning).

Change the file: /etc/init.d/motion

Find line: DEFAULTS=/etc/default/$NAME
Replace with #DEFAULTS=/etc/default/$NAME

Save and run "service motion start"

I have no idea if this is the best solution, but it was definitely a quick fix.

Cheers
No need to edit the init script. The default file itself contains the setting to fix this. Change the line in /etc/default/motion to:

Code: Select all

start_motion_daemon=yes

Return to “Beginners”