Enable Core Dump systemd: Difference between revisions

From Proxmox VE
Jump to navigation Jump to search
(Created page with "=Introduction= This is a HowToDO to enable Core Dump with systemd on PVE 4.0 (Debian Jessie). =Requirements= To activate you have to create /etc/security/limits.d/core.conf ...")
 
(→‎Test it: use kill -11 sigsegv)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=Introduction=
== Introduction ==
This is a HowToDO to enable Core Dump with systemd on PVE 4.0 (Debian Jessie).
This is a HowToDO to enable Core Dump with systemd on PVE 4.0 (Debian Jessie).


=Requirements=
== Requirements ==
To activate you have to create
To activate you have to create
  /etc/security/limits.d/core.conf
  /etc/security/limits.d/core.conf
Line 8: Line 8:
  /var/lib/coredumps
  /var/lib/coredumps


==Allow Dump from CLI==
=== Allow Dump from CLI ===


To allow root to core dump from cli.
To allow root to core dump from cli.
Line 17: Line 17:
  root      soft        core        unlimited
  root      soft        core        unlimited
   
   
==Allow Dump from Daemons==
=== Allow Dump from Daemons ===


To allow all daemons witch are started by systemd to core dump.
To allow all daemons witch are started by systemd to core dump.
Line 33: Line 33:
  fs.suid_dumpable = 2
  fs.suid_dumpable = 2


==Reboot Server==
=== Reboot Server ===
To activate this settings reboot the server.
To activate this settings reboot the server.


Line 40: Line 40:
but it didn't work for me
but it didn't work for me


=Test it=
== Test it ==
To test if everything is working fine do this few steps to verify.
To test if everything is working fine do this few steps to verify.


Line 65: Line 65:
  Hint: Some lines were ellipsized, use -l to show in full.
  Hint: Some lines were ellipsized, use -l to show in full.


  root@pve:kill -9 1281
  root@pve:kill -11 1281
   
   
  root@pve:~# ls -hal /var/lib/coredumps/  
  root@pve:~# ls -hal /var/lib/coredumps/  
Line 71: Line 71:
  drwxrwx-wx  2 root root 4.0K May 11 08:55 .
  drwxrwx-wx  2 root root 4.0K May 11 08:55 .
  drwxr-xr-x 50 root root 4.0K May 11 08:16 ..
  drwxr-xr-x 50 root root 4.0K May 11 08:16 ..
  -rw-------  1 root www-data  88M May 11 15:43 core-pveproxy-sig6-user33-group33-pid13696-time1431351789
  -rw-------  1 root www-data  88M May 11 15:43 core-pveproxy-sig11-user33-group33-pid13696-time1431351789


  root@pve:~# systemctl start pveproxy.service  
  root@pve:~# systemctl start pveproxy.service  
    
    
[[Category:HOWTO]]
[[Category:HOWTO]] [[Category:Troubleshooting]]

Latest revision as of 11:26, 16 August 2022

Introduction

This is a HowToDO to enable Core Dump with systemd on PVE 4.0 (Debian Jessie).

Requirements

To activate you have to create

/etc/security/limits.d/core.conf
/etc/sysctl.d/core.conf
/var/lib/coredumps

Allow Dump from CLI

To allow root to core dump from cli.

Edit: /etc/security/limits.d/core.conf

root       hard        core        unlimited
root       soft        core        unlimited

Allow Dump from Daemons

To allow all daemons witch are started by systemd to core dump.

Edit: /etc/systemd/system.conf add following

DefaultLimitCORE=infinity

Edit: /etc/sysctl.d/core.conf add following

kernel.core_pattern = /var/lib/coredumps/core-%e-sig%s-user%u-group%g-pid%p-time%t
kernel.core_uses_pid = 1
fs.suid_dumpable = 2

Reboot Server

To activate this settings reboot the server.

Note: normally it should be enough to call

systemctl daemon-reexec

but it didn't work for me

Test it

To test if everything is working fine do this few steps to verify.

root@pve:~# systemctl status pveproxy.service 
● pveproxy.service - PVE API Proxy Server
  Loaded: loaded (/lib/systemd/system/pveproxy.service; enabled)
  Active: active (running) since Mon 2015-05-11 08:54:50 CEST; 6h ago
 Process: 1280 ExecStart=/usr/bin/pveproxy start (code=exited, status=0/SUCCESS)
Main PID: 1281 (pveproxy)
  CGroup: /system.slice/pveproxy.service
          ├─1281 pveproxy
          ├─1282 pveproxy worker
          ├─1283 pveproxy worker
          └─1284 pveproxy worker
May 11 08:54:50 sasha pveproxy[1280]: Can't stat /usr/share/pve-manager/man...ry
May 11 08:54:50 sasha pveproxy[1280]: at /usr/bin/pveproxy line 74.
May 11 08:54:50 sasha pveproxy[1280]: Can't stat /usr/share/pve-manager/man...ry
                                      at /usr/bin/pveproxy line 74.
May 11 08:54:50 sasha pveproxy[1281]: starting server
May 11 08:54:50 sasha pveproxy[1281]: starting 3 worker(s)
May 11 08:54:50 sasha pveproxy[1281]: worker 1282 started
May 11 08:54:50 sasha pveproxy[1281]: worker 1283 started
May 11 08:54:50 sasha pveproxy[1281]: worker 1284 started
Hint: Some lines were ellipsized, use -l to show in full.
root@pve:kill -11 1281

root@pve:~# ls -hal /var/lib/coredumps/ 
total 3.1M
drwxrwx-wx  2 root root 4.0K May 11 08:55 .
drwxr-xr-x 50 root root 4.0K May 11 08:16 ..
-rw-------  1 root www-data  88M May 11 15:43 core-pveproxy-sig11-user33-group33-pid13696-time1431351789
root@pve:~# systemctl start pveproxy.service