Comment 0 for bug 1946521

Revision history for this message
Bruce Duncan (bwduncan) wrote : motion fails to start after install: Permission denied creating log file

I installed motion for the first time on a reasonably fresh Kubuntu 21.04 release. I installed this system in April 2021. It immediately fails and spams "emergency" log messages all over my terminals. (See dpkg log below)

The problem seems to be that the default config /etc/motion/motion.conf specifies:

log_file /var/log/motion/motion.log

but there is nothing to create that directory. I'm not sure whether this should be a job for postinst, or a systemd ExecStartPre, but I would argue that not logging to a file at all and letting systemd-journald hoover up the stderr/syslog messages would be better.

Indeed, if I remove the log_file line from /etc/motion/motion.conf, motion starts and runs perfectly well, and I get log messages in systemctl status.

Thanks,
Bruce

Dpkg log:

Setting up motion (4.3.2-1) ...
Adding group `motion' (GID 134) ...
Done.
Warning: The home dir /var/lib/motion you specified already exists.
Adding system user `motion' (UID 127) ...
Adding new user `motion' (UID 127) with group `motion' ...
The home directory `/var/lib/motion' already exists. Not copying from `/etc/skel'.
adduser: Warning: The home directory `/var/lib/motion' does not belong to the user you are currently creating.
Adding user `motion' to group `video' ...
Adding user motion to group video
Done.
Created symlink /etc/systemd/system/multi-user.target.wants/motion.service → /lib/systemd/system/motion.service.
Processing triggers for man-db (2.9.4-2) ...

Broadcast message from systemd-journald@w7700 (Fri 2021-10-08 01:05:54 BST):

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