Accel-ppp debug

I will give an example of accel-ppp build with debugging information support, for example, in order to find out the cause of the crash.

I recommend to see my article:
Accel-ppp installation

To see debug information, you need to install accel-ppp by adding:

-DCMAKE_BUILD_TYPE=Debug

If you need to identify the cause of the leakage of RAM, then add another:

-DMEMDEBUG=TRUE

Suppose we collect so:

cd /opt/
git clone git://git.code.sf.net/p/accel-ppp/code accel-ppp-code
mkdir /opt/accel-ppp-code/build
cd /opt/accel-ppp-code/build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DKDIR=/usr/src/linux-headers-`uname -r` -DRADIUS=TRUE -DSHAPER=TRUE -DLOG_PGSQL=FALSE -DNETSNMP=FALSE -DLUA=TRUE -DBUILD_IPOE_DRIVER=TRUE -DBUILD_VLAN_MON_DRIVER=TRUE -DCPACK_TYPE=Ubuntu16 -DCMAKE_BUILD_TYPE=Debug /opt/accel-ppp-code
make
make install

Add the parameters to /etc/sysctl.conf, which let us specify where to store the core files and that the name of the program and the pid number should be specified in the name:

kernel.core_uses_pid=1
kernel.core_pattern=/root/core-%e-%p

Apply the changes:

sysctl -p

Disable the limit on the size of core files:

ulimit -c unlimited

In order not to be reset after a system restart, add to /etc/security/limits.conf:

* soft core unlimited

Now for the test, you can create a file with the code in which there is an error:

int main() {
  *(char *)0 = 0;
  return 0;
}

Compile:

gcc file.c

Execute:

./a.out

Make sure there is a segfault error in dmesg:

dmesg -T

Also make sure that the core -… file is created in the /root/ directory.
Now, similarly, when accel-ppp is crash, a core file will be created.

If the core files are empty, then you need to run accel-ppp in GDB:

apt install gdb
gdb --args /usr/sbin/accel-pppd -p /var/run/accel-pppd.pid -c /etc/accel-ppp.conf
run

If you run into GDB, then you need to turn off the log rotation, otherwise, after the rotations, you must constantly type “continue”.
If necessary, I cleaned the logs like this:

echo "" > /var/log/accel-ppp/emerg.log
echo "" > /var/log/accel-ppp/auth-fail.log
echo "" > /var/log/accel-ppp/accel-ppp.log

In order not to keep the terminal open with GDB, run it in screen so that you can disconnect from the server and then return to the open window, for example, create a window with the name “accel”:

screen -S accel
gdb --args /usr/sbin/accel-pppd -p /var/run/accel-pppd.pid -c /etc/accel-ppp.conf
run

To disconnect from the window, press Ctrl+A D, and in order to connect, type the command:

screen -r accel

If accel-ppp has crash, then to view more detailed information, run the commands:

bt full
generate-core-file

In the configuration of accel-ppp, you can also enable more detailed logs, for example:

[radius]
verbose=1
interim-verbose=1
[ipoe]
verbose=1
[shaper]
verbose=1
[pppd-compat]
verbose=1
[log]
level=5
log-debug=/var/log/accel-ppp/debug.log

See my articles:
How to install and use Screen
How to update accel-ppp

Leave a comment

Leave a Reply