1、Cannot create symlink to `xxx': Operation not supported

在虚拟机的共享目录中,解压内核源码,试过了几种解压方法都报出如下错误:

tar: linux-4.15/tools/testing/selftests/powerpc/vphn/vphn.h: Cannot create symlink to `../../../../../arch/powerpc/mm/vphn.h': Operation not supported
tar: linux-4.15/tools/testing/selftests/powerpc/vphn/vphn.c: Cannot create symlink to `../../../../../arch/powerpc/mm/vphn.c': Operation not supported
tar: linux-4.15/tools/testing/selftests/powerpc/stringloops/memcmp_64.S: Cannot create symlink to `../../../../../arch/powerpc/lib/memcmp_64.S': Operation not supported
tar: linux-4.15/tools/testing/selftests/powerpc/primitives/word-at-a-time.h: Cannot create symlink to `../../../../../arch/powerpc/include/asm/word-at-a-time.h': Operation not supported
tar: linux-4.15/tools/testing/selftests/powerpc/primitives/asm/ppc_asm.h: Cannot create symlink to `../../../../../../arch/powerpc/include/asm/ppc_asm.h': Operation not supported
tar: linux-4.15/tools/testing/selftests/powerpc/primitives/asm/asm-compat.h: Cannot create symlink to `../.././../../../../arch/powerpc/include/asm/asm-compat.h': Operation not supported
tar: linux-4.15/tools/testing/selftests/powerpc/copyloops/memcpy_power7.S: Cannot create symlink to `../../../../../arch/powerpc/lib/memcpy_power7.S': Operation not supported
tar: linux-4.15/tools/testing/selftests/powerpc/copyloops/memcpy_64.S: Cannot create symlink to `../../../../../arch/powerpc/lib/memcpy_64.S': Operation not supported
tar: linux-4.15/tools/testing/selftests/powerpc/copyloops/copyuser_power7.S: Cannot create symlink to `../../../../../arch/powerpc/lib/copyuser_power7.S': Operation not supported
tar: linux-4.15/tools/testing/selftests/powerpc/copyloops/copyuser_64.S: Cannot create symlink to `../../../../../arch/powerpc/lib/copyuser_64.S': Operation not supported
tar: linux-4.15/scripts/dtc/include-prefixes/xtensa: Cannot create symlink to `../../../arch/xtensa/boot/dts': Operation not supported
tar: linux-4.15/scripts/dtc/include-prefixes/sh: Cannot create symlink to `../../../arch/sh/boot/dts': Operation not supported
tar: linux-4.15/scripts/dtc/include-prefixes/powerpc: Cannot create symlink to `../../../arch/powerpc/boot/dts': Operation not supported
tar: linux-4.15/scripts/dtc/include-prefixes/openrisc: Cannot create symlink to `../../../arch/openrisc/boot/dts': Operation not supported
tar: linux-4.15/scripts/dtc/include-prefixes/nios2: Cannot create symlink to `../../../arch/nios2/boot/dts': Operation not supported
tar: linux-4.15/scripts/dtc/include-prefixes/mips: Cannot create symlink to `../../../arch/mips/boot/dts': Operation not supported
tar: linux-4.15/scripts/dtc/include-prefixes/microblaze: Cannot create symlink to `../../../arch/microblaze/boot/dts': Operation not supported
tar: linux-4.15/scripts/dtc/include-prefixes/metag: Cannot create symlink to `../../../arch/metag/boot/dts': Operation not supported
tar: linux-4.15/scripts/dtc/include-prefixes/h8300: Cannot create symlink to `../../../arch/h8300/boot/dts': Operation not supported
tar: linux-4.15/scripts/dtc/include-prefixes/dt-bindings: Cannot create symlink to `../../../include/dt-bindings': Operation not supported
tar: linux-4.15/scripts/dtc/include-prefixes/cris: Cannot create symlink to `../../../arch/cris/boot/dts': Operation not supported
tar: linux-4.15/scripts/dtc/include-prefixes/c6x: Cannot create symlink to `../../../arch/c6x/boot/dts': Operation not supported
tar: linux-4.15/scripts/dtc/include-prefixes/arm64: Cannot create symlink to `../../../arch/arm64/boot/dts': Operation not supported
tar: linux-4.15/scripts/dtc/include-prefixes/arm: Cannot create symlink to `../../../arch/arm/boot/dts': Operation not supported
tar: linux-4.15/scripts/dtc/include-prefixes/arc: Cannot create symlink to `../../../arch/arc/boot/dts': Operation not supported
tar: linux-4.15/include/dt-bindings/input/linux-event-codes.h: Cannot create symlink to `../../uapi/linux/input-event-codes.h': Operation not supported
tar: linux-4.15/arch/arm64/boot/dts/arm/vexpress-v2m-rs1.dtsi: Cannot create symlink to `../../../../arm/boot/dts/vexpress-v2m-rs1.dtsi': Operation not supported
tar: Exiting with failure status due to previous errors

根据这些报错信息,总结出报错原因为:

Cannot create symlink to `xxx': Operation not supported

我是在root状态下执行的解压命令,权限应该是没有问题的。

猜测是否是由于共享目录引起的愿意,当前待解压文件位于共享文件目录:

/mnt/hgfs/share2

试着将文件移入到其他目录:

我将待解压文件移入到home目录下,然后再使用解压命令进行解压,最后解压成功了,结果如下:

结果证明了猜测,是共享目录造成了解压失败,可能是因为windows与linux共享目录,在两种环境下造成的原因。但是造成原因的具体情况还是不太清楚,所以进一步通过搜索该问题了解该问题产生原因。

找到如下解释:

1、https://blog.csdn.net/leeafu/article/details/7449578

Windows共享目录, fat分区等是不支持linux的符号链接,必须在ext3/4, btrfs等这些分区格式的目录下解压。

2、https://blog.csdn.net/yanhe156/article/details/79768290

linux处理的时候把fat/vfat/fat32的文件系统 统一用vfat来表示,windows下的FAT,FAT32,NTFS文件系统是不支持linux的symbok link的。

……

从这些博客中,了解到了问题产生的具体原因,即windows下的文件系统,不支持linux的symbok link的。所以造成了解压失败,将文件移出共享文件再解压即可

但是我解压文件是想在Windows下进行查看,所以我使用mv命令移动解压后的目录进入到共享目录中,这时又遇到了如下问题:

cannot create symbolic link `xxx': Operation not supported

2、cannot create symbolic link `xxx': Operation not supported

又是一堆报错信息:

mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/Documentation/Changes': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/include/dt-bindings/input/linux-event-codes.h': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/scripts/dtc/include-prefixes/metag': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/scripts/dtc/include-prefixes/arm64': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/scripts/dtc/include-prefixes/h8300': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/scripts/dtc/include-prefixes/c6x': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/scripts/dtc/include-prefixes/arm': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/scripts/dtc/include-prefixes/microblaze': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/scripts/dtc/include-prefixes/dt-bindings': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/scripts/dtc/include-prefixes/powerpc': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/scripts/dtc/include-prefixes/arc': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/scripts/dtc/include-prefixes/xtensa': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/scripts/dtc/include-prefixes/mips': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/scripts/dtc/include-prefixes/cris': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/scripts/dtc/include-prefixes/sh': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/scripts/dtc/include-prefixes/openrisc': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/scripts/dtc/include-prefixes/nios2': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/tools/testing/selftests/powerpc/vphn/vphn.c': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/tools/testing/selftests/powerpc/vphn/vphn.h': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/tools/testing/selftests/powerpc/copyloops/copyuser_64.S': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/tools/testing/selftests/powerpc/copyloops/memcpy_64.S': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/tools/testing/selftests/powerpc/copyloops/copyuser_power7.S': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/tools/testing/selftests/powerpc/copyloops/memcpy_power7.S': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/tools/testing/selftests/powerpc/primitives/asm/ppc_asm.h': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/tools/testing/selftests/powerpc/primitives/asm/asm-compat.h': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/tools/testing/selftests/powerpc/primitives/word-at-a-time.h': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/tools/testing/selftests/powerpc/stringloops/memcmp_64.S': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/arch/arm64/boot/dts/arm/vexpress-v2m-rs1.dtsi': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/arch/arm/boot/dts/sun8i-a33-et-q8-v1.6.dts': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/arch/arm/boot/dts/sun8i-a23-ippo-q8h-v1.2.dts': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/arch/arm/boot/dts/sun8i-a23-ippo-q8h-v5.dts': Operation not supported
mv: cannot create symbolic link `/mnt/hgfs/share2/linux-4.15/arch/arm/boot/dts/sun8i-a33-ippo-q8h-v1.2.dts': Operation not supported

总结起来就是:cannot create symbolic link `xxx': Operation not supported

通过报错信息,感觉还是和上面同样的问题,还是Windows文件系统不支持符号链接(symbolic link)。

试了 mv 不行,准备再用 cp 试试:

通过:

cp --help

 得到cp指令使用方式:

结合博客《cp命令详解》,使用了如下cp 命令进行copy

方式1:

cp -a linux-4.15 /mnt/hgfs/share2/linux-4.15

方式2:

cp -r linux-4.15 /mnt/hgfs/share2/linux-4.15

方式3:

cp -r -d linux-4.15 /mnt/hgfs/share2/linux-4.15

都存在这种问题,于是另外想解决方案,既然拷贝文件不行,将这个文件压缩为zip格式来进行拷贝,这样在共享文件中也好解压。

使用命令:

zip -r linux-4.15.zip linux-4.15

压缩为 zip 后,再使用 cp 命令进行拷贝,拷贝成功后,使用Windows工具解压,或者使用unzip解压都可以,这时候不会报出Operation not supported 的问题。

 

3、总结

Cannot create symlink to `xxx': Operation not supported
Cannot create symbolic to `xxx': Operation not supported

两个问题都是windows下的文件系统,不支持linux的symbok link 造成的,知道这个原因后有很多解决方案,但是感觉我这个方式有点绕,主要就是避开Windows与Linux的差异。

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐