LoginSignup
6

More than 5 years have passed since last update.

/tmpがnoexec指定されていてrbenv installなどがコケるとき

Posted at

/tmpnoexecでmountされていてrbenv installがコケるときは、環境変数TMPDIRに別のディレクトリを指定してあげればおk。


コケたときのコンソールの出力はこんな感じ。

$ rbenv install 2.1.0
Downloading yaml-0.1.5.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/24f6093c1e840ca5df2eb09291a1dbf1
Installing yaml-0.1.5...

BUILD FAILED

Inspect or clean up the working tree at /tmp/ruby-build.20140216215447.28528
Results logged to /tmp/ruby-build.20140216215447.28528.log

Last 10 log lines:
yaml-0.1.5/tests/run-scanner.c
yaml-0.1.5/tests/Makefile.am
yaml-0.1.5/tests/Makefile.in
yaml-0.1.5/tests/example-reformatter-alt.c
yaml-0.1.5/tests/run-parser.c
yaml-0.1.5/tests/example-reformatter.c
yaml-0.1.5/tests/example-deconstructor.c
yaml-0.1.5/tests/test-version.c
/tmp/ruby-build.20140216215447.28528/yaml-0.1.5 /tmp/ruby-build.20140216215447.28528 ~
/var/lib/fluentd/.rbenv/plugins/ruby-build/bin/ruby-build: line 416: ./configure: Permission denied

BUILD FAILED

Inspect or clean up the working tree at /tmp/ruby-build.20140216215447.28528
Results logged to /tmp/ruby-build.20140216215447.28528.log

Last 10 log lines:
yaml-0.1.5/tests/run-scanner.c
yaml-0.1.5/tests/Makefile.am
yaml-0.1.5/tests/Makefile.in
yaml-0.1.5/tests/example-reformatter-alt.c
yaml-0.1.5/tests/run-parser.c
yaml-0.1.5/tests/example-reformatter.c
yaml-0.1.5/tests/example-deconstructor.c
yaml-0.1.5/tests/test-version.c
/tmp/ruby-build.20140216215447.28528/yaml-0.1.5 /tmp/ruby-build.20140216215447.28528 ~
/var/lib/fluentd/.rbenv/plugins/ruby-build/bin/ruby-build: line 416: ./configure: Permission denied

Permission deniedと言ってお亡くなりになるので一瞬考える。
が、mountオプション確認してみるとnoexec指定で/tmpがmountされていることに気づく。

# mount | grep /tmp
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noexec,relatime)

なのでexecute可能な別のディレクトリ(マウントポイント)をTMPDIRとして指定する。

$ TMPDIR="${PWD}/tmp" rbenv install 2.1.0

これで大丈夫、たぶん。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6