Thursday, 19 September 2013

NTP core file

How to remove the core file /var/lib/ntp/proc/kcore.

Some services like NTP have these files below their respective directories as well. For example /var/lib/ntp/proc/kcore

Certain services run in a so-called change root (short chroot) environment. This is done mainly for security reasons. The chroot environment means that the service only sees the files below a certain directory. For NTP this is /var/lib/ntp. NTPs root in this case is /var/lib/ntp. Since it might need access to certain files below /proc/ it mounts /proc below its own root file system again. You can see that when you use the command 'mount' and you will see a line like this:

/proc on /var/lib/ntp/proc type proc (ro)


Like all other files below /proc the kcore file is only a virtual file. It contains the RAM the kernel can allocate. Therefore this should not be touched or read. It is nothing to worry about. This file doesn't use actual disk space and only exists virtually.

-r-------- 1 root root 140737486266368 Sep 19 09:00 /var/lib/ntp/proc/kcore

How to remove it:

> Trouble is that ntp is running in chroot by default.
> To get rid of the duplicate /var/lib/ntp/proc directory (in which you
> have copy of the regular /proc), do the following:
>
> stop ntp daemon
> edit /etc/sysconfig/ntp and set run in chroot to "no"
> edit the script /etc/init.d/ntp and set run in chroot to "no"
> umount /var/lib/ntp/proc
> start ntp daemon
>
> Then you should have an empty /var/lib/ntp/proc