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

[FEAT] setup $PATH for root user #40

Open
fkjaekel opened this issue Sep 18, 2023 · 4 comments
Open

[FEAT] setup $PATH for root user #40

fkjaekel opened this issue Sep 18, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@fkjaekel
Copy link

Using the role with the default variable values, ansible playbook running with become=true

$ gu install native-image
Error: Insufficient privileges for administration of the GraalVM installation. You need to become "root" user to perform administrative tasks on GraalVM. 
NOTE: depending on your operating system, you may need to use OS tools to install or uninstall GraalVM components.

Trying to run as root:

$ sudo gu install native-image
sudo: gu: command not found
@fkjaekel fkjaekel added the enhancement New feature or request label Sep 18, 2023
@arolfes
Copy link
Owner

arolfes commented Sep 24, 2023

Hello @fkjaekel ,

I understand your problem. I run always into the same problem and fix it manually.

I think the Java 21 feature is more important for you. So I will work on this one first
And then go on with this one

@arolfes
Copy link
Owner

arolfes commented Sep 25, 2023

Hi @fkjaekel ,
just for your information: With version 21 the gu tool is removed
oracle/graal#6855

@arolfes
Copy link
Owner

arolfes commented Sep 25, 2023

Hello @fkjaekel ,
please give me a hint how to solve your problem?

what can I do:
add symlinks to /root/.local/bin for all files in /opt/graalvm/jdk-XX.Y.Z/bin/*
-> my prefered solution because this should work over all distros and not only when using bash

or add the GRAALVM_HOME variable to the .bashrc of root and then add it to the path like this:

export GRAALVM_HOME='/opt/graalvm/jdk-XX.Y.Z'
export PATH=${GRAALVM_HOME}/bin:${PATH}

Both solution would not help in your case. and only when you switch to root completly.

let me demonstrate this for

# switch to root user explicitly
arl@fedora ~ $ sudo su -
[root@fedora ~]# java --version
openjdk 21 2023-09-19
OpenJDK Runtime Environment GraalVM CE 21+35.1 (build 21+35-jvmci-23.1-b15)
OpenJDK 64-Bit Server VM GraalVM CE 21+35.1 (build 21+35-jvmci-23.1-b15, mixed mode, sharing)
[root@fedora ~]# which java
/root/.local/bin/java
[root@fedora ~]# exit
logout
arl@fedora ~ $ sudo java --version
openjdk 17.0.8 2023-07-18
OpenJDK Runtime Environment (Red_Hat-17.0.8.0.7-1.fc37) (build 17.0.8+7)
OpenJDK 64-Bit Server VM (Red_Hat-17.0.8.0.7-1.fc37) (build 17.0.8+7, mixed mode, sharing)
arl@fedora ~ $ sudo which java
/usr/bin/java
arl@fedora ~ $ sudo ls -la  /usr/bin/java
lrwxrwxrwx. 1 root root 22 Sep  4 07:45 /usr/bin/java -> /etc/alternatives/java

What I don't want to interfere with the java alternatives

A simple workaround for you could be

# here I switched my graalvm to 17.0.8
# the GRAALVM_HOME Variable is set in normal circumstances
arl@fedora ~ $ sudo $GRAALVM_HOME/bin/gu --version
GraalVM Updater 23.0.1

I'm waiting for your feedback

@fkjaekel
Copy link
Author

Hi,

Option 1 sounds fine. Since native-image is now included, I currently don't have other components to install after the GraalVM setup.

Thanks

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

No branches or pull requests

2 participants