LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   motion install on raspberry pi Raspberry Pi Model B Rev 2: logging issue; howto solve? (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/motion-install-on-raspberry-pi-raspberry-pi-model-b-rev-2-logging-issue%3B-howto-solve-4175703992/)

floppy_stuttgart 11-23-2021 02:43 PM

motion install on raspberry pi Raspberry Pi Model B Rev 2: logging issue; howto solve?
 
Hello,
since my raspberry SD boot card was dead, I am reinstalling raspbian on it for making running the home observation video again.
So far achieved:
- raspberry reachable via ssh
- motion installed

uname -r
Code:

5.10.63+
parameter in /etc/motion/motion.conf
..
log_file /var/log/motion/motion.log
..

now..
sudo service motion restart
Code:

Message from syslogd@raspcamera at Nov 23 21:29:02 ...
 motion[928]: [0:motion] [EMG] [ALL] motion_startup: Exit motion, cannot create log file /var/log/motion/motion.log: Permission denied

Broadcast message from systemd-journald@raspcamera (Tue 2021-11-23 21:29:02 CET):

motion[928]: [0:motion] [EMG] [ALL] motion_startup: Exit motion, cannot create log file /var/log/motion/motion.log: Permission denied

following did not help:
(file created with
sudo mkdir motion
sudo chown root:motion motion
sudo touch /var/log/motion/motion.log
sudo chown root:motion /var/log/motion/motion.log
)

sudo chmod 666 /var/log/motion/motion.log
sudo ls -l /var/log/motion/motion.log

Code:

-rw-rw-rw- 1 root motion 0 23. Nov 21:19 /var/log/motion/motion.log
Any suggestion/advice/comment is welcome.

business_kid 11-24-2021 04:21 AM

Quote:

Originally Posted by floppy_stuttgart
cannot create log file /var/log/motion/motion.log: Permission denied

Just looking at the error, something is wrong with the permissions. The 'sudo' should overcome it, but obviously is not doing it. The first thing I'd try is
Code:

sudo chmod 4755 /path/to/motion_executable
Also, I'd run a check on the log file.

floppy_stuttgart 11-24-2021 05:33 AM

first: done. issue still there. See at bottom.

second: "I'd run a check on the log file." this?..
sudo ls -l /var/log/motion/motion.log
Code:

-rw-rw-rw- 1 motion motion 0 23. Nov 21:19 /var/log/motion/motion.log

sudo ls -l /bin/motion
-rwxr-xr-x 1 root root 315668 15. Nov 2020 /bin/motion
sudo chmod 4755 /bin/motion
sudo ls -l /bin/motion
-rwsr-xr-x 1 root root 315668 15. Nov 2020 /bin/motion

sudo service motion restart

Code:

Message from syslogd@raspcamera at Nov 24 12:29:50 ...
 motion[1782]: [0:motion] [EMG] [ALL] motion_startup: Exit motion, cannot create log file /var/log/motion/motion.log: Permission denied

Broadcast message from systemd-journald@raspcamera (Wed 2021-11-24 12:29:50 CET):

motion[1782]: [0:motion] [EMG] [ALL] motion_startup: Exit motion, cannot create log file /var/log/motion/motion.log: Permission denied


business_kid 11-24-2021 08:53 AM

You don't need me to say, but that all looks good.

Code:

sudo service motion restart
That's a systemd script, at a guess. Better grok that.

I'd also touch the log file, or otherwise write to it, to check that's possible. lastly, have you just run the moition file directly?

floppy_stuttgart 11-24-2021 09:47 AM

error gone after
Quote:

sudo mkdir /tmp/motion
sudo chown motion:motion /tmp/motion
sudo touch /tmp/motion/motion.log
sudo chown motion:motion /tmp/motion/motion.log
and putting "log_file /tmp/motion/motion.log" in
Quote:

/etc/motion/motion.conf
Quote:

sudo service motion restart

business_kid 11-24-2021 10:34 AM

Motion must be dropping it's privileges. Glad you sorted it. Mark this solved.

HappyTux 11-24-2021 11:06 AM

Quote:

Originally Posted by floppy_stuttgart (Post 6304002)
error gone after

and putting "log_file /tmp/motion/motion.log" in

Depending on how your distro handles the /tmp that has the possibility of disappearing on reboot, if it cleans the /tmp by default. Since you mention Pi that is most likely Debian based and that definitely cleans it, I always put my temporary stuff there I care little about sticking around on the system if I forget to delete them, just so they will be deleted.

https://serverfault.com/questions/37...mp-get-cleared

jeffsrey 02-27-2024 10:09 PM

Success!
 
Thank you, this worked perfectly for me. I created an account as a result.


All times are GMT -5. The time now is 01:01 AM.