This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
RE: Empty core dump file
> > This is a file permissions problem because if I mount the shared
> > folder with a specific uid the core file is correctly saved. So I
> > must use a mount command such as:
> >
> > mount -t vboxsf -o rw,uid=1000,gid=1000 SVNProj /media/SVNProj
> >
> > which I store in /etc/rc.local
> >
> > If I omit uid the core file becomes empty.
> >
> > The problem with this is that I must customise the mount command for
> > each user, i.e. mount needs their uid.
> >
> > Is there a better solution for this problem please?
>
> As you say, this is a file permission problem. By default, the core file is writtin
> in the current directory of the process that has crashed; if the crashing
> process cannot write into its current directory, a core file cannot be
> generated.
>
> The ideal solution is to have the current directory be writable by the process,
> as that is by far the commonest situation in Un*x operations, and there are
> likely to be other standard system management operations that fail if the
> process cannot write its current directory.
>
> Can you arrange your processes to not change their current directory to
> /media/SVNProj? Or if you really intend every user to be able to write into
> /media/SVNProj, change the permissions on that directory so they can.
>
> Another approach would be to have the core files written in another
> directory. I'm not sure of the details but the manual page core(5) says that
> with 2.6 kernels and 2.4 kernels after 2.4.21, there is a
> /proc/sys/kernel/core_pattern file that seems to allow specification of the
> directory for the core file. So you could do
>
> echo '/tmp/core.%p' >/proc/sys/kernel/core_pattern
>
> and have all core files written into the /tmp directory.
Thanks for your suggestion of storing the core files in /tmp. I think that will be very suitable for us.
I have set the core pattern to:
kernel.core_pattern=/tmp/corefiles/core.%e.%p.%t
On Centos 5.5, script /etc/cron.daily/tmpwatch calls tmpwatch to periodically purge /tmp. This is good as it will delete old core files but I can't work out whether it will delete directory /tmp/corefiles. If it does, then new core files will not be saved. Of course, with your suggestion where the core files are just stored in /tmp that would not be a problem.
Has anyone configured a similar set up successfully?
David