How to enable coredumps in Linux?
Enclosed you’ll find the description to enable the creation of core dump files when a process is stopped. You have to logon as super-/root-user to be able to modify the files.
Before changing the settings please get in contact with the system administration for the computers you are using to clarify the necessary modifications.
+++ edit the file /etc/bash.bashrc or /etc/bashrc +++
The following settings are valid for all processes started from a “bash”-shell.
These settings are valid for an interactive shell that is not a login shell.
-- open the file with an editor
-- set the core dump-size to a hardcoded limit or to unlimited, shown in the example
# set core dump size
ulimit -S -c unlimited > /dev/null 2>&1
-- save the file
+++ edit the file /etc/init.d/winccoa or /etc/init.d/pvss +++
Depening on the PVSS-/WinCC OA-version you are using the file is called /etc/init.d/pvss or /etc/init.d/winccoa.
-- open the file with an editor
-- go the end of the comments made at the beginning of the file
-- set the core dump-size to a hardcoded limit or to unlimited, shown in the example
# set core dump size
ulimit -S -c unlimited > /dev/null 2>&1
-- save the file
+++ define the directory for the core dump files +++
Normally the core dump file is created in the directory where the process was started, it is not the directory where the executable is located. To set a defined directory for core dump files started by an init.d-script (following system V standard) you have to perform the following steps.
-- create the directory which shall be used for the core dump files
e.g.: /disc/coredumps
-- enable full access to this directory
chmod –R 777 /disc/coredumps
-- open the file /etc/rc.local with an editor
-- add the line
echo “<core dump path>/core.%p" > /proc/sys/kernel/core_pattern
e.g.
echo “/disc/coredumps/core.%p" > /proc/sys/kernel/core_pattern
-- save the file
The parameter “.%p” defines that the process-ID is added to the default-filename “core”.
When adding this to /etc/rc.local it will only take effect when you boot the machine the next time.
For immediate usage, issue the command in a shell directly without the need for a reboot.
+++ activate the settings +++
To activate the settings for the WinCC OA processes you have to restart them. Please note that the project will be restarted. Therefore you should clarify first when the restart can be made.
If the project was started manually you have to stop the project including the process monitor. Afterwards you have to open a new shell to start the console/project administration using startConsole or startPA.
If the WinCC OA processes are started automatically during startup of the computer you have to restart the scripts /etc/init.d/winccoa or /etc/init.d/pvss.
How to activate “WinCC OA as service” is described at the online help: Installation --> Linux.
Call the command:
/etc/init.d/winccoa restart
+++ check if the settings are working +++
To check if the core dump files are created correctly you could stop one of the WinCC OA processes with the signal SIGSEGV.
Before one process is stopped please get in contact with the personnel operating the system to check if a stop is possible.
-- determine the process-ID for a WinCC OA process, excluding the core-processes for the database (database-, RDB- and valarch-processes) and the event-manager
-- call the command kill –s SIGSEGV <PID>
-- check if the file “/disc/coredumps/core.<PID> was created