Send Motion-user mailing list submissions to
        motion-user@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.sourceforge.net/lists/listinfo/motion-user
or, via email, send a message with subject or body 'help' to
        motion-user-requ...@lists.sourceforge.net

You can reach the person managing the list at
        motion-user-ow...@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Motion-user digest..."


Today's Topics:

   1. Re: Daemon permissions problem writing to USB target.
      (Berto Furth)
   2. Re: Daemon permissions problem writing to USB target. (Mike Veal)


----------------------------------------------------------------------

Message: 1
Date: Tue, 12 Oct 2021 08:37:22 +1100
From: "Berto Furth" <bertofu...@sent.com>
To: "Mike Veal" <motion-user@lists.sourceforge.net>
Subject: Re: [Motion-user] Daemon permissions problem writing to USB
        target.
Message-ID: <404dca81-1351-428a-8381-76d070e40...@www.fastmail.com>
Content-Type: text/plain; charset="utf-8"

What are the permissions on /media/pi/? It looks like

>     drwxr-x---+ 3 root   root  4096 Oct 11 21:25 .
> 

Doesn't this mean that the motion user and video group won't be able to 
navigate past that directory because it doesn't have "x" permission? Only the 
root user and root group have "x" permission.

Maybe if you did a "chmod o+x /media" and "chmod o+x /media/pi/" it might help?

Good luck!

Berto.

On Tue, 12 Oct 2021, at 08:05, Mike Veal via Motion-user wrote:
> Hi,
> I'm hoping someone can help. I'm running motion on a Pi3B and I'm pulling out 
> what little hair I have left.
> 
> Motion is running perfectly in the terminal, but fails when I run the daemon. 
> Actually, the daemon starts, buf falls over when it trys to write to disk.
> 
> In motion.conf I have
>     target_dir /media/pi/Lexar/motion_output
>     picture_output on
>     picture_filename %Y%m%d/%H%M%S-%q
> 
> 
> Lexar is a USB mounted drive.
> 
> 
> And when I check permissions:
> 
>     pi@raspberrypi:/media/pi $ ls -al
>     total 12
>     drwxr-x---+ 3 root   root  4096 Oct 11 21:25 .
>     drwxr-xr-x  3 root   root  4096 Sep 28 20:41 ..
>     drwxrwxrwt  5 motion video 4096 Oct 11 21:07 Lexar
> &
> 
>     pi@raspberrypi:/media/pi/Lexar $ ls -al
>     total 72
>     drwxrwxrwt  5 motion video  4096 Oct 11 21:07 .
>     drwxr-x---+ 3 root   root   4096 Oct 11 21:25 ..
>     drwx------  2 motion video 16384 May  4  2017 lost+found
>     -rwxr-xr-x  1 motion video 30199 Sep 26 18:26 mav.conf
>     -rw-rw-rw-  1 motion video  1701 Sep 26 19:43 motion.log
>     drwxrwxrwx  2 motion video  4096 Oct 11 21:07 motion_output
>     -rw-rw-rw-  1 motion video     5 Sep 28 21:59 motion.pid
>     drwx------  4 motion video  4096 May 17  2017 .Trash-1000
> I check motion status like so:
>     ? motion.service - LSB: Start Motion detection
>        Loaded: loaded (/etc/init.d/motion; generated)
>        Active: active (running) since Mon 2021-10-11 21:39:45 BST; 13s ago
>          Docs: man:systemd-sysv-generator(8)
>       Process: 1321 ExecStart=/etc/init.d/motion start (code=exited, 
> status=0/SUCCESS)
>         Tasks: 2 (limit: 1935)
>        CGroup: /system.slice/motion.service
>                    ??1331 /usr/bin/motion
> 
>     Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [ERR] [ALL] myfopen: 
> Error opening file /media/pi/Lexar/motion_output/20211011/213952-00.jpg with 
> mode w: Permission denied
>     Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [ERR] [ALL] 
> put_picture: Can't write picture to file 
> /media/pi/Lexar/motion_output/20211011/213952-00.jpg - check access rights to 
> target directory
>                                           Thread is going to finish due to 
> this fatal error: Permission denied
>     Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [NTC] [EVT] 
> event_newfile: File of type 1 saved to: 
> /media/pi/Lexar/motion_output/20211011/213952-00.jpg
>     Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [ERR] [ALL] myfopen: 
> Error opening file /media/pi/Lexar/motion_output/20211011/213953-00.jpg with 
> mode w: Permission denied
>     Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [ERR] [ALL] 
> put_picture: Can't write picture to file 
> /media/pi/Lexar/motion_output/20211011/213953-00.jpg - check access rights to 
> target directory
>                                           Thread is going to finish due to 
> this fatal error: Permission denied
>     Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [NTC] [EVT] 
> event_newfile: File of type 1 saved to: 
> /media/pi/Lexar/motion_output/20211011/213953-00.jpg
>     Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [NTC] [ALL] 
> motion_loop: Thread exiting
>     Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [INF] [ALL] 
> motion_cleanup: Calling vid_close() from motion_cleanup
>     Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [NTC] [VID] vid_close: 
> Cleaning up V4L2 device
>     Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [NTC] [VID] 
> v4l2_cleanup: Closing video device /dev/video0
> 
> So the daemon is running as motion:video. 
> motion:video appears to have full rwx permissions in the target directory 
> (I've sudo chown'ed it) but it still thinks it can't write.
> 
> 
> Can anyone point me in the right direction please? I've searched online and 
> found this on stackoverflow:
> https://raspberrypi.stackexchange.com/questions/12378/what-permissions-does-motion-require-to-write-to-specific-directory
>  
> 
> I've followed all the directions, but nothing seems to work.
> Attached is the output when motion is run from the terminal. As you can see, 
> it's prefectly happy writing the files when it runs as user pi:pi.
> 
> 
> Many thanks,
> Mike.
> 
> _______________________________________________
> Motion-user mailing list
> Motion-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/motion-user
> https://motion-project.github.io/
> 
> Unsubscribe: https://lists.sourceforge.net/lists/options/motion-user
> 
> *Attachments:*
>  * Motion.txt
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 2
Date: Tue, 12 Oct 2021 07:46:49 +0000 (UTC)
From: Mike Veal <vealm...@yahoo.co.uk>
To: Motion discussion list <motion-user@lists.sourceforge.net>
Subject: Re: [Motion-user] Daemon permissions problem writing to USB
        target.
Message-ID: <933848419.2562703.1634024809...@mail.yahoo.com>
Content-Type: text/plain; charset="utf-8"

 Yes, it was as simple as that. Thank you Berto!

    On Monday, 11 October 2021, 22:40:53 BST, Berto Furth <bertofu...@sent.com> 
wrote:  
 
 What are the permissions on /media/pi/? It looks like


????drwxr-x---+ 3 root?? root? 4096 Oct 11 21:25 .



Doesn't this mean that the motion user and video group won't be able to 
navigate past that directory because it doesn't have "x" permission? Only the 
root user and root group have "x" permission.

Maybe if you did a "chmod o+x /media" and "chmod o+x /media/pi/" it might help?

Good luck!

Berto.
On Tue, 12 Oct 2021, at 08:05, Mike Veal via Motion-user wrote:

Hi,
I'm hoping someone can help. I'm running motion on a Pi3B and I'm pulling out 
what little hair I have left.

Motion is running perfectly in the terminal, but fails when I run the daemon. 
Actually, the daemon starts, buf falls over when it trys to write to disk.

In motion.conf I have
????target_dir /media/pi/Lexar/motion_output
????picture_output on
????picture_filename %Y%m%d/%H%M%S-%q


Lexar is a USB mounted drive.


And when I check permissions:

????pi@raspberrypi:/media/pi $ ls -al
????total 12
????drwxr-x---+ 3 root?? root? 4096 Oct 11 21:25 .
????drwxr-xr-x? 3 root?? root? 4096 Sep 28 20:41 ..
????drwxrwxrwt? 5 motion video 4096 Oct 11 21:07 Lexar
&

????pi@raspberrypi:/media/pi/Lexar $ ls -al
????total 72
????drwxrwxrwt? 5 motion video? 4096 Oct 11 21:07 .
????drwxr-x---+ 3 root?? root?? 4096 Oct 11 21:25 ..
????drwx------? 2 motion video 16384 May? 4? 2017 lost+found
????-rwxr-xr-x? 1 motion video 30199 Sep 26 18:26 mav.conf
????-rw-rw-rw-? 1 motion video? 1701 Sep 26 19:43 motion.log
????drwxrwxrwx? 2 motion video? 4096 Oct 11 21:07 motion_output
????-rw-rw-rw-? 1 motion video???? 5 Sep 28 21:59 motion.pid
????drwx------? 4 motion video? 4096 May 17? 2017 .Trash-1000
I check motion status like so:
????? motion.service - LSB: Start Motion detection
?? ????Loaded: loaded (/etc/init.d/motion; generated)
?? ????Active: active (running) since Mon 2021-10-11 21:39:45 BST; 13s ago
???? ????Docs: man:systemd-sysv-generator(8)
? ????Process: 1321 ExecStart=/etc/init.d/motion start (code=exited, 
status=0/SUCCESS)
??? ????Tasks: 2 (limit: 1935)
?? ????CGroup: /system.slice/motion.service
?????????????????? ??1331 /usr/bin/motion

????Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [ERR] [ALL] myfopen: 
Error opening file /media/pi/Lexar/motion_output/20211011/213952-00.jpg with 
mode w: Permission denied
????Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [ERR] [ALL] put_picture: 
Can't write picture to file 
/media/pi/Lexar/motion_output/20211011/213952-00.jpg - check access rights to 
target directory
????????????????????????????????????????? Thread is going to finish due to this 
fatal error: Permission denied
????Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [NTC] [EVT] 
event_newfile: File of type 1 saved to: 
/media/pi/Lexar/motion_output/20211011/213952-00.jpg
????Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [ERR] [ALL] myfopen: 
Error opening file /media/pi/Lexar/motion_output/20211011/213953-00.jpg with 
mode w: Permission denied
????Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [ERR] [ALL] put_picture: 
Can't write picture to file 
/media/pi/Lexar/motion_output/20211011/213953-00.jpg - check access rights to 
target directory
????????????????????????????????????????? Thread is going to finish due to this 
fatal error: Permission denied
????Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [NTC] [EVT] 
event_newfile: File of type 1 saved to: 
/media/pi/Lexar/motion_output/20211011/213953-00.jpg
????Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [NTC] [ALL] motion_loop: 
Thread exiting
????Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [INF] [ALL] 
motion_cleanup: Calling vid_close() from motion_cleanup
????Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [NTC] [VID] vid_close: 
Cleaning up V4L2 device
????Oct 11 21:39:54 raspberrypi motion[1331]: [1:ml1] [NTC] [VID] v4l2_cleanup: 
Closing video device /dev/video0

So the daemon is running as motion:video. 
motion:video appears to have full rwx permissions in the target directory (I've 
sudo chown'ed it) but it still thinks it can't write.


Can anyone point me in the right direction please? I've searched online and 
found this on stackoverflow:
https://raspberrypi.stackexchange.com/questions/12378/what-permissions-does-motion-require-to-write-to-specific-directory
 

I've followed all the directions, but nothing seems to work.
Attached is the output when motion is run from the terminal. As you can see, 
it's prefectly happy writing the files when it runs as user pi:pi.


Many thanks,
Mike.

_______________________________________________
Motion-user mailing list
Motion-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/motion-user
https://motion-project.github.io/

Unsubscribe:?https://lists.sourceforge.net/lists/options/motion-user

Attachments:
   
   - Motion.txt   



_______________________________________________
Motion-user mailing list
Motion-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/motion-user
https://motion-project.github.io/

Unsubscribe: https://lists.sourceforge.net/lists/options/motion-user  
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------



------------------------------

Subject: Digest Footer

_______________________________________________
Motion-user mailing list
Motion-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/motion-user


------------------------------

End of Motion-user Digest, Vol 184, Issue 3
*******************************************

Reply via email to