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

Cannot run rspm::enable() unless root #9

Closed
grantmcdermott opened this issue Sep 9, 2022 · 11 comments · Fixed by #11
Closed

Cannot run rspm::enable() unless root #9

grantmcdermott opened this issue Sep 9, 2022 · 11 comments · Fixed by #11

Comments

@grantmcdermott
Copy link

Hi Iñaki,

I just installed rspm on an Amazon Linux 2 cloud desktop and it's working a charm. System deps and package binaries all handled without a hitch. Thank you!

The one catch I'm running into is that I'm being forced to run R as root for it to work. Launching a plain R session yields the following error:

> rspm::enable()
Downloading and installing required utilities...
Loaded plugins: priorities
You need to be root to perform this command.
error: File not found by glob: *
Error: something went wrong, utilities not available

The same command (and subsequent package installs) carry through without a problem if start a sudo R session.

While it's not the worst problem in the world---and any R packages installed during a sudo session are obviously available to my regular user after the fact---I was surprised by this root requirement. I thought everything was installed into the user home. Do you think it's an artifact of the federated user setup we have in these cloud environments? Any troubleshooting tips would be greatly appreciated.

P.S. I'm running the latest CRAN version of rspm (0.2.1).

@Enchufa2
Copy link
Member

Enchufa2 commented Sep 9, 2022

Mmmh... it seems that yum install --downloadonly also requires root access. Odd. Could you please try substituting this line

https://github.com/Enchufa2/rspm/blob/5d517f3a4e23354acae3e4793c264aa2a0ae13b0/R/centos.R#L18

with

cmd <- "yumdownloader --resolve"

?

@Enchufa2
Copy link
Member

Enchufa2 commented Sep 9, 2022

BTW, check the path tools::R_user_dir("rspm"). You'll need to apply sudo chown -R youruser:yourgroup to that directory first, because it is owned by root now.

@grantmcdermott
Copy link
Author

grantmcdermott commented Sep 9, 2022

Hmmm. I made the adjustment in this fork and installed from source. Still running into the same problem, unfortunately.

> remotes::install_github("grantmcdermott/rspm", ref = "test")
<TRUNCATED>
> tools::R_user_dir("rspm")
[1] "/local/home/gmcd/.local/share/R/rspm"
> rspm::enable()
Downloading and installing required utilities...
Loaded plugins: priorities
You need to be root to perform this command.
error: File not found by glob: *
Error: something went wrong, utilities not available

@Enchufa2
Copy link
Member

Enchufa2 commented Sep 9, 2022

So you cannot run e.g. yumdownloader --resolve patchelf in bash as a regular user?

@grantmcdermott
Copy link
Author

So you cannot run e.g. yumdownloader --resolve patchelf in bash as a regular user?

Actually, I can.

dev-dsk-gmcd-xx-xxxxxxxx % yumdownloader --resolve patchelf
Loaded plugins: priorities
amzn2-amazon                              | 3.1 kB     00:00     
amzn2-core                                | 3.8 kB     00:00     
amzn2-kernel                              | 3.8 kB     00:00     
amzn2-mate                                | 2.7 kB     00:00     
cloud-dev-dsk                             | 3.0 kB     00:00     
dcv                                       | 3.0 kB     00:00     
firefox                                   | 2.7 kB     00:00     
1246 packages excluded due to repository priority protections
--> Running transaction check
---> Package patchelf.x86_64 0:0.12-1.el7 will be installed
--> Finished Dependency Resolution
patchelf-0.12-1.el7.x86_64.rpm              |  86 kB   00:00

Sorry I'm not being more help. I'm a Linux (and R) veteran, believe it or not. But I'm brand new to RHEL/CentOS and the package management system is still pretty foreign to me.

@Enchufa2
Copy link
Member

Enchufa2 commented Sep 9, 2022

Perfect! Then you probably didn't restart the R session after reinstalling the package, so you were using the old version. If you can do that in bash, the patch should work. Please run the following in Bash to fix the ownership of the package folder:

$ sudo chown -R gmcd:gmcd $(Rscript -e 'cat(tools::R_user_dir("rspm"))')

Then reinstall your fork with remotes, then start a fresh R session and try again, please.

@grantmcdermott
Copy link
Author

That looks like it does something, but unfortunately still hitting the root requirement.

> rspm::enable()
Downloading and installing required utilities...
Loaded plugins: priorities
amzn2-amazon                                                                                                                                                                                | 3.1 kB  00:00:00     
amzn2-core                                                                                                                                                                                  | 3.8 kB  00:00:00     
amzn2-kernel                                                                                                                                                                                | 3.8 kB  00:00:00     
amzn2-mate                                                                                                                                                                                  | 2.7 kB  00:00:00     
cloud-dev-dsk                                                                                                                                                                               | 3.0 kB  00:00:00     
dcv                                                                                                                                                                                         | 3.0 kB  00:00:00     
firefox                                                                                                                                                                                     | 2.7 kB  00:00:00     
1246 packages excluded due to repository priority protections
--> Running transaction check
---> Package patchelf.x86_64 0:0.12-1.el7 will be installed
--> Finished Dependency Resolution
patchelf-0.12-1.el7.x86_64.rpm                                                                                                                                                              |  86 kB  00:00:00     
warning: Unable to get systemd shutdown inhibition lock
warning: Unable to get systemd shutdown inhibition lock
error: Unable to change root directory: Operation not permitted
Error: something went wrong, utilities not available

I'll have to leave it there for this evening, unfortunately. We're about to get hit with a strategic power outage because of high temps and strong winds. (The joy of the Pacific Northwest fire season...) I'll try to pick up again over the weekend. Thanks again for your help. It's much appreciated.

@Enchufa2
Copy link
Member

This shows that the fix works. :) Unfortunately, it seems that you still have issues with directories owned by root, most probably derived from having run R with sudo. :(

@Enchufa2
Copy link
Member

Reopening, because it seems that in fact there is an issue with the rpm command, and not with your directories. I've been able to reproduce this thanks to #10.

@Enchufa2
Copy link
Member

v0.2.3 on CRAN.

@grantmcdermott
Copy link
Author

grantmcdermott commented Nov 22, 2022

Late to the game, because I was only able to test now. But I can happily confirm that it works now thanks to the linked PR.

This will be very useful for a bunch of people on my team. Thanks @Enchufa2!

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.

2 participants