WSL: Core dump file is unavailable

  • A brief description Core dump file is not exported.
  • Expected results Core dump file is located on the current(+writable) directory. (based on general UNIX behavior)
  • Actual results (with terminal output if applicable) No file
  • Your Windows build number Build 14951 (Ubuntu 16.04)
  • Steps / All commands required to reproduce the error from a brand new installation
ulimit -c unlimited
echo "main(){raise(11);}" > test.c; gcc  -g -o test.o test.c; strace ./test.o
  • Strace of the failing command (without some GCC warnings)
execve("./test.o", ["./test.o"], [/* 16 vars */]) = 0                                                               
brk(NULL)                               = 0x14c9000                                                                 
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)                                     
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6ec8e70000                           
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)                                     
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3                                                                    
fstat(3, {st_mode=S_IFREG|0644, st_size=24473, ...}) = 0                                                            
mmap(NULL, 24473, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f6ec8e6a000                                                    
close(3)                                = 0                                                                         
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)                                     
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3                                                     
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\t\2\0\0\0\0\0"..., 832) = 832                              
fstat(3, {st_mode=S_IFREG|0755, st_size=1864888, ...}) = 0                                                          
mmap(NULL, 3967488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f6ec8830000                          
mprotect(0x7f6ec89f0000, 2093056, PROT_NONE) = 0                                                                    
mmap(0x7f6ec8bef000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bf000) = 0x7f6ec8bef000
mmap(0x7f6ec8bf5000, 14848, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f6ec8bf5000      
close(3)                                = 0                                                                         
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6ec8e60000                           
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6ec8e50000                           
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6ec8e40000                           
arch_prctl(ARCH_SET_FS, 0x7f6ec8e50700) = 0                                                                         
mprotect(0x7f6ec8bef000, 16384, PROT_READ) = 0                                                                      
mprotect(0x600000, 4096, PROT_READ)     = 0                                                                         
mprotect(0x7f6ec8e25000, 4096, PROT_READ) = 0                                                                       
munmap(0x7f6ec8e6a000, 24473)           = 0                                                                         
gettid()                                = 4601                                                                      
tgkill(4601, 4601, SIGSEGV)             = 0                                                                         
--- SIGSEGV {si_signo=SIGSEGV, si_code=SI_TKILL, si_pid=4601, si_uid=1000} ---                                      
+++ killed by SIGSEGV (core dumped) +++                                                                             
Segmentation fault (core dumped)                                                                                    
  • Required packages and commands to install
    • build-essential

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 43
  • Comments: 34 (2 by maintainers)

Most upvoted comments

Under the fast ring feature WSL2 (Ubuntu 18.04.3 LTS), the core dump file appeared. (see Installation Instructions for WSL 2) However, it appeared as an empty file in the working folder. Fortunately, the post on stackoverflow comes to rescue. (see Empty core dump file after Segmentation fault)

Use sysctl to set /proc/sys/kernel/core_pattern=/tmp/core sudo sysctl -w kernel.core_pattern=/tmp/core (see Why is editing core_pattern restricted?)

Now, the command gdb with core dump file works as expected. gdb ./testCoreDump /tmp/core

I think it is the best workaround I can find now.

@therealkenc “fixed in WSL2” isn’t a great resolution for the many of us left on WSL 1 for the foreseeable. In fact its a pretty poor response given that WSL2 isn’t even available to the vast majority of normal Windows users yet (never mind those held back to pre-1909 versions of Window due to, eg, corporate update policies)

It’s still an issue today, even after updating to Ubuntu 18.04…

User voice is here since it wasn’t mentioned above.

This is a known issue that we are aware of, it is something we are investigating.

Any updates on this? I use Ubuntu 22.04 with WSL2 and it still fails. The error in journalctl says:

Sep 08 18:41:50 DESKTOP-COHBRVN systemd-coredump[138561]: Failed to connect to coredump service: No such file or directory

Under the fast ring feature WSL2 (Ubuntu 18.04.3 LTS), the core dump file appeared. (see Installation Instructions for WSL 2) However, it appeared as an empty file in the working folder. Fortunately, the post on stackoverflow comes to rescue. (see Empty core dump file after Segmentation fault)

Use sysctl to set /proc/sys/kernel/core_pattern=/tmp/core sudo sysctl -w kernel.core_pattern=/tmp/core (see Why is editing core_pattern restricted?)

Now, the command gdb with core dump file works as expected. gdb ./testCoreDump /tmp/core

I think it is the best workaround I can find now.

it works for me! you saved my day! thank you very much!

@gurnec Thanks for the link I’d admit that if 2004 had rolled out fully or even to the majority of users, then that would be at least logical. But in reality 2004 is only in the early stages of what promises to be a pretty long roll-out.

My machine only received 1909 about March (4 months after initial “release”), if 2004 follows a similar trend I won’t see 2004 until September at least. To simply abandon the majority of users seems harebrained at best.

What seems to be happening morso is development aimed at people on faster rings. While I can see those rings provide good feedback, developing solely with those foremost in mind is probably part of the issue for these troubled OS roll-outs.

Echoing the sentiments stated by everyone here; this bug makes developing C++ programs very difficult. Are there any work-arounds for the time being?

thanks, it seems something is wrong with my network(failed to load js file on that page), after using a proxy everything works fine. @wolf99

@wolf99 I do agree with you, however the reality is that MS has limited resources (as do we all), and they’ve been shifting most of their WSL dev time to WSL2.

I’d be happy to be wrong, but reading between the lines leads me to believe that most issues such as this one which are working correctly in WSL2 won’t be addressed in WSL1 anytime in the foreseeable future, if at all.

it’s been a while, and I’m running into this on build 18262… have there been any updates?