freechipsproject / chisel-bootcamp

Generator Bootcamp Material: Learn Chisel the Right Way
Apache License 2.0
956 stars 275 forks source link

Failed to resolve ivy dependencies:/coursier_cache/.structure.lock (Permission denied) #140

Open mirale386 opened 3 years ago

mirale386 commented 3 years ago

local install follow the Local Installation using Docker - Linux/Mac/Windows

java -version : image

image

how to slove this problem : ammonite.util.CompilationError: Failed to resolve ivy dependencies:/coursier_cache/.structure.lock (Permission denied)?

image

detail:

Compiling (synthetic)/ammonite/predef/replBridge.sc
Compiling (synthetic)/ammonite/predef/kernelBridge.sc
Compiling (synthetic)/ammonite/predef/defaultPredef.sc
ERROR Execute exception in user code (Failed to resolve ivy dependencies:/coursier_cache/.structure.lock (Permission denied))
ammonite.util.CompilationError: Failed to resolve ivy dependencies:/coursier_cache/.structure.lock (Permission denied)
  ammonite.interp.Interpreter$$anon$1$load$.module(Interpreter.scala:716)
  ammonite.$sess.cmd0$Helper.<init>(cmd0.sc:2)
  ammonite.$sess.cmd0$.<init>(cmd0.sc:7)
  ammonite.$sess.cmd0$.<clinit>(cmd0.sc)
  ammonite.$sess.cmd0.$main(cmd0.sc)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  java.lang.reflect.Method.invoke(Method.java:498)
  ammonite.runtime.Evaluator$$anon$1.$anonfun$evalMain$1(Evaluator.scala:108)
  ammonite.util.Util$.withContextClassloader(Util.scala:24)
  ammonite.runtime.Evaluator$$anon$1.evalMain(Evaluator.scala:90)
  ammonite.runtime.Evaluator$$anon$1.$anonfun$processLine$2(Evaluator.scala:127)
  ammonite.util.Catching.map(Res.scala:117)
  ammonite.runtime.Evaluator$$anon$1.$anonfun$processLine$1(Evaluator.scala:121)
  ammonite.util.Res$Success.flatMap(Res.scala:62)
  ammonite.runtime.Evaluator$$anon$1.processLine(Evaluator.scala:120)
  ammonite.interp.Interpreter.$anonfun$evaluateLine$4(Interpreter.scala:296)
  ammonite.util.Res$Success.flatMap(Res.scala:62)
  ammonite.interp.Interpreter.$anonfun$evaluateLine$2(Interpreter.scala:282)
  ammonite.util.Catching.flatMap(Res.scala:115)
  ammonite.interp.Interpreter.evaluateLine(Interpreter.scala:281)
  ammonite.interp.Interpreter.$anonfun$processLine$6(Interpreter.scala:268)
  ammonite.util.Res$Success.flatMap(Res.scala:62)
  ammonite.interp.Interpreter.$anonfun$processLine$4(Interpreter.scala:252)
  ammonite.util.Res$Success.flatMap(Res.scala:62)
  ammonite.interp.Interpreter.$anonfun$processLine$2(Interpreter.scala:245)
  ammonite.util.Catching.flatMap(Res.scala:115)
  ammonite.interp.Interpreter.processLine(Interpreter.scala:244)
  almond.Execute.$anonfun$ammResult$9(Execute.scala:227)
  almond.internals.CaptureImpl.$anonfun$apply$2(CaptureImpl.scala:53)
  scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
  scala.Console$.withErr(Console.scala:196)
  almond.internals.CaptureImpl.$anonfun$apply$1(CaptureImpl.scala:45)
  scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
  scala.Console$.withOut(Console.scala:167)
  almond.internals.CaptureImpl.apply(CaptureImpl.scala:45)
  almond.Execute.capturingOutput(Execute.scala:165)
  almond.Execute.$anonfun$ammResult$8(Execute.scala:223)
  almond.Execute.$anonfun$withClientStdin$1(Execute.scala:145)
  scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
  scala.Console$.withIn(Console.scala:230)
  almond.Execute.withClientStdin(Execute.scala:141)
  almond.Execute.$anonfun$ammResult$7(Execute.scala:223)
  almond.Execute.withInputManager(Execute.scala:133)
  almond.Execute.$anonfun$ammResult$6(Execute.scala:222)
  ammonite.repl.Signaller.apply(Signaller.scala:28)
  almond.Execute.interruptible(Execute.scala:182)
  almond.Execute.$anonfun$ammResult$5(Execute.scala:221)
  ammonite.util.Res$Success.flatMap(Res.scala:62)
  almond.Execute.$anonfun$ammResult$1(Execute.scala:212)
  almond.Execute.withOutputHandler(Execute.scala:156)
  almond.Execute.ammResult(Execute.scala:212)
  almond.Execute.apply(Execute.scala:296)
  almond.ScalaInterpreter.execute(ScalaInterpreter.scala:120)
  almond.interpreter.InterpreterToIOInterpreter.$anonfun$execute$2(InterpreterToIOInterpreter.scala:69)
  cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:87)
  cats.effect.internals.IORunLoop$RestartCallback.signal(IORunLoop.scala:355)
  cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:376)
  cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:316)
  cats.effect.internals.IOShift$Tick.run(IOShift.scala:36)
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  java.lang.Thread.run(Thread.java:748)
zhizhang77 commented 3 years ago

It seems the dockerfile is somewhat buggy. Directory "/coursier_cache" is owned by user "root", so the active user "bootcamp" can't write into it properly. A quickfix as below works for me:

FROM ucbbar/chisel-bootcamp:latest

RUN cp -r /coursier_cache /home/bootcamp/coursier_cache
ENV COURSIER_CACHE=/home/bootcamp/coursier_cache

USER bootcamp
WORKDIR /chisel-bootcamp

EXPOSE 8888
CMD jupyter notebook --no-browser --ip 0.0.0.0 --port 8888

Save the dockerfile and build it. Then you can run the new image just as the original one.

docker build -t bootcamp_fix:0.01 . docker run -it --rm -p 8888:8888 bootcamp_fix:0.01

JellyDa commented 2 years ago

It seems the dockerfile is somewhat buggy. Directory "/coursier_cache" is owned by user "root", so the active user "bootcamp" can't write into it properly. A quickfix as below works for me:

FROM ucbbar/chisel-bootcamp:latest

RUN cp -r /coursier_cache /home/bootcamp/coursier_cache
ENV COURSIER_CACHE=/home/bootcamp/coursier_cache

USER bootcamp
WORKDIR /chisel-bootcamp

EXPOSE 8888
CMD jupyter notebook --no-browser --ip 0.0.0.0 --port 8888

Save the dockerfile and build it. Then you can run the new image just as the original one.

docker build -t bootcamp_fix:0.01 . docker run -it --rm -p 8888:8888 bootcamp_fix:0.01

It's work for me ,thanks

sifive-benjamin-morse commented 1 year ago

If you get this error from an already running docker you can do this (with a machine named cool_knuth):

docker exec --user root -it cool_knuth chown -R bootcamp:bootcamp /coursier_cache
TDppy commented 1 year ago

If you get this error from an already running docker you can do this (with a machine named cool_knuth):

docker exec --user root -it cool_knuth chown -R bootcamp:bootcamp /coursier_cache

Your solution really work!