Edit 1

I did some digging and with some help from spmurrayzzz and a few other folks

Few further notes:

  • When I ran the script manually, it appears that the user I was running it had lost permissions somehow during the dump/freeze/restart. Not entirely sure what that's about yet.
  • The current working directory for cron jobs is just /.
  • I tried debugging a little with gdb, got this as a result:
    (gdb) attach 29604 # the pid logged below
    Attaching to process 29604
    ptrace: No such process.
    
  • Tried to figure out where the core was.
    codelemur@raspberrypi:~ $ cat /proc/sys/kernel/core_pattern
    core
    
    I then found a file core in the root directory, but I haven't figured out what to do with it yet.

/Edit 1

Edit 2

OK so some more debugging. Was told via some forums that running ulimit -c would tell me the limit size of the coredumps currently configured. Ended up returning 0 so I thought that maybe it wouldn't do a coredump, but yet we still had that file.

Finally just ran gdb and used the "help" commands to figure out how I could just read a file without specifying the program that launched it. This was the result:

(gdb) core-file core
[New LWP 29604]
Core was generated by `/lib/systemd/systemd --system --deserialize 19'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0xb6a6e6dc in ?? ()

So it appears we may have found our culprit? Anyways, just figured you deserved an update.

/Edit 2


TL;DR: I got an error and I don't know how to even look for debugging tips

So I wrote some janky bash script to take a picture with a USB webcam every 2 minutes and POSTs to my server, when I ran into a SEGV error. I don't have much familiarity at all w/ C++, kernel stuff, and I'm honestly not sure how to debug any of it. I've definitely googled quite a bit, but so far, I haven't turned up anything that's helped me.

Anyways, here's the deetz:

The Script

webcam.sh

#!/bin/bash

DATE=$(date +"%Y-%m-%d_%H%M")
filename="/full/path/to/webcam/$DATE.png"

fswebcam -r 1280x720 --no-banner $filename

url="<host>/<mystery-route>"
auth="Authorization: Basic <Super Secret Base64 Encoding>"
content_disposition="content-disposition: inline; filename=\"$DATE.png\""

content="$(curl -X PUT --upload-file "$filename" "$url" -v -H "$auth" -H "$content_disposition" > /path/to/webcam/logs.txt )"
rm /path/to/webcam/*.png

Crontab Settings

crontab -e

# m h  dom mon dow   command
*/2 * * * * /path/to/webcam/webcam.sh 2>&1

Error Logs:

tail -f /var/log/syslog

Mar 30 23:42:01 raspberrypi CRON[29599]: (user) CMD (/path/to/webcam/webcam.sh 2>&1)
Mar 30 23:42:48 raspberrypi systemd[1]: Caught <SEGV>, dumped core as pid 29604.
Mar 30 23:42:48 raspberrypi systemd[1]: Freezing execution.

If you have any ideas on what the shit I did wrong, I'm alllllll ears.

Cheers!
-CL