[Bug 1946521] [NEW] [SRU] motion fails to start after install: Permission denied creating log file
Launchpad Bug Tracker
1946521 at bugs.launchpad.net
Tue Mar 5 22:17:32 UTC 2024
You have been subscribed to a public bug by Sudip Mukherjee (sudipmuk):
[ Impact ]
motion will fail to start after installing with the error:
motion[4536]: [0:motion] [EMG] [ALL] motion_startup: Exit motion, cannot
create log file /var/log/motion/motion.log: Permission denied
Also, service status will show:
$ systemctl status motion.service
○ motion.service - Motion detection video capture daemon
Loaded: loaded (/usr/lib/systemd/system/motion.service; enabled; preset: enabled)
Active: inactive (dead) since Tue 2024-03-05 21:47:35 GMT; 1min 16s ago
Duration: 91ms
Docs: man:motion(1)
Process: 4536 ExecStart=/usr/bin/motion (code=exited, status=0/SUCCESS)
Main PID: 4536 (code=exited, status=0/SUCCESS)
CPU: 49ms
Mar 05 21:47:34 sudip-pc-i440fx-7-2 systemd[1]: Started motion.service - Motion detection video capture daemon.
Mar 05 21:47:34 sudip-pc-i440fx-7-2 motion[4536]: [0:motion] [NTC] [ALL] conf_load: Processing thread 0 - config file /etc/motion/motion.conf
Mar 05 21:47:34 sudip-pc-i440fx-7-2 motion[4536]: [0:motion] [NTC] [ALL] conf_load: Processing thread 0 - config file /etc/motion/motion.conf
Mar 05 21:47:34 sudip-pc-i440fx-7-2 motion[4536]: [0:motion] [ERR] [ALL] mycreate_path: Problem creating directory /var/log/motion: Permission denied
Mar 05 21:47:34 sudip-pc-i440fx-7-2 motion[4536]: [0:motion] [EMG] [ALL] motion_startup: Exit motion, cannot create log file /var/log/motion/motion.log: Permission denied
Mar 05 21:47:34 sudip-pc-i440fx-7-2 motion[4536]: [0:motion] [ERR] [ALL] mycreate_path: Problem creating directory /var/log/motion: Permission denied
Mar 05 21:47:34 sudip-pc-i440fx-7-2 motion[4536]: [0:motion] [EMG] [ALL] motion_startup: Exit motion, cannot create log file /var/log/motion/motion.log: Permission denied
Mar 05 21:47:35 sudip-pc-i440fx-7-2 systemd[1]: motion.service: Deactivated successfully.
Any attempt to start or restart the service will still fail.
$ sudo systemctl start motion.service
Broadcast message from systemd-journald at sudip-pc-i440fx-7-2 (Tue
2024-03-05 21:49:44 GMT):
motion[4621]: [0:motion] [EMG] [ALL] motion_startup: Exit motion, cannot
create log file /var/log/motion/motion.log: Permission denied
The problem will be there until the /var/log/motion directory is
created. A non-technical user will see "motion" is not working.
[ Test Plan ]
1. Install motion
2. Check motion service status and confirm its started
With the fixed package, motion service status will shows it has started.
[ Where problems could occur ]
It does not change any part of the code, only change is in the postinst
script to create the log folder if it does not exist. There should not
be any regression in the software for this change.
[ Other Info ]
The log folder creation was part of the init scripts at https://git.launchpad.net/ubuntu/+source/motion/tree/debian/motion.init?h=ubuntu/focal#n60
I guess it was missed while updating the package to use systemd services.
The error will not be seen by users upgrading from Focal.
[ Original Bug Description ]
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 at 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
** Affects: motion (Ubuntu)
Importance: Undecided
Status: Confirmed
** Affects: motion (Ubuntu Jammy)
Importance: Undecided
Status: Confirmed
** Affects: motion (Ubuntu Mantic)
Importance: Undecided
Status: Confirmed
** Affects: motion (Ubuntu Noble)
Importance: Undecided
Status: Confirmed
--
[SRU] motion fails to start after install: Permission denied creating log file
https://bugs.launchpad.net/bugs/1946521
You received this bug notification because you are a member of Ubuntu Sponsors, which is subscribed to the bug report.
More information about the Ubuntu-sponsors
mailing list