I had an issue with my FRITZ!Box, running freetz and dnsmasq, where by dnsmasq would start and then crash after a few seconds. Since it was working fine before, I figured this must be an environmental issue. dnsmasq Log files were not showing anything helpful. That’s when I remembered strace. strace is a tool which displays all system calls a process makes. It could be used as a debugging tool to gain more insight into what the process was doing at the point which it crashed. So I ran strace on the process (before it crashed, so I had to be quick).
# strace -p 7845
And I got my answer:
open("/var/tmp/multid.leases", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = -1 EACCES (Permission denied)
— SIGSEGV (Segmentation fault) @ 0 (0) —
Process 7845 detached
It was trying to access a file which had corrupted permissions, which was probably a situation not handled correctly in code. Resetting the permissions on that file fixed the issue.