windows下:Failed to set permissions of path: \tmp\ \.staging to 0700

Posted GeoWin_CAU

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了windows下:Failed to set permissions of path: \tmp\ \.staging to 0700相关的知识,希望对你有一定的参考价值。

这个官方的bug之前遇到过。。。。。。。。。。。。。。。。。。。。。可是。。。。。。。

==================================================

12/04/24 15:32:44 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
12/04/24 15:32:44 ERROR security.UserGroupInformation: PriviledgedActionException as:Administrator cause:java.io.IOException: Failed to set permissions of path: \tmp\hadoop-Administrator\mapred\staging\Administrator-519341271\.staging to 0700
Exception in thread "main" java.io.IOException: Failed to set permissions of path: \tmp\hadoop-Administrator\mapred\staging\Administrator-519341271\.staging to 0700

==========================================================================

这个是Windows下文件权限问题,在Linux下可以正常运行,不存在这样的问题。

解决方法是,修改/hadoop-1.0.2/src/core/org/apache/hadoop/fs/FileUtil.java里面的checkReturnValue,注释掉即可(有些粗暴,在Window下,可以不用检查)

......  
  private static void checkReturnValue(boolean rv, File p,  
                                       FsPermission permission  
                                       ) throws IOException {  
    /** 
if (!rv) { 
throw new IOException("Failed to set permissions of path: " + p + 
" to " + 
String.format("%04o", permission.toShort())); 
} 
**/  
  }  

 重新编译打包hadoop-core-1.0.2.jar,替换掉hadoop-1.0.2根目录下的hadoop-core-1.0.2.jar即可。

也可以把源码中的org.apache.hadoop.fs包一起拷贝到项目中,然后修改FileUtil.java中的checkReturnValue方法把里面的内容注释掉即可

替换之后,刷新项目,设置好正确的jar包依赖,现在再运行WordCountTest,即可。

====================================================================================

官方BUG参考:

https://issues.apache.org/jira/browse/HADOOP-7682

解决方法:

1、下载并解压http://mirror.bit.edu.cn/apache/hadoop/common/hadoop-1.1.2/hadoop-1.1.2.tar.gz

2、修改hadoop-1.1.2\src\core\org\apache\hadoop\fs\FileUtil.java,搜索 Failed to set permissions of path,找到689行,把throw new IOException改为LOG.warn

3、修改hadoop-1.1.2\build.xml,搜索autoreconf,移除匹配的6个executable="autoreconf"的exec配置

4、下载解压ant,将ant目录下的bin目录加入环境变量path

5、在命令行切换到hadoop-1.1.2目录,执行ant

6、用新生成的hadoop-1.1.2\build\hadoop-core-1.1.3-SNAPSHOT.jar替换hadoop-core-1.0.3.jar

以上是关于windows下:Failed to set permissions of path: \tmp\ \.staging to 0700的主要内容,如果未能解决你的问题,请参考以下文章

解决Windows下Docker Failed to Start - Docker Desktop for Windows

基于WSL2 的 Docker Desktop 启动时 Failed to set version to docker-desktop exit code -1的解决方法

在 selinux 强制模式下,startx 失败。 Xorg.0.log show: xf86EnableIOPorts: failed to set IOPL for I/O (Operation

Unable to save settings: Failed to save settings. Please restart PyCharm解决

windows下启动redis提示Invalid argument during startup: Failed to open the .conf file: redis.windows.connf

Failed to create pod sandbox: rpc error: code = Unknown desc = [failed to set up sandbox container..