Arch Linux下在exFAT共享分区使用Cargo编译时出现「Operation not permitted」错误的问题求助
大家好,我遇到了一个百思不得其解的问题,想请各位帮忙分析一下:
我在PC上搭建了双系统环境:Windows对应NTFS分区,Arch Linux用ext4分区,另外还有一个exFAT分区专门用来共享跨系统的数据。这个共享分区在Arch里是通过/etc/fstab配置挂载的,具体内容如下:
LABEL=Data /run/mount/Data exfat rw,relatime,fmask=0000,dmask=0000
挂载点是/run/mount/Data,所有文件和目录都被设置为rwxrwxrwx权限,之前用这个分区存文件、读写数据都没出过问题,但今天尝试在上面用Cargo编译Rust项目时,却频繁报错。
我用cargo new test-crate创建了一个默认的「Hello, World」项目,运行cargo run或者cargo build时,会输出大量类似下面的警告和最终错误:
Compiling test-crate v0.1.0 (/run/mount/Data/test-crate)
warning: error copying object file/run/mount/Data/test-crate/target/debug/deps/test_crate-171d3f4b5eb94014.1844j56bgs10zwdjmbmp4ewcl.rcgu.oto incremental directory as/run/mount/Data/test-crate/target/debug/incremental/test_crate-1cwjhrbi82tge/s-h75ofrd5kj-040rlag-working/1844j56bgs10zwdjmbmp4ewcl.o: Operation not permitted (os error 1)
warning: error copying object file/run/mount/Data/test-crate/target/debug/deps/test_crate-171d3f4b5eb94014.1xv4e2iaijt2221ugfejfkj9p.rcgu.oto incremental directory as/run/mount/Data/test-crate/target/debug/incremental/test_crate-1cwjhrbi82tge/s-h75ofrd5kj-040rlag-working/1xv4e2iaijt2221ugfejfkj9p.o: Operation not permitted (os error 1)
...(共6条类似警告)
warning:test-crate(bin "test-crate") generated 6 warnings
error: failed to link or copy/run/mount/Data/test-crate/target/debug/deps/test_crate-171d3f4b5eb94014to/run/mount/Data/test-crate/target/debug/test-crate
Caused by:
Operation not permitted (os error 1)
我检查了项目目录的权限,所有文件和目录确实都是rwxrwxrwx,理论上不该存在权限限制:
-rwxrwxrwx 1 root root 154 May 8 15:46 Cargo.lock -rwxrwxrwx 1 root root 81 May 8 15:46 Cargo.toml drwxrwxrwx 2 root root 131072 May 8 15:46 src drwxrwxrwx 3 root root 131072 May 8 15:48 target
另外我做了几个测试:
- 在Arch的ext4分区编译Rust项目完全正常;
- 在Windows系统下,用这个exFAT分区编译Rust项目也没有问题;
- 尝试用
sudo cargo run编译默认的「Hello, World」项目,虽然能成功,但如果给项目添加lib.rs这类文件,编译器直接panic:
Compiling test-crate v0.1.0 (/run/mount/Data/test-crate)
warning: hard linking files in the incremental compilation cache failed. copying files instead. consider moving the cache directory to a file system which supports hard linking in session dir/run/mount/Data/test-crate/target/debug/incremental/test_crate-3aiikf0zz4qco/s-h75olu36wq-0bx3gll-working
error: cached cgu 3jc4qbatsnqtmfg9qzi0sbrfc should have an object file, but doesn't
thread 'coordinator' panicked at /usr/src/debug/rust/rustc-1.86.0-src/compiler/rustc_codegen_ssa/src/back/write.rs:1680:29:
/usr/src/debug/rust/rustc_codegen_ssa/src/back/write.rs:1680:29: worker thread panicked
stack backtrace:
0: 0x7cd9e10dd6b0 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h1a61e653684797d4
1: 0x7cd9e112c6e3 - core::fmt::write::hef3878caa31fc074
2: 0x7cd9e10d1db3 -
...(省略部分栈追踪内容)
实在搞不懂,明明权限已经全开了,为什么还会出现「Operation not permitted」的错误?有没有大佬遇到过类似的情况,或者能给我一些排查的方向?
内容来源于stack exchange

