Package: motion Version: 3.2.12+git20140228-8build1 Severity: normal Dear Maintainer,
I've tried using motion as a systemd service, the problem is that it seems to die as soon as I start it. I suspect this the following things are stopping it running correctly: - the package doesn't set '/var/log/motion/' to be owned by 'motion', which means the daemon can't write to its log file and dies motion[26465]: [17281408] [EMG] [ALL] motion_startup: Exit motion, cannot create log file /var/log/motion/motion.log: Permission denied - the package doesn't set /var/run/motion to be owned by motion: [14111104] [ERR] [ALL] [Dec 30 09:40:33] myfopen: Error opening file /var/run/motion/motion.pid with mode w+: Permission denied [14111104] [EMG] [ALL] [Dec 30 09:40:33] become_daemon: Exit motion, cannot create process id file (pid file) /var/run/motion/motion.pid: Permission denied - motion doesn't look for the configuration file /etc/motion/motion.conf, it actually looks for /etc/motion.conf - I could resolve this with a symlink sudo ln /etc/motion/motion.conf /etc/motion.conf tim@localhost:~$ systemctl status motion ● motion.service - LSB: Start Motion detection Loaded: loaded (/etc/init.d/motion; bad; vendor preset: enabled) Active: active (exited) since Fri 2016-12-30 09:40:33 AEDT; 4h 21min ago Docs: man:systemd-sysv-generator(8) Process: 26496 ExecStop=/etc/init.d/motion stop (code=exited, status=0/SUCCESS) Process: 26504 ExecStart=/etc/init.d/motion start (code=exited, status=0/SUCCESS) Tasks: 0 Memory: 0B CPU: 0 Dec 30 09:40:32 localhost systemd[1]: Starting LSB: Start Motion detection... Dec 30 09:40:33 localhost motion[26504]: * Starting motion detection daemon motion Dec 30 09:40:33 localhost motion[26504]: ...done. Dec 30 09:40:33 localhost systemd[1]: Started LSB: Start Motion detection. Dec 30 09:40:33 localhost motion[26511]: [14111104] [NTC] [ALL] conf_load: Processing thread 0 - co Dec 30 09:40:33 localhost motion[26511]: [14111104] [NTC] [ALL] motion_startup: Motion 3.2.12+git20 Dec 30 09:40:33 localhost motion[26511]: [14111104] [NTC] [ALL] motion_startup: Logging to file (/v -- System Information: Debian Release: stretch/sid APT prefers xenial-updates APT policy: (500, 'xenial-updates'), (500, 'xenial-security'), (500, 'xenial'), (100, 'xenial-backports') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.4.0-57-generic (SMP w/2 CPU cores) Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages motion depends on: ii adduser 3.113+nmu3ubuntu4 ii debconf [debconf-2.0] 1.5.58ubuntu1 ii libavcodec-ffmpeg-extra56 7:2.8.10-0ubuntu0.16.04.1 ii libavfilter-ffmpeg5 7:2.8.10-0ubuntu0.16.04.1 ii libavformat-ffmpeg56 7:2.8.10-0ubuntu0.16.04.1 ii libavutil-ffmpeg54 7:2.8.10-0ubuntu0.16.04.1 ii libc6 2.23-0ubuntu5 ii libjpeg8 8c-2ubuntu8 ii libmysqlclient20 5.7.16-0ubuntu0.16.04.1 ii libpq5 9.5.5-0ubuntu0.16.04 ii libsdl1.2debian 1.2.15+dfsg1-3 ii libsqlite3-0 3.11.0-1ubuntu1 Versions of packages motion recommends: ii ffmpeg 7:2.8.10-0ubuntu0.16.04.1 Versions of packages motion suggests: pn mysql-client <none> pn postgresql-client <none> -- Configuration Files: /etc/default/motion changed: start_motion_daemon=yes /etc/motion/motion.conf changed: daemon on process_id_file /var/run/motion/motion.pid setup_mode off logfile /var/log/motion/motion.log log_level 6 log_type all videodevice /dev/video1 v4l2_palette 17 ; tunerdevice /dev/tuner0 input -1 norm 0 frequency 0 rotate 0 width 1280 height 960 framerate 1 minimum_frame_time 3 ; netcam_url value ; netcam_userpass value netcam_keepalive off ; netcam_proxy value netcam_tolerant_check off auto_brightness off brightness 100 contrast 0 saturation 0 hue 0 roundrobin_frames 1 roundrobin_skip 1 switchfilter off threshold 1500 threshold_tune off noise_level 32 noise_tune on despeckle_filter EedDl ; area_detect value ; mask_file value smart_mask_speed 0 lightswitch 0 minimum_motion_frames 1 pre_capture 0 post_capture 0 event_gap 60 max_movie_time 0 emulate_motion off output_pictures on output_debug_pictures off quality 75 picture_type jpeg ffmpeg_output_movies on ffmpeg_output_debug_movies off ffmpeg_timelapse 0 ffmpeg_timelapse_mode daily ffmpeg_bps 500000 ffmpeg_variable_bitrate 0 ffmpeg_video_codec mpeg4 ffmpeg_deinterlace off sdl_threadnr 0 use_extpipe off ;extpipe mencoder -demuxer rawvideo -rawvideo w=320:h=240:i420 -ovc x264 -x264encopts bframes=4:frameref=1:subq=1:scenecut=-1:nob_adapt:threads=1:keyint=1000:8x8dct:vbv_bufsize=4000:crf=24:partitions=i8x8,i4x4:vbv_maxrate=800:no-chroma-me -vf denoise3d=16:12:48:4,pp=lb -of avi -o %f.avi - -fps %fps snapshot_interval 0 locate_motion_mode off locate_motion_style box text_right %Y-%m-%d\n%T-%q ; text_left CAMERA %t text_changes off text_event %Y%m%d%H%M%S text_double off ;exif_text %i%J/%K%L target_dir /home/tim/Downloads/motion snapshot_filename %v-%Y%m%d%H%M%S-snapshot picture_filename %v-%Y%m%d%H%M%S-%q movie_filename %v-%Y%m%d%H%M%S timelapse_filename %Y%m%d-timelapse ipv6_enabled off stream_port 8081 stream_quality 50 stream_motion off stream_maxrate 1 stream_localhost on stream_limit 0 stream_auth_method 0 ; stream_authentication username:password webcontrol_port 8080 webcontrol_localhost on webcontrol_html_output on ; webcontrol_authentication username:password track_type 0 track_auto off ;track_port /dev/ttyS0 ;track_motorx 0 ;track_motorx_reverse 0 ;track_motory 1 ;track_motory_reverse 0 ;track_maxx 200 ;track_minx 50 ;track_maxy 200 ;track_miny 50 ;track_homex 128 ;track_homey 128 track_iomojo_id 0 track_step_angle_x 10 track_step_angle_y 10 track_move_wait 10 track_speed 255 track_stepsize 40 quiet on on_event_start adb shell "input keyevent KEYCODE_CAMERA" ; on_event_end value ; on_picture_save value ; on_motion_detected value ; on_area_detected value ; on_movie_start value ; on_movie_end value ; on_camera_lost value ; sql_log_picture on ; sql_log_snapshot on ; sql_log_movie off ; sql_log_timelapse off ; sql_query insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C') ; database_type value ; database_dbname value ; database_host value ; database_user value ; database_password value ; database_port value ; sqlite3_db value ; video_pipe value ; motion_video_pipe value ; thread /etc/motion/thread1.conf ; thread /etc/motion/thread2.conf ; thread /etc/motion/thread3.conf ; thread /etc/motion/thread4.conf -- debconf information: motion/moved_conf_dir: