cp: cannot create symbolic link Operation not permitted

在尝试将包含符号链接的目录从ext3文件系统拷贝到smbfs共享的目录时遇到“Operation not permitted”错误。该问题源于目标文件系统(可能是FAT或NTFS)不支持符号链接。
部署运行你感兴趣的模型镜像

在Linux下,将某个目录及其下所有文件拷贝到另外一个目录,结果拷贝过程中出错:

cp: cannot create symbolic link `/mnt/linuxdev/Focus/carifan/kernel/2007R1/Bfin_425/linux-2.6.x/Focus/include/asm’: Operation not permitted

【解决过程】

网上搜了下,得知,此处不能创建符号链接,主要有两种可能,

1.没有权限

此处已经保证包括的源和目的地,都是由权限操作的,排除此原因。

2.目标文件系统不支持符号链接

此处经过去查看目标文件夹,是什么文件系统的,查得是smbfs:

[e516537@RD-Linux-2420 ~]$ ls /mnt/linuxdev/Focus/carifan/kernel/2007R1/Bfin_425 -l
total 4
drwxrwxrwx 1 root RandD 4096 Aug 26 01:47 linux-2.6.x
[e516537@RD-Linux-2420 ~]$ ls /usr/src/blackfin/ADI_release/kernel/2007R1/carifan_Bfin_425 -l
total 224
drwxr-xr-x 11 e516537 root 4096 Aug 23 02:52 bfin_patch
-rwxr-xr-x 1 e516537 root 4023 Aug 23 01:22 bfin-serial-handle-status.patch
。。。

drwxr-xr-x 29 e516537 root 4096 Aug 23 23:39 linux-2.6.x
-rw-r–r– 1 e516537 root 13648 Aug 23 01:36 Makefile
。。。

drwxr-xr-x 66 e516537 root 4096 Aug 23 02:56 vendors
[e516537@RD-Linux-2420 ~]$ mount 
/dev/sda5 on / type ext3 (rw)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda3 on /boot type ext3 (rw)
none on /dev/shm type tmpfs (rw)
/dev/sdb1 on /newdisk type ext3 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
//nj55w2572/LinuxDev on /mnt/beta/linuxdev type smbfs (0)
nfsd on /proc/fs/nfsd type nfsd (rw)
/dev/sdc1 on /mnt/USBext type ext2 (rw)
[e516537@RD-Linux-2420 ~]$ df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sda5 ext3 233918968 123418360 98618136 56% /
/dev/sda3 ext3 194449 23555 160854 13% /boot
none tmpfs 516604 0 516604 0% /dev/shm
/dev/sdb1 ext3 307663800 177760488 114274880 61% /newdisk
//nj55w2572/LinuxDev
smbfs
 1120894976 1046872064 74022912 94% /mnt/beta/linuxdev
/dev/sdc1 ext2 961432072 961432072 0 100% /mnt/USBext

[e516537@RD-Linux-2420 ~]$ ls /mnt/ -l
total 64
drwxr-xr-x 5 root root 4096 Feb 7 2007 beta
drwxr-xr-x 2 rddev RandD 4096 Apr 19 2006 betalinuxdev
drwxr-xr-x 3 root root 4096 May 14 2007 bwfile02
lrwxrwxrwx 1 root root 13 Feb 8 2007 linuxdev -> beta/linuxdev
lrwxrwxrwx 1 root root 12 Jan 2 2007 _linuxdev.backup -> betalinuxdev
drwxr-xr-x 2 root root 4096 Nov 7 2005 RP
drwxr-xr-x 2 root root 4096 Jul 27 2009 test1
drwxr-xr-x 3 root root 16384 Aug 20 00:00 USBext

即,源文件夹是 /usr/src/blackfin/ADI_release/kernel/2007R1/carifan_Bfin_425,属于/目录下面,对应的是ext3,因此本身是支持符号链接的,而目标文件夹是 /mnt/linuxdev/Focus/carifan/kernel/2007R1/Bfin_425 属于/mnt下面的linuxdev,即/mnt/beta/linuxdev,属于smbfs,是通过SMB共享出来的目录,那对应的原始文件夹//nj55w2572/LinuxDev,看来应该是从某个Windows服务器共享过来的,文件系统是FAT或NTFS的,所以不支持符号链接。

即,此处拷贝的源文件夹是支持符号链接,要拷贝到的目标文件夹,不支持符号链接,所以才会报错。但知道原因,也无法解决,因为此处又不能更换smbfs。。。

总之是文件系统问题(是否支持符号链接)

您可能感兴趣的与本文相关的镜像

Stable-Diffusion-3.5

Stable-Diffusion-3.5

图片生成
Stable-Diffusion

Stable Diffusion 3.5 (SD 3.5) 是由 Stability AI 推出的新一代文本到图像生成模型,相比 3.0 版本,它提升了图像质量、运行速度和硬件效率

[root@yfw ~]# cd /opt/openfire [root@yfw openfire]# cat > install-sdk.sh << 'EOF' > #!/bin/bash > # > # Copyright (C) Jive Software, 2006-2022 > # > # Install the Openfire SDK into your local Maven repository. > # > > set -e > > # Check for required tools > if ! command -v mvn >/dev/null 2>&1; then > echo "Maven is required but not found. Please install Maven." > exit 1 > fi > > VERSION=$1 > if [ -z "$VERSION" ]; then > echo "Usage: $0 <version>" > echo "Example: $0 4.9.2" > exit 1 > fi > > REPO_DIR="$HOME/.m2/repository/org/igniterealtime/openfire/openfire/$VERSION" > > echo "Installing Openfire SDK version $VERSION..." > > # Create target directory > mkdir -p "$REPO_DIR" > > # Download openfire-${VERSION}.jar and openfire-${VERSION}-sources.jar > JAR_URL="https://www.igniterealtime.org/downloadServlet?filename=openfire/openfire_${VERSION}.zip" > > echo "Downloading Openfire distribution package..." > TMP_ZIP=$(mktemp -t openfire-sdk-XXXXXX.zip) > wget -qO "$TMP_ZIP" "$JAR_URL" > > # Extract JAR and POM > unzip -p "$TMP_ZIP" openfire/lib/openfire.jar > "$REPO_DIR/openfire-$VERSION.jar" > unzip -p "$TMP_ZIP" openfire/lib/compile-only/pom.xml > "$REPO_DIR/openfire-$VERSION.pom" > > # Also install sources if available (optional) > if unzip -p "$TMP_ZIP" openfire/src/openfire_src.zip > /dev/null 2>&1; then > unzip -p "$TMP_ZIP" openfire/src/openfire_src.zip > "$REPO_DIR/openfire-$VERSION-sources.jar" > else > touch "$REPO_DIR/openfire-$VERSION-sources.jar" > fi > > # Cleanup > rm -f "$TMP_ZIP" > > echo "[INFO] SDK installed successfully at $REPO_DIR" > echo "[INFO] You can now build Openfire plugins using Maven." > EOF [root@yfw openfire]# [root@yfw openfire]# # 添加可执行权限 [root@yfw openfire]# chmod +x install-sdk.sh [root@yfw openfire]# ./install-sdk.sh 4.9.2 Maven is required but not found. Please install Maven. [root@yfw openfire]# ls ~/.m2/repository/org/igniterealtime/openfire/openfire/4.9.2/ ls: cannot access '/root/.m2/repository/org/igniterealtime/openfire/openfire/4.9.2/': No such file or directory [root@yfw openfire]# # 查看 rpm 是否已安装 maven 包 [root@yfw openfire]# rpm -q maven maven-3.5.4-5.module_el8.0.0+39+6a9b6e22.noarch [root@yfw openfire]# # 查找 mvn 所在位置 [root@yfw openfire]# find /usr -name mvn 2>/dev/null /usr/share/bash-completion/completions/mvn /usr/share/maven/bin/mvn [root@yfw openfire]# ln -s /usr/share/maven/bin/mvn /usr/local/bin/mvn ln: failed to create symbolic link '/usr/local/bin/mvn': Operation not permitted [root@yfw openfire]# mvn -v -bash: mvn: command not found [root@yfw openfire]# export PATH=/usr/share/maven/bin:$PATH [root@yfw openfire]# mvn -v /usr/share/maven/bin/mvn: line 118: build-classpath: command not found Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher [root@yfw openfire]# echo 'export PATH=/usr/share/maven/bin:$PATH' >> ~/.bashrc -bash: /root/.bashrc: Operation not permitted [root@yfw openfire]# source ~/.bashrc manpath: can't set the locale; make sure $LC_* and $LANG are correct [root@yfw openfire]# mvn -v -bash: mvn: command not found [root@yfw openfire]#
10-02
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值