I'm using Ubuntu 18.04 Server with systemd. Recently a program my department has developed crashed twice within a day with the following error:
Jun 07 06:33:07 xxx systemd[1]: xxx.service: Main process exited, code=killed, status=11/SEGV
Jun 07 06:33:07 xxx systemd[1]: xxx.service: Failed with result 'signal'.
I gather the next step is to get a backtrace or coredump, however I'm not sure how to do this on Ubuntu Server with systemd.
I'm not sure if I should pursue using systemd-coredump
, coredumpctl
, or some other utility.
Also, I'm not sure what commands to issue. For the above utilities there is plenty of documentation on various features, etc. but I can't find a concise example along the lines of:
sudo apt-get install xyz
(run x, y, z commands to get core dump)
Can anybody provide a concise example or a tutorial website that explains this well? I don't need or want to use various elaborate features, I'm just trying to get a basic core dump.
Best Answer
Take for example a relatively simple service, the chrony NTP daemon.
Install debug symbols with the dbgsym packages. Unfortunately, the ddebs repo is not in sources files by default. Also there is not great scripts to find the packages, so start by appending -dbgsym to package name.
You probably need to think about how to handle core dumps on modern Linux servers and in their case, they are considering going back to just core dump files. Personally, I get nothing useful out of apport on a server, but find coredumpctl to be useful. So, the systemd approach on Ubuntu 18.04:
Starting the debugger session might look like this:
In this contrived example, caught it in select() as I rudely sent a signal to a task waiting on I/O.
More complex software probably lacks other symbols, install those and maybe source code and continue debugging.