Why is sbt crashing with java.io.IOException: permission denied on startup?

I have installed sbt on Mac OS X 10.9 via MacPorts. If I run sbt as root - everything works fine, but as a user - I got an exception.

java.io.IOException: Permission denied
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:1012)
at scala.reflect.io.AbstractFile.fileOrSubdirectoryNamed(AbstractFile.scala:235)
at scala.reflect.io.AbstractFile.fileNamed(AbstractFile.scala:246)
at scala.tools.nsc.backend.jvm.BytecodeWriters$class.getFile(BytecodeWriters.scala:34)
at scala.tools.nsc.backend.jvm.BytecodeWriters$class.scala$tools$nsc$backend$jvm$BytecodeWriters$$getFile(BytecodeWriters.scala:37)
at scala.tools.nsc.backend.jvm.BytecodeWriters$ClassBytecodeWriter$class.writeClass(BytecodeWriters.scala:89)
at scala.tools.nsc.backend.jvm.GenASM$AsmPhase$$anon$4.writeClass(GenASM.scala:67)
at scala.tools.nsc.backend.jvm.GenASM$JBuilder.writeIfNotTooBig(GenASM.scala:459)
at scala.tools.nsc.backend.jvm.GenASM$JMirrorBuilder.genMirrorClass(GenASM.scala:2980)
at scala.tools.nsc.backend.jvm.GenASM$AsmPhase.run(GenASM.scala:114)
at sbt.compiler.Eval$$anonfun$compile$1$1.apply$mcV$sp(Eval.scala:159)
at sbt.compiler.Eval$$anonfun$compile$1$1.apply(Eval.scala:159)
at sbt.compiler.Eval$$anonfun$compile$1$1.apply(Eval.scala:159)
at scala.reflect.internal.SymbolTable.atPhase(SymbolTable.scala:207)
at sbt.compiler.Eval.compile$1(Eval.scala:159)
at sbt.compiler.Eval.compileAndLoad(Eval.scala:164)
at sbt.compiler.Eval.evalCommon(Eval.scala:135)
at sbt.compiler.Eval.eval(Eval.scala:86)
at sbt.EvaluateConfigurations$.evaluateSetting(EvaluateConfigurations.scala:144)
at sbt.EvaluateConfigurations$$anonfun$9.apply(EvaluateConfigurations.scala:106)
at sbt.EvaluateConfigurations$$anonfun$9.apply(EvaluateConfigurations.scala:105)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.immutable.List.foreach(List.scala:318)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at sbt.EvaluateConfigurations$.evaluateSbtFile(EvaluateConfigurations.scala:105)
at sbt.Load$.sbt$Load$$loadSettingsFile$1(Load.scala:507)
at sbt.Load$$anonfun$sbt$Load$$memoLoadSettingsFile$1$1.apply(Load.scala:502)
at sbt.Load$$anonfun$sbt$Load$$memoLoadSettingsFile$1$1.apply(Load.scala:501)
at scala.Option.getOrElse(Option.scala:120)
at sbt.Load$.sbt$Load$$memoLoadSettingsFile$1(Load.scala:501)
at sbt.Load$$anonfun$loadSettings$1$2.apply(Load.scala:500)
at sbt.Load$$anonfun$loadSettings$1$2.apply(Load.scala:500)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at sbt.Load$.loadSettings$1(Load.scala:500)
at sbt.Load$.sbt$Load$$expand$1(Load.scala:523)
at sbt.Load$.loadSettings(Load.scala:528)
at sbt.Load$.sbt$Load$$loadSbtFiles$1(Load.scala:464)
at sbt.Load$.defaultLoad$1(Load.scala:475)
at sbt.Load$.loadTransitive(Load.scala:478)
at sbt.Load$.loadProjects$1(Load.scala:418)
at sbt.Load$.loadUnit(Load.scala:419)
at sbt.Load$$anonfun$15$$anonfun$apply$11.apply(Load.scala:256)
at sbt.Load$$anonfun$15$$anonfun$apply$11.apply(Load.scala:256)
at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:93)
at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:92)
at sbt.BuildLoader.apply(BuildLoader.scala:143)
at sbt.Load$.loadAll(Load.scala:312)
at sbt.Load$.loadURI(Load.scala:264)
at sbt.Load$.load(Load.scala:260)
at sbt.Load$.load(Load.scala:251)
at sbt.Load$.apply(Load.scala:134)
at sbt.Load$.buildPluginDefinition(Load.scala:613)
at sbt.Load$.buildPlugins(Load.scala:579)
at sbt.Load$.plugins(Load.scala:567)
at sbt.Load$.loadUnit(Load.scala:411)
at sbt.Load$$anonfun$15$$anonfun$apply$11.apply(Load.scala:256)
at sbt.Load$$anonfun$15$$anonfun$apply$11.apply(Load.scala:256)
at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:93)
at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:92)
at sbt.BuildLoader.apply(BuildLoader.scala:143)
at sbt.Load$.loadAll(Load.scala:312)
at sbt.Load$.loadURI(Load.scala:264)
at sbt.Load$.load(Load.scala:260)
at sbt.Load$.load(Load.scala:251)
at sbt.Load$.apply(Load.scala:134)
at sbt.Load$.defaultLoad(Load.scala:37)
at sbt.BuiltinCommands$.doLoadProject(Main.scala:473)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:467)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:467)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:60)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:60)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:62)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:62)
at sbt.Command$.process(Command.scala:95)
at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:100)
at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:100)
at sbt.State$$anon$1.process(State.scala:179)
at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:100)
at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:100)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.MainLoop$.next(MainLoop.scala:100)
at sbt.MainLoop$.run(MainLoop.scala:93)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:71)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:66)
at sbt.Using.apply(Using.scala:25)
at sbt.MainLoop$.runWithNewLog(MainLoop.scala:66)
at sbt.MainLoop$.runAndClearLast(MainLoop.scala:49)
at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:33)
at sbt.MainLoop$.runLogged(MainLoop.scala:25)
at sbt.StandardMain$.runManaged(Main.scala:57)
at sbt.xMain.run(Main.scala:29)
at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:129)
at xsbt.boot.Launch$.run(Launch.scala:109)
at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:36)
at xsbt.boot.Launch$.launch(Launch.scala:117)
at xsbt.boot.Launch$.apply(Launch.scala:19)
at xsbt.boot.Boot$.runImpl(Boot.scala:44)
at xsbt.boot.Boot$.main(Boot.scala:20)
at xsbt.boot.Boot.main(Boot.scala)

      

~ / .sbt / * ~ / .ivy2 / * are owned by my user / opt / local / share / sbt - in which the sbt script and sbt-launch.jar have 777 permission with these files.

It seems sbt wants to create the file somewhere and fails, if you don't know the exact solution for this please advise how I can debug. Is it possible to see some sbt log, or maybe there is some system tool to determine where sbt wants to create the file.

Thanks, I advise.

+3


source to share


1 answer


One of the reasons for this problem might be that you ran sbt as root :). When you did, sbt created things in your directory (like target directories) as root, and now they are owned by root. When you rerun sbt as yourself, you can no longer access those directories.

Now you need to either fix all the rights / permissions on the directory / files, or delete them all. When you rerun sbt from your account, it will re-create those directories / files in your account and it will work.



If you are working with a git repo, just re-clone the project and re-run sbt as yourself, not root.

+5


source







All Articles