Sample Header Ad - 728x90

Segmentation fault when running binaries from second drive

1 vote
2 answers
228 views
When I try to run any executable from my second (NTFS) drive, I get a segmentation fault. If I run the exact same executable from, for example, my home folder, it works just fine. For example: I compile the following C program using gcc a.c:
#include 

int main() {
    puts("Hello");
    return 0;
}
Now I run ./a.out from my second drive:
$ ./a.out
zsh: segmentation fault  ./a.out
(Also no core dump is generated, even though they are enabled and work for other things.) If I copy the exact same file, without any modifications, to e.g. /home/username/ (which is on my main/OS drive):
$ ./a.out
Hello
Everything works perfectly fine there. On the second drive however, GDB just fails during startup:
(gdb) starti
Starting program: /path/to/a.out 
During startup program terminated with signal SIGSEGV, Segmentation fault.
When I use strace, it says execve failed:
$ strace ./a.out
execve("./a.out", ["./a.out"], 0x7ffd0aa31070 /* 83 vars */) = -1 EOPNOTSUPP (Operation not supported)
+++ killed by SIGSEGV +++
zsh: segmentation fault (core dumped)  strace ./a.out
Also ldd just says not a dynamic executable on the second drive. readelf -d and objdump -p work just fine. My drive and one of its subfolders is mounted like this in /etc/fstab:
UUID=drive-uuid-123        /path/to/drive   ntfs3   defaults      0 2
/path/to/drive/some/path   /my/new/path     none    defaults,bind 0 2
The same issue occurs when I run the binary from yet another different NTFS drive. System information:
$ uname -a
Linux thomas-manjaro 6.6.25-1-MANJARO #1 SMP PREEMPT_DYNAMIC Thu Apr  4 20:32:38 UTC 2024 x86_64 GNU/Linux
This is a pretty fresh install of Manjaro and all packages are up-to-date. Does anyone know what the problem could be? Do I need to mount my drive in a different way? Do I need to set some kind of system variable?
Asked by Syntax (13 rep)
Apr 10, 2024, 08:17 PM
Last activity: Apr 11, 2024, 10:26 AM