Windows11下Ubuntu WSL执行程序时遭遇libc.so.6权限拒绝错误求助
Hey there, let's work through this permission denied error with libc.so.6 when running your stereo program in Ubuntu WSL on Windows 11. I've dealt with similar WSL permission quirks before, so here are some practical steps to troubleshoot and fix it:
Check the permissions of libc.so.6 and its target file
First, let's verify the current permissions of the libc symlink and the actual library file it points to. Run this command:ls -l /lib/x86_64-linux-gnu/libc.so.6
You should see output likelrwxrwxrwx 1 root root 12 Aug 1 10:00 /lib/x86_64-linux-gnu/libc.so.6 -> libc-2.31.so(the version number might vary). The symlink itself usually has wide-open permissions, but the targetlibc-2.x.sofile needs to be readable and executable by all users. If its permissions are off, fix them with:sudo chmod 755 /lib/x86_64-linux-gnu/libc-2.31.so(replace2.31with your actual version from the symlink output)Verify your stereo program has execute permissions
The error mentions the path/home/prankur_sharma/prankur_23/dem_gen/sw/StereoPipeline-2.7.0-2020-07-29-x86_64-Linux/bin/stereo—make sure this binary has the right to run. Check with:ls -l /home/prankur_sharma/prankur_23/dem_gen/sw/StereoPipeline-2.7.0-2020-07-29-x86_64-Linux/bin/stereo
If you don't see anxin the permission string (like-rw-r--r--), add execute permissions with:chmod +x /home/prankur_sharma/prankur_23/dem_gen/sw/StereoPipeline-2.7.0-2020-07-29-x86_64-Linux/bin/stereoAvoid running programs from Windows-mounted drives
If your StereoPipeline folder is stored on a Windows drive (like/mnt/cor/mnt/d), WSL's permission mapping for Windows files can cause unexpected issues. Try moving the entireStereoPipeline-2.7.0-2020-07-29-x86_64-Linuxdirectory to your WSL home folder (e.g.,/home/prankur_sharma/) and run the program from there instead.Reinstall the libc6 package
If the libc library file itself is corrupted or has incorrect permissions due to a bad update, reinstalling it can reset things to default:sudo apt-get update && sudo apt-get install --reinstall libc6Check for AppArmor restrictions
While WSL doesn't enable AppArmor by default in most cases, it's worth ruling out. Temporarily stop the AppArmor service and test your program:sudo systemctl stop apparmor
If this fixes the issue, you can disable it permanently withsudo systemctl disable apparmor(though only do this if you're sure you don't need it).
Try these steps one at a time, and let me know if any of them resolves your problem. If not, we can also check if switching between WSL1 and WSL2 makes a difference—sometimes the two versions handle permissions differently.
备注:内容来源于stack exchange,提问作者Prankur Sharma

