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

CLI standalone install method results in permission errors if run with sudo #1160

Closed
edmorley opened this issue Dec 5, 2018 · 1 comment
Closed

Comments

@edmorley
Copy link
Member

edmorley commented Dec 5, 2018

Do you want to request a feature or report a bug?

Bug (or at least user ~error/confusion that could be handled more gracefully)

What is the current behavior?

  1. Attempt to install Heroku CLI under WSL on Windows 10, following the steps in CLI snap install method fails under WSL Ubuntu 18.04 #1159
  2. When that fails, instead try the method listed on https://devcenter.heroku.com/articles/heroku-cli#standalone-installation
  3. Mistakenly interpret "script requires sudo" in the docs as meaning the whole script requires sudo, and so adjust the shown command to be curl https://cli-assets.heroku.com/install.sh | sudo sh (I had imagined that the reason sudo wasn't included in the shown command, was that it was intended to be run from inside docker containers where the user may likely already be root, so didn't think twice before adding)
  4. Run heroku update to confirm installed and up to date
  5. Run heroku login
ed@WSL:/c/Users/Ed/src$ curl https://cli-assets.heroku.com/install.sh | sudo sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1892  100  1892    0     0  14119      0 --:--:-- --:--:-- --:--:-- 14225
Installing CLI from https://cli-assets.heroku.com/heroku-linux-x64.tar.xz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 15.4M  100 15.4M    0     0  1971k      0  0:00:08  0:00:08 --:--:-- 2615k
v11.3.0
heroku installed to /usr/local/bin/heroku
heroku/7.19.3 linux-x64 node-v11.3.0

ed@WSL:/c/Users/Ed/src$ heroku update
heroku: Updating CLI... already on latest version: 7.19.3

ed@WSL:/c/Users/Ed/src$ heroku login
(node:440) [EACCES] Error Plugin: heroku: EACCES: permission denied, open '/home/ed/.cache/heroku/lastrun'
module: @oclif/config@1.9.0
task: runHook init
plugin: heroku
root: /usr/local/lib/heroku
See more details with DEBUG=*
heroku: Press any key to open up the browser to login or q to exit:
Logging in... done
Logged in as <SNIP>
(node:440) [EACCES] Error Plugin: heroku: EACCES: permission denied, mkdir '/home/ed/.cache/heroku/autocomplete'
module: @oclif/config@1.9.0
task: runHook recache
plugin: heroku
root: /usr/local/lib/heroku
See more details with DEBUG=*

What is the expected behavior?

  • That either install.sh handles being run with sudo, or else the sudo reference in the docs is clarified to indicate that the script will self-sudo, and that the user shouldn't do so themselves.
  • That if a permissions error occurs, the login command didn't try to open the browser anyway for the command to then output further errors after clicking sign-in in the browser.
  • Possibly for the Heroku CLI to handle the .cache directly being owned by the wrong user and output a more user-friendly message.
@edmorley edmorley changed the title Standalone install method results in CLI permission errors when run with sudo CLI standalone install method results in permission errors if run with sudo Dec 5, 2018
@mattchrocha
Copy link

mattchrocha commented Apr 3, 2019

I had the same problem trying to install Heroku on WSL.
I can confirm that using curl https://cli-assets.heroku.com/install.sh | sudo sh allows to install it although some errors pop up every now and then

@mimen mimen closed this as completed Jan 24, 2024
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

No branches or pull requests

3 participants