I use DVR-Scan 1.0.1 [1] for video surveillance (scan video files got from an IP camera) under a Raspbian GNU/Linux 8.0 (jessie) system on a Raspberry Pi 3 model B. DVR-Scan depends on Python and OpenCV 3.1.0, this latter was compiled by me from source using: cmake; make; sudo make install; following these instructions: [2]
Everything worked fine for a long time (minimum two years) until last month. After a system reboot, running dvr-scan would result in a Segmentation fault with exit code 139. I also get that error when running OpenCV demo executables (like: opencv_test_core) and running: python -c "import cv2". I temporarily solved it by running fsck at boot time (cause I could see some directory error in /var/log/syslog) by adding fsck.mode=force to file /boot/cmdline.txt; but some days ago, after another system reboot, the problem appeared again and this time does not seem to have to do with a filesystem problem. I'm not an expert but it's like the root problem is related to OpenCV (misconfiguration, missing and/or corrupted files?).
I run gdb and I got these outputs:
(1)
pi@raspberrypi:/usr/local/bin $ gdb python
GNU gdb (Raspbian 7.7.1+dfsg-5+rpi1) 7.7.1
...
(gdb) run dvr-scan
Starting program: /usr/bin/python dvr-scan
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Program received signal SIGILL, Illegal instruction.
0x76871de8 in ?? () from /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
(2)
pi@raspberrypi:/opt/opencv-3.1.0/build/bin $ gdb ./opencv_test_core
GNU gdb (Raspbian 7.7.1+dfsg-5+rpi1) 7.7.1
...
(gdb) run
Starting program: /opt/opencv-3.1.0/build/bin/opencv_test_core
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Cannot access memory at address 0x0
Program received signal SIGSEGV, Segmentation fault.
0x75d86340 in ?? () from /lib/arm-linux-gnueabihf/libglib-2.0.so.0
I also run strace opencv_test_core and got this one too (last lines):
open("/proc/filesystems", O_RDONLY|O_LARGEFILE) = 4
fstat64(4, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x76f46000
read(4, "nodev\tsysfs\nnodev\trootfs\nnodev\tr"..., 1024) = 329
read(4, "", 1024) = 0
close(4) = 0
munmap(0x76f46000, 4096) = 0
open("/proc/self/auxv", O_RDONLY) = 4
read(4, "!\0\0\0\0\260\331~", 8) = 8
read(4, "\20\0\0\0\326\260?\0", 8) = 8
read(4, "\6\0\0\0\0\20\0\0", 8) = 8
read(4, "\21\0\0\0d\0\0\0", 8) = 8
read(4, "\3\0\0\0004\0\1\0", 8) = 8
read(4, "\4\0\0\0 \0\0\0", 8) = 8
read(4, "\5\0\0\0\10\0\0\0", 8) = 8
read(4, "\7\0\0\0\0\300\365v", 8) = 8
read(4, "\10\0\0\0\0\0\0\0", 8) = 8
read(4, "\t\0\0\0\340\222\3\0", 8) = 8
read(4, "\v\0\0\0\350\3\0\0", 8) = 8
read(4, "\f\0\0\0\350\3\0\0", 8) = 8
read(4, "\r\0\0\0\350\3\0\0", 8) = 8
read(4, "\16\0\0\0\350\3\0\0", 8) = 8
read(4, "\27\0\0\0\0\0\0\0", 8) = 8
read(4, "\31\0\0\0\234\344\223~", 8) = 8
read(4, "\32\0\0\0\20\0\0\0", 8) = 8
read(4, "\37\0\0\0\351\357\223~", 8) = 8
read(4, "\17\0\0\0\254\344\223~", 8) = 8
read(4, "\0\0\0\0\0\0\0\0", 8) = 8
read(4, "", 8) = 0
close(4) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x7e9d7aa0} ---
+++ killed by SIGSEGV +++
I don't know if it may help but there it is. I'm sure that it opencv_test_core (demo app from OpenCV) ran successfully, the root problem would be solved.
I ask for help to patch the problem and/or know what is likely causing it. Am I missing some file(s) due to filesystem or storage corruption (I have seen a lot of entries in /lost+found directory)? Should I try to reinstall OpenCV from source? I don't understand why last month the problem disappeared after a system reboot with fsck.mode=force and this last time that didn't seem to work.
PD: If you ask me why don't I try to update to latest version of DVR-Scan it's just because I have been using version 1.0.1 during a long time and it's very tested and I'm sure it works well. The same applies to the operating system ("If something works, don't fix/touch/update it.").