mainsail-crew / crowsnest

Webcam Service for multiple Cams
GNU General Public License v3.0
324 stars 77 forks source link

Non-explicit error message (Error 1 occured on line 45) #58

Closed Hexalyse closed 1 year ago

Hexalyse commented 2 years ago

See UPDATE section on the bottom

What happened

I installed MainsailOS on a Raspberry Pi 2 ver B.

When crowsnest tries to start, here is the debug log:

Nov 20 13:24:15 printer crowsnest[542]: crowsnest - A webcam Service for multiple Cams and Stream Services.
Nov 20 13:24:15 printer crowsnest[369]: [11/20/22 13:24:15] crowsnest: Version: v3.0.3
Nov 20 13:24:16 printer crowsnest[554]: Version: v3.0.3
Nov 20 13:24:16 printer crowsnest[369]: [11/20/22 13:24:16] crowsnest: Prepare Startup ...
Nov 20 13:24:16 printer crowsnest[570]: Prepare Startup ...
Nov 20 13:24:23 printer crowsnest[369]: [11/20/22 13:24:23] crowsnest: INFO: Host information:
Nov 20 13:24:24 printer crowsnest[617]: INFO: Host information:
Nov 20 13:24:25 printer crowsnest[369]: [11/20/22 13:24:24] crowsnest: Host Info: Distribution: Raspbian GNU/Linux 10 (buster)
Nov 20 13:24:25 printer crowsnest[633]: Host Info: Distribution: Raspbian GNU/Linux 10 (buster)
Nov 20 13:24:25 printer crowsnest[369]: [11/20/22 13:24:25] crowsnest: Host Info: Release: MainsailOS release 0.7.1 (buster)
Nov 20 13:24:26 printer crowsnest[645]: Host Info: Release: MainsailOS release 0.7.1 (buster)
Nov 20 13:24:26 printer crowsnest[369]: [11/20/22 13:24:26] crowsnest: Host Info: Kernel: Linux 5.10.103+ armv6l
Nov 20 13:24:27 printer crowsnest[656]: Host Info: Kernel: Linux 5.10.103+ armv6l
Nov 20 13:24:27 printer crowsnest[369]: [11/20/22 13:24:27] crowsnest: Host Info: Model: Raspberry Pi Model B Rev 2
Nov 20 13:24:27 printer crowsnest[663]: Host Info: Model:  Raspberry Pi Model B Rev 2
Nov 20 13:24:28 printer crowsnest[369]: [11/20/22 13:24:28] crowsnest: Host Info: Available CPU Cores: 1
Nov 20 13:24:28 printer crowsnest[672]: Host Info: Available CPU Cores: 1
Nov 20 13:24:29 printer crowsnest[369]: [11/20/22 13:24:28] crowsnest: Host Info: Available Memory: 440344 kB
Nov 20 13:24:29 printer crowsnest[679]: Host Info: Available Memory: 440344 kB
Nov 20 13:24:29 printer crowsnest[369]: [11/20/22 13:24:29] crowsnest: Host Info: Diskspace (avail. / total): 53G / 59G
Nov 20 13:24:29 printer crowsnest[686]: Host Info: Diskspace (avail. / total): 53G / 59G
Nov 20 13:24:30 printer crowsnest[369]: [11/20/22 13:24:30] crowsnest: INFO: Checking Dependencys
Nov 20 13:24:30 printer crowsnest[698]: INFO: Checking Dependencys
Nov 20 13:24:31 printer crowsnest[369]: [11/20/22 13:24:31] crowsnest: Dependency: 'crudini' found in /usr/bin/crudini.
Nov 20 13:24:31 printer crowsnest[711]: Dependency: 'crudini' found in /usr/bin/crudini.
Nov 20 13:24:33 printer crowsnest[369]: [11/20/22 13:24:32] crowsnest: Dependency: 'find' found in /usr/bin/find.
Nov 20 13:24:33 printer crowsnest[722]: Dependency: 'find' found in /usr/bin/find.
Nov 20 13:24:34 printer crowsnest[369]: [11/20/22 13:24:34] crowsnest: Dependency: 'logger' found in /usr/bin/logger.
Nov 20 13:24:34 printer crowsnest[732]: Dependency: 'logger' found in /usr/bin/logger.
Nov 20 13:24:36 printer crowsnest[369]: [11/20/22 13:24:35] crowsnest: Dependency: 'xargs' found in /usr/bin/xargs.
Nov 20 13:24:36 printer crowsnest[746]: Dependency: 'xargs' found in /usr/bin/xargs.
Nov 20 13:24:37 printer crowsnest[369]: [11/20/22 13:24:37] crowsnest: Dependency: 'ffmpeg' found in /usr/bin/ffmpeg.
Nov 20 13:24:37 printer crowsnest[758]: Dependency: 'ffmpeg' found in /usr/bin/ffmpeg.
Nov 20 13:24:38 printer crowsnest[369]: [11/20/22 13:24:38] crowsnest: Dependency: 'ustreamer' found in bin/ustreamer/ustreamer.
Nov 20 13:24:38 printer crowsnest[768]: Dependency: 'ustreamer' found in bin/ustreamer/ustreamer.
Nov 20 13:24:39 printer crowsnest[369]: [11/20/22 13:24:39] crowsnest: Dependency: 'rtsp-simple-server' found in bin/rtsp-simple-server/rtsp-simple-server.
Nov 20 13:24:39 printer crowsnest[778]: Dependency: 'rtsp-simple-server' found in bin/rtsp-simple-server/rtsp-simple-server.
Nov 20 13:24:43 printer crowsnest[369]: ~/crowsnest/bin/ustreamer /
Nov 20 13:24:44 printer crowsnest[369]: [11/20/22 13:24:44] crowsnest: Version Control: ustreamer is up to date. (v4.13)
Nov 20 13:24:44 printer crowsnest[799]: Version Control: ustreamer is up to date. (v4.13)
Nov 20 13:24:44 printer crowsnest[369]: /
Nov 20 13:24:44 printer crowsnest[369]: ~/crowsnest/bin/rtsp-simple-server /
Nov 20 13:24:45 printer crowsnest[816]: ERROR: Error 132 occured on line 45
Nov 20 13:24:46 printer crowsnest[827]: ERROR: Stopping crowsnest.
Nov 20 13:24:46 printer crowsnest[836]: Goodbye...
Nov 20 13:24:47 printer crowsnest[369]: [11/20/22 13:24:47] crowsnest: ERROR: Error 1 occured on line 45
Nov 20 13:24:47 printer crowsnest[846]: ERROR: Error 1 occured on line 45
Nov 20 13:24:48 printer crowsnest[369]: [11/20/22 13:24:47] crowsnest: ERROR: Stopping crowsnest.
Nov 20 13:24:48 printer crowsnest[857]: ERROR: Stopping crowsnest.
Nov 20 13:24:48 printer crowsnest[369]: [11/20/22 13:24:48] crowsnest: Goodbye...
Nov 20 13:24:48 printer crowsnest[866]: Goodbye...

As you can see, there is an "Error 1" and an "Error 132" on line 45. But I have no idea in what file is the line 45 problematic, nor did I find an explanation of what is error 1 or error 132 online.

What did you expect to happen

Service should start without error

How to reproduce

Install MainsailOS. Check Crowsnest log.

UPDATE

While trying to debug the error, I configured crowsnest to output debug log instead of verbose log, but it didn't give me any more information. So, just out of curiosity, I switched it to "quiet" logging mode and... no more error!? It worked, and crowsnest started without any error, found my webcam, etc.

So it seems like it's an error that only exist with debug and verbose logging.

KwadFan commented 1 year ago

Hey,

to be honest I see this error the first time but I never tested crowsnest on a RPI2B. But, a quick google-foo tells me that Error 132 is an exit code that a program is terminated due SIGKILL with an illegal core instruction (128+4).

As you said if you set to quiet, the version check will be skipped at all. That tells me that this error occurs in version checking of the rtsp server binary.

I guess that this precompiled binary is not working on this type of CPU (should be ARMv6, IRC).

To confirm that I need output of uname -m and please try to run ~/crowsnest/bin/rtsp-simple-server/rtsp-simple-server --version this should spit out v0.19.1 without any error.

If there is an error message please post that.

Regards Kwad

KwadFan commented 1 year ago

@Hexalyse Any updates on this?

Hexalyse commented 1 year ago

@KwadFan Sorry for the late reply. I've indeed also tried enabling rtsp (with the logging still in quiet mode) and got another error 132, on a different line, so you're right on the fact it probably comes from rtsp crashing on the RPi2.

Here is the uname -m : armv6l And the rtsp-simple-server indeed returns :

pi@printer:~$ ~/crowsnest/bin/rtsp-simple-server/rtsp-simple-server --version
Illegal instruction

again confirming your theory about CPU/architecture compatibility.

KwadFan commented 1 year ago

Ok, rtsp-simple-server has armv6 packages so it must be something wrong in my scripts.

I will do some changes today, maybe tommorow. Could you test that branch for me, during the week?

Regards Kwad

Hexalyse commented 1 year ago

Could you test that branch for me, during the week?

Sure. Let me know when it's done and needs testing.

KwadFan commented 1 year ago

Well,

I could pull out may hair, with that.

As you can see here: https://github.com/mainsail-crew/crowsnest/blob/f7cf2260f28901f33f5bc979778afeade8129c10/bin/Makefile#L22

I simply cut down armv6l to armv6. I also tried to download the package with that resulting url, which also presents the armv6 package.

So, I am guessing that even the kernel reports an armv6, the Raspi 2B uses a CPU with an armv7 Instruction set.

To confirm that please download the armv7 package: https://github.com/aler9/rtsp-simple-server/releases/download/v0.19.1/rtsp-simple-server_v0.19.1_linux_armv7.tar.gz

cd /tmp
curl -jLO https://github.com/aler9/rtsp-simple-server/releases/download/v0.19.1/rtsp-simple-server_v0.19.1_linux_armv7.tar.gz
tar -xvzf rtsp-simple-server_v0.19.1_linux_armv7.tar.gz
./rtsp-simple-server --version

If it turns out that this will work I guess I brute force the armv7 package and hoping for the best :man_shrugging:

Regards Kwad

Hexalyse commented 1 year ago

Well.... I'm starting to wonder what's going on. Same problem... I get an illegal instruction.

But then I tried with the last release (v0.20.2), in armv6, and guess what.... it works.

pi@printer:/tmp $ tar xvzf rtsp-simple-server_v0.20.2_linux_armv6.tar.gz
rtsp-simple-server
rtsp-simple-server.yml
LICENSE
pi@printer:/tmp $ ./rtsp-simple-server --version
v0.20.2
pi@printer:/tmp $ 

I guess the solution would be to update to this version, then ? I have no idea what could be wrong with the v0.19.1, but I've found this issue on another piece of software: https://github.com/alphacep/vosk-api/issues/247 I didn't check rtsp-simple-server in detail, but is it using Python ? Could it be something similar ? And maybe the last version is compiled to work with the version of Python I have, but not the 0.19 ?

UPDATE: I replaced the binary in ~/crowsnest/bin/rtsp-simple-server/ with the working version (v0.20.2), and tried activating rtsp in crowsnest. Unfortunately, I still get an error:

Nov 24 09:58:56 printer crowsnest[27739]: [11/24/22 09:58:56] crowsnest: INFO: Configuration of Section [cam 1] looks good. Continue...
Nov 24 09:58:56 printer crowsnest[28057]: INFO: Configuration of Section [cam 1] looks good.             Continue...
Nov 24 09:58:56 printer crowsnest[27739]: [11/24/22 09:58:56] crowsnest: Starting rtsp-simple-server with config /home/pi/crowsnest/file_templates/crowsnest-rtsp.yml ...
Nov 24 09:58:56 printer crowsnest[28072]: Starting rtsp-simple-server with config /home/pi/crowsnest/file_templates/crowsnest-rtsp.yml ...
Nov 24 09:58:58 printer crowsnest[28083]: Config file: /home/pi/crowsnest/file_templates/crowsnest-rtsp.yml
Nov 24 09:58:58 printer crowsnest[27739]: [11/24/22 09:58:58] crowsnest: ... Done!
Nov 24 09:58:59 printer crowsnest[28098]:  ... Done!
Nov 24 09:58:59 printer crowsnest[27739]: [11/24/22 09:58:59] crowsnest: ERROR: Error 1 occured on line 75
Nov 24 09:58:59 printer crowsnest[28113]: ERROR: Error 1 occured on line 75
Nov 24 09:59:00 printer crowsnest[27739]: [11/24/22 09:59:00] crowsnest: ERROR: Stopping crowsnest.
Nov 24 09:59:00 printer crowsnest[28122]: ERROR: Stopping crowsnest.
Nov 24 09:59:00 printer crowsnest[27739]: [11/24/22 09:59:00] crowsnest: Goodbye...
Nov 24 09:59:00 printer crowsnest[28129]: Goodbye...
Nov 24 09:59:02 printer crowsnest[28143]: ERR: open /home/pi/crowsnest/file_templates/crowsnest-rtsp.yml: no such file or directory
Nov 24 09:59:07 printer crowsnest[27739]: [11/24/22 09:59:07] crowsnest: Starting ffmpeg (rtsp stream source) with Device /dev/video0 ...
Nov 24 09:59:07 printer crowsnest[28173]: Starting ffmpeg (rtsp stream source) with Device /dev/video0 ...
Nov 24 09:59:09 printer crowsnest[28191]: Parameters: -nostdin -hide_banner -f video4linux2 -input_format h264 -pix_fmt h264 -video_size 1280x720 -framerate 15 -i /dev/video0 -c:v copy -f rtsp rtsp://localhost:8554/1
Nov 24 09:59:19 printer crowsnest[28215]: Input #0, video4linux2,v4l2, from '/dev/video0':
Nov 24 09:59:20 printer crowsnest[28221]: Duration: N/A, start: 165817.423548, bitrate: N/A
Nov 24 09:59:21 printer crowsnest[28227]: Stream #0:0: Video: h264 (Constrained Baseline), yuvj420p(pc, progressive), 1280x720 [SAR 1:1 DAR 16:9], 15 fps, 15 tbr, 1000k tbn, 30 tbc
Nov 24 09:59:22 printer crowsnest[28236]: [tcp @ 0x1ea4b10] Connection to tcp://localhost:8554?timeout=0 failed: Connection refused
Nov 24 09:59:23 printer crowsnest[28242]: Could not write header for output file #0 (incorrect codec parameters ?): Connection refused
Nov 24 09:59:24 printer crowsnest[28248]: Stream mapping:
Nov 24 09:59:25 printer crowsnest[28254]: Stream #0:0 -> #0:0 (copy)
Nov 24 09:59:26 printer crowsnest[28260]: Last message repeated 1 times
Nov 24 09:59:26 printer crowsnest[27739]: [11/24/22 09:59:26] crowsnest: ERROR: Start of ffmpeg (rtsp stream source) [cam 1] failed!
Nov 24 09:59:26 printer crowsnest[28267]: ERROR: Start of ffmpeg (rtsp stream source) [cam 1] failed!

EDIT: I'm stupid... I can't read. There is a missing config file :D Disregard, I'll fix that and maybe then it will work. But there is a problem with the base config, since it's trying to get a file that doesn't exist. crowsnest-rtsp.conf wasn't in file_templates but in resources in my crowsnest directory.

KwadFan commented 1 year ago

Oh f... SHOOT!

No, rtsp-simple-server is written in GO. Now python involved as far as I know.

You this template thingi is my fault. :facepalm:

Could you please open an issue for that? Will fix that first.

Hexalyse commented 1 year ago

I opened an issue for the config file location.

But forget about the RPi 2 problem. I just tried RTSP. The CPU of the RPI is so bad that it can't even stream live (probably because by default it encodes with h264 and it's way too intensive for the poor old SoC of the RPi2). So I don't think it's worth fixing if it's not usable anyway. You can probably close this issue as-is.

I'll go find a cheap second-hand mini-computer for around 100€, since RPi are out of stock everywhere on the planet, and it will be muuuuch easier to just install Mainsail, crowsnest etc. myself.

PS: hello fellow fpv pilot. Well... I used to be, cause early 2020 I gave all my drone related gear away to a friend cause I was moving abroad and couldn't bring it. Covid brought me back home, and I've been missing FPV for 2 years now :( I wish I hadn't given everything away.

KwadFan commented 1 year ago

PS: hello fellow fpv pilot. Well... I used to be, cause early 2020 I gave all my drone related gear away to a friend cause I was moving abroad and couldn't bring it. Covid brought me back home, and I've been missing FPV for 2 years now :( I wish I hadn't given everything away.

Ouch, you shouldnt have done that :grimacing: , get an TinyWhoop ASAP!!! Covid throws me off flying outdoor but a Whoop runs fine in my appartment LOL

Back to topic. Encoding of h264 is neccessary because it is the standart protocol for rtsp spec. But, I have to do some test around it because it was implemented in time where ffmpeg supports GPU encoding due h264_omx lib, which isnt available any more, but lacking of time I couldnt patch it. Or it uses h264 nativly comme from camera hardware inbuilt h264 encoder. ffmpeg uses a simple copy command if neither is available what ends mostly in CPU encoding...

As 0.20.2 of rtsp-simple-server seems to be working I will bump the version and hoping that the config.yml will match ^^

Regards Kwad

megabitsenmzq commented 1 year ago

I had this issue on my pi zero gen 1. After changing the log option to quiet, everything went fine. Thank you for the solution.

gandalf44 commented 1 year ago

I appreciate the help. I also had this issue on a pi zero w. Adjusting the log option in crowsnest.conf to quiet immediately fixed the issue.