Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: cannot create directory ‘/opt/asdf-vm/tmp’: Permission denied #277

Closed
wandyirawan opened this issue Dec 22, 2021 · 9 comments · Fixed by #279
Closed

bug: cannot create directory ‘/opt/asdf-vm/tmp’: Permission denied #277

wandyirawan opened this issue Dec 22, 2021 · 9 comments · Fixed by #279

Comments

@wandyirawan
Copy link

Describe the Bug

when i try install nodejs, show error mkdir: cannot create directory ‘/opt/asdf-vm/tmp’: Permission denied

Steps to Reproduce

asdf list all nodejs 14

Expected Behaviour

show all list nodejs

Actual Behaviour

mkdir: cannot create directory ‘/opt/asdf-vm/tmp’: Permission denied

Environment

OS:
Linux pahvo 5.10.84-1-MANJARO asdf-vm/asdf#1 SMP PREEMPT Wed Dec 8 09:50:30 UTC 2021 x86_64 GNU/Linux

SHELL:
zsh 5.8 (x86_64-pc-linux-gnu)

ASDF VERSION:
v0.8.1

ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/opt/asdf-vm

ASDF INSTALLED PLUGINS:
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git

asdf plugins affected (if relevant)

ASDF INSTALLED PLUGINS:
nodejs https://github.com/asdf-vm/asdf-nodejs.git

@Stratus3D Stratus3D transferred this issue from asdf-vm/asdf Dec 23, 2021
@Stratus3D
Copy link
Member

@wandyirawan I think this issue is specific to the nodejs plugin so I have transferred it to the asdf-nodejs repo issue tracker.

@augustobmoura this bug doesn't look familiar to me, so I was wondering if you thought this might have anything to do with the recent PRs.

@dsakuma
Copy link

dsakuma commented Dec 23, 2021

I'm having the same problem. Also using Manjaro Linux and asdf v0.8.1

My ~/.tool-versions:

nodejs 14.18.0

When running asdf install

The following message is displayed:
mkdir: cannot create directory ‘/opt/asdf-vm/tmp’: Permission denied

@gkapfham
Copy link

I am writing to confirm that I am experiencing the same error on Arch Linux. Here are details about my operating system:

Linux  5.15.10-arch1-1 #1 SMP PREEMPT Fri, 17 Dec 2021 11:17:37 +0000 x86_64 GNU/Linux

Here is the version of asdf that I am currently running:

v0.8.1

I typed the following command that I found from the README file:

asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git

If I type the command asdf list all nodejs I see the following error in my terminal window:

mkdir: cannot create directory ‘/opt/asdf-vm/tmp’: Permission denied

Thanks for your work on this plugin for asdf! If you have any feedback on how to resolve this issue, it would be greatly appreciated!

@augustobmoura
Copy link
Member

augustobmoura commented Dec 24, 2021

Hmm, I think I know what is going on. It was actually a "bugfix" that made this current bug surface. If you look on commit 800e244, on file lib/utils.sh existed a typo, we were fallbacking ASDF_DATA_DIR to ASDF_HOME, the problem is that ASDF_HOME doesn't exist anywhere, the correct name for the variable is ASDF_DIR, so the current bug was not reached in the past:

+ export ASDF_NODEJS_CACHE_DIR="${ASDF_DATA_DIR:-${ASDF_DIR:-$HOME/.asdf}}/tmp/$ASDF_NODEJS_PLUGIN_NAME/cache"

# ...

- versions_cache_dir="${ASDF_DATA_DIR:-${ASDF_HOME:-$HOME/.asdf}}/tmp/$(plugin_name)/cache"
+ versions_cache_dir="$ASDF_NODEJS_CACHE_DIR/versions-tab"

We should never use ASDF_DIR in this case. asdf-core doesn't use ASDF_DIR when resolving the directory for installing new plugins/versions, neither should we use it for our cache.

I will open a new PR fixing this, and some other issues that will probably arise from this discrepancy between our logic and asdf-core

@aptinio
Copy link

aptinio commented Dec 24, 2021

From what I understand from http://asdf-vm.com/manage/configuration.html#environment-variables, ASDF_NODEJS_CACHE_DIR should be inside ASDF_DATA_DIR, falling back directly to ~/.asdf if ASDF_DATA_DIR is not set, something like:

export ASDF_NODEJS_CACHE_DIR="${ASDF_DATA_DIR:-$HOME/.asdf}/tmp/$ASDF_NODEJS_PLUGIN_NAME/cache"

@augustobmoura
Copy link
Member

From what I understand from http://asdf-vm.com/manage/configuration.html#environment-variables, ASDF_NODEJS_CACHE_DIR should be inside ASDF_DATA_DIR, falling back directly to ~/.asdf if ASDF_DATA_DIR is not set, something like:

export ASDF_NODEJS_CACHE_DIR="${ASDF_DATA_DIR:-$HOME/.asdf}/tmp/$ASDF_NODEJS_PLUGIN_NAME/cache"

Yes, that is right, it should not fallback to ASDF_DIR at all

@augustobmoura
Copy link
Member

Check if that solves the issue. If it doesn't, we reopen the issue

@aptinio
Copy link

aptinio commented Dec 24, 2021

That fixed it for me. Thank you @augustobmoura <3

@gkapfham
Copy link

Hello @augustobmoura, thanks for your efforts in fixing this defect. I am writing to confirm that this fix works for me and I am now able to use asdf to install NodeJS. I have tried multiple commands and they all seem to work correctly now! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants