Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't start at systemd #152

Closed
lyj0309 opened this issue Jul 26, 2023 · 10 comments
Closed

Can't start at systemd #152

lyj0309 opened this issue Jul 26, 2023 · 10 comments

Comments

@lyj0309
Copy link

lyj0309 commented Jul 26, 2023

What happened

When i start the pc, the crowsnest.service is failed ,and i can't see it in web

systemctl status crowsnest.service 
● crowsnest.service - crowsnest - Multi Webcam/Streamer Control Deamon
   Loaded: loaded (/etc/systemd/system/crowsnest.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2023-07-26 09:21:44 HKT; 6min ago
     Docs: https://github.com/mainsail-crew/crowsnest
  Process: 5917 ExecStart=/usr/local/bin/crowsnest $CROWSNEST_ARGS (code=exited, status=1/FAILURE)
 Main PID: 5917 (code=exited, status=1/FAILURE)

Jul 26 09:21:44 mkspi systemd[1]: crowsnest.service: Service RestartSec=5s expired, scheduling restart.
Jul 26 09:21:44 mkspi systemd[1]: crowsnest.service: Scheduled restart job, restart counter is at 10.
Jul 26 09:21:44 mkspi systemd[1]: Stopped crowsnest - Multi Webcam/Streamer Control Deamon.
Jul 26 09:21:44 mkspi systemd[1]: crowsnest.service: Start request repeated too quickly.
Jul 26 09:21:44 mkspi systemd[1]: crowsnest.service: Failed with result 'exit-code'.
Jul 26 09:21:44 mkspi systemd[1]: Failed to start crowsnest - Multi Webcam/Streamer Control Deamon.

What did you expect to happen

see it in web.

How to reproduce

cat /home/mks/printer_data/systemd/crowsnest.env
CROWSNEST_ARGS="-c /home/mks/printer_data/config/crowsnest.conf"
root@mkspi:/home/mks# cat /etc/systemd/system/crowsnest.service
#### crowsnest - A webcam Service for multiple Cams and Stream Services.
####
#### Written by Stephan Wendel aka KwadFan <[email protected]>
#### Copyright 2021 - 2022
#### https://github.com/mainsail-crew/crowsnest
####
#### This File is distributed under GPLv3
####

[Unit]
Description=crowsnest - Multi Webcam/Streamer Control Deamon
Documentation=https://github.com/mainsail-crew/crowsnest
After=udev.service network-online.target nss-lookup.target
Wants=udev.service network-online.target
Before=nginx.service
StartLimitBurst=10
StartLimitIntervalSec=180

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
User=mks
RemainAfterExit=Yes
WorkingDirectory=/home/mks/crowsnest
EnvironmentFile=/home/mks/printer_data/systemd/crowsnest.env
ExecStart= /usr/local/bin/crowsnest $CROWSNEST_ARGS
Restart=on-failure
RestartSec=5

Additional information

I can start it ok with manually on terminal , but can't start with systemd

start it with manually

/bin/bash /usr/local/bin/crowsnest -c /home/mks/printer_data/config/crowsnest.conf
[07/26/23 09:35:30] crowsnest: crowsnest - A webcam Service for multiple Cams and Stream Services.
[07/26/23 09:35:30] crowsnest: Version: v3.0.7-3-g20ed6a8
[07/26/23 09:35:30] crowsnest: Prepare Startup ...
[07/26/23 09:35:30] crowsnest: INFO: Host information:
[07/26/23 09:35:30] crowsnest: Host Info: Distribution: Armbian 22.05.0-trunk Buster
[07/26/23 09:35:30] crowsnest: Host Info: Kernel: Linux 5.16.20-rockchip64 aarch64
[07/26/23 09:35:30] crowsnest: Host Info: Available CPU Cores: 4
[07/26/23 09:35:31] crowsnest: Host Info: Available Memory: 999776 kB
[07/26/23 09:35:31] crowsnest: Host Info: Diskspace (avail. / total): 1.6G / 6.8G
[07/26/23 09:35:31] crowsnest: INFO: Checking Dependencys
[07/26/23 09:35:31] crowsnest: Dependency: 'crudini' found in /usr/bin/crudini.
[07/26/23 09:35:31] crowsnest: Dependency: 'find' found in /usr/bin/find.
[07/26/23 09:35:31] crowsnest: Dependency: 'logger' found in /usr/bin/logger.
[07/26/23 09:35:31] crowsnest: Dependency: 'xargs' found in /usr/bin/xargs.
[07/26/23 09:35:31] crowsnest: Dependency: 'ffmpeg' found in /usr/local/my/ffmpeg/bin/ffmpeg.
[07/26/23 09:35:31] crowsnest: Dependency: 'ustreamer' found in bin/ustreamer/ustreamer.
[07/26/23 09:35:31] crowsnest: Dependency: 'rtsp-simple-server' found in bin/rtsp-simple-server/rtsp-simple-server.
/home/mks/crowsnest/bin/ustreamer /home/mks
[07/26/23 09:35:31] crowsnest: Version Control: ustreamer is up to date. (v4.13)
/home/mks
/home/mks/crowsnest/bin/rtsp-simple-server /home/mks
[07/26/23 09:35:31] crowsnest: Version Control: rtsp-simple-server is up to date. (v0.20.2)
/home/mks
[07/26/23 09:35:31] crowsnest: Version Control: ffmpeg new version available: 4.1.11-0+deb10u1 (git-2023-07-16-c541ecf).
[07/26/23 09:35:31] crowsnest: INFO: Print Configfile: '/home/mks/printer_data/config/crowsnest.conf'
[07/26/23 09:35:31] crowsnest:          [crowsnest]
[07/26/23 09:35:31] crowsnest:          log_path: ~/printer_data/logs/crowsnest.log
[07/26/23 09:35:31] crowsnest:          log_level: verbose
[07/26/23 09:35:31] crowsnest:          delete_log: false
[07/26/23 09:35:31] crowsnest: 
[07/26/23 09:35:31] crowsnest:          [cam 1]
[07/26/23 09:35:31] crowsnest:          mode: mjpg
[07/26/23 09:35:31] crowsnest:          port: 8080
[07/26/23 09:35:32] crowsnest:          device: /dev/video4
[07/26/23 09:35:32] crowsnest:          resolution: 1920x1080
[07/26/23 09:35:32] crowsnest:          max_fps: 30
[07/26/23 09:35:32] crowsnest:          v4l2ctl: --set-ctrl=rotate=180
[07/26/23 09:35:32] crowsnest: INFO: Detect available Devices
[07/26/23 09:35:32] crowsnest: INFO: Found 1 total available Device(s)
[07/26/23 09:35:32] crowsnest: INFO: Found 1 available camera(s)
[07/26/23 09:35:32] crowsnest: /dev/v4l/by-id/usb-SYX-230216-J_HD_Camera-video-index0 -> /dev/video4
[07/26/23 09:35:32] crowsnest: Supported Formats:
[07/26/23 09:35:32] crowsnest:          [0]: 'MJPG' (Motion-JPEG, compressed)
[07/26/23 09:35:32] crowsnest:          Size: Discrete 1280x720
[07/26/23 09:35:32] crowsnest:          Interval: Discrete 0.033s (30.000 fps)
[07/26/23 09:35:32] crowsnest:          Size: Discrete 1920x1080
[07/26/23 09:35:32] crowsnest:          Interval: Discrete 0.033s (30.000 fps)
[07/26/23 09:35:32] crowsnest:          Size: Discrete 640x480
[07/26/23 09:35:32] crowsnest:          Interval: Discrete 0.033s (30.000 fps)
[07/26/23 09:35:32] crowsnest:          [1]: 'YUYV' (YUYV 4:2:2)
[07/26/23 09:35:32] crowsnest:          Size: Discrete 1280x720
[07/26/23 09:35:32] crowsnest:          Interval: Discrete 0.100s (10.000 fps)
[07/26/23 09:35:32] crowsnest:          Size: Discrete 1920x1080
[07/26/23 09:35:32] crowsnest:          Interval: Discrete 0.200s (5.000 fps)
[07/26/23 09:35:32] crowsnest:          Size: Discrete 640x480
[07/26/23 09:35:32] crowsnest:          Interval: Discrete 0.033s (30.000 fps)
[07/26/23 09:35:32] crowsnest: Supported Controls:
[07/26/23 09:35:32] crowsnest: 
[07/26/23 09:35:32] crowsnest:          User Controls
[07/26/23 09:35:32] crowsnest: 
[07/26/23 09:35:32] crowsnest:          brightness 0x00980900 (int) : min=-64 max=64 step=1 default=0 value=20
[07/26/23 09:35:32] crowsnest:          contrast 0x00980901 (int) : min=0 max=95 step=1 default=0 value=0
[07/26/23 09:35:32] crowsnest:          saturation 0x00980902 (int) : min=0 max=100 step=1 default=80 value=80
[07/26/23 09:35:32] crowsnest:          hue 0x00980903 (int) : min=-2000 max=2000 step=1 default=0 value=0
[07/26/23 09:35:32] crowsnest:          white_balance_automatic 0x0098090c (bool) : default=1 value=1
[07/26/23 09:35:33] crowsnest:          gamma 0x00980910 (int) : min=64 max=300 step=1 default=84 value=84
[07/26/23 09:35:33] crowsnest:          gain 0x00980913 (int) : min=1 max=8 step=1 default=1 value=8
[07/26/23 09:35:33] crowsnest:          power_line_frequency 0x00980918 (menu) : min=0 max=2 default=1 value=1
[07/26/23 09:35:33] crowsnest:          0: Disabled
[07/26/23 09:35:33] crowsnest:          1: 50 Hz
[07/26/23 09:35:33] crowsnest:          2: 60 Hz
[07/26/23 09:35:33] crowsnest:          white_balance_temperature 0x0098091a (int) : min=2800 max=6500 step=1 default=3980 value=3980 flags=inactive
[07/26/23 09:35:33] crowsnest:          sharpness 0x0098091b (int) : min=1 max=7 step=1 default=2 value=2
[07/26/23 09:35:33] crowsnest:          backlight_compensation 0x0098091c (int) : min=0 max=128 step=0 default=0 value=0
[07/26/23 09:35:33] crowsnest: 
[07/26/23 09:35:33] crowsnest:          Camera Controls
[07/26/23 09:35:33] crowsnest: 
[07/26/23 09:35:33] crowsnest:          auto_exposure 0x009a0901 (menu) : min=0 max=3 default=3 value=1
[07/26/23 09:35:33] crowsnest:          1: Manual Mode
[07/26/23 09:35:33] crowsnest:          3: Aperture Priority Mode
[07/26/23 09:35:33] crowsnest:          exposure_time_absolute 0x009a0902 (int) : min=10 max=626 step=1 default=156 value=626
[07/26/23 09:35:33] crowsnest: INFO: No usable CSI Devices found.
[07/26/23 09:35:33] crowsnest: V4L2 Control: Device: [cam 1]
[07/26/23 09:35:33] crowsnest: V4L2 Control: Options: --set-ctrl=rotate=180
grep: unrecognized option '--set-ctrl'
Usage: grep [OPTION]... PATTERNS [FILE]...
Try 'grep --help' for more information.
[07/26/23 09:35:34] crowsnest: V4L2 Control: Parameter '--set-ctrl=rotate=180' not available for '/dev/video4'. Skipped.
[07/26/23 09:35:34] crowsnest: Try to start configured Cams / Services...
[07/26/23 09:35:35] crowsnest: INFO: Configuration of Section [cam 1] looks good. Continue...
[07/26/23 09:35:36] crowsnest: Starting ustreamer with Device /dev/video4 ...
[07/26/23 09:35:37] crowsnest: ... Done!
@lyj0309 lyj0309 added the bug Something isn't working label Jul 26, 2023
@mryel00
Copy link
Member

mryel00 commented Jul 27, 2023

Your service and environment file looks like the default version to me. So there shouldn't be any problems with your specific files.
Please send the output of journalctl -r -g crowsnest.

Small Note: --set-ctrl=rotate=180 shouldn't be like that inside the v4l2ctl section. Change it to v4l2ctl: rotate=180

@mryel00
Copy link
Member

mryel00 commented Aug 1, 2023

@lyj0309 Do you still have problems with this? If so, please join the Discord and please open a post in support-forum to fix your issue

@mryel00 mryel00 added not an Issue and removed bug Something isn't working labels Aug 1, 2023
@github-actions
Copy link

github-actions bot commented Aug 1, 2023

Ahoi!

It looks like this ticket is a request for help (or similar).
Many helpful people will not see your message here and you are
unlikely to get a useful response.

We use github to handle bugreports, feature requests and
planning new releases.

Please use our Discord-Server for help: discord.gg/mainsail

This ticket will be automatically closed.

Fair wind and a following sea!
~ Your friendly MainsailGithubBot

PS: I'm just an automated script, not a real sailor.

@github-actions github-actions bot closed this as completed Aug 1, 2023
@lyj0309
Copy link
Author

lyj0309 commented Aug 2, 2023

well, it's works when i update it to newest version

@YaphetS1
Copy link

YaphetS1 commented Nov 6, 2023

Same issue at the latest commit in master...

@YaphetS1
Copy link

YaphetS1 commented Nov 6, 2023

how to solve it?

@mryel00
Copy link
Member

mryel00 commented Nov 6, 2023

@YaphetS1 Sry if that now sound rude, but what do you expect us to do? You gave no information, not even the information I asked OP for. For OP an update solved it, so that would be the answer for this specific case but this issue can have multiple different reasons.
Therefore: no information => no help possible
Also if you need help on this, you should join the Discord as I already wrote in this issue.

@YaphetS1
Copy link

YaphetS1 commented Nov 6, 2023

The problem was in custom working directory, so the systemd output is (code=exited, status=200/CHDIR).
That output was to look at /etc/systemd/system/crowsnest.service. When I changed "WorkingDirectory" to crowsnest directory, systemctl turned out to be satisfactory

@YaphetS1
Copy link

YaphetS1 commented Nov 6, 2023

It's strange. Why script doesn't update it by 'pwd'?

@mryel00
Copy link
Member

mryel00 commented Nov 22, 2023

@YaphetS1 Sry, I completely forgot to answer you here. We decided against this, as it's less error prone like this.
But we added #205 recently. With this you can fix your WorkingDirectory easily. The intended usecase of this is for developing and to make it easier to let someone test something without the need of setting up multitple GitHub remote paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants