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

Updating CLI fail on Linux/macOS with permission denied error #109

Closed
vermario opened this issue Feb 21, 2024 · 8 comments · Fixed by #120
Closed

Updating CLI fail on Linux/macOS with permission denied error #109

vermario opened this issue Feb 21, 2024 · 8 comments · Fixed by #120
Assignees
Labels
bug Something isn't working

Comments

@vermario
Copy link

❯ lando version
v3.21.0-beta.2 

Os: linux

Hi! When I try to run lando update, I see an available update, but the process does not go through because it cannot write to /usr/share/lando/bin. (Rightly so, that directory and its contents are owned by root on my system.
Output:

❯ lando update
Generating plugin/cli update matrix... done [see table below]

 PACKAGE              STATUS             COMMENT                                                  
 ──────────────────── ────────────────── ──────────────────────────────────────────────────────── 
 @lando/acquia        ✔ Up to date       All good                                                 
 @lando/apache        ✔ Up to date       All good                                                 
 @lando/backdrop      ✔ Up to date       All good                                                 
 @lando/cli           ⚠ Update available https://github.com/lando/cli/releases/tag/v3.21.0-beta.2 
 @lando/compose       ✔ Up to date       All good                                                 
 @lando/core          ✔ Up to date       All good                                                 
 @lando/dotnet        ✔ Up to date       All good                                                 
 @lando/drupal        ✔ Up to date       All good                                                 
 @lando/elasticsearch ✔ Up to date       All good                                                 
 @lando/go            ✔ Up to date       All good                                                 
 @lando/healthcheck   ⚠ Cannot update                                                             
 @lando/joomla        ✔ Up to date       All good                                                 
 @lando/lagoon        ✔ Up to date       All good                                                 
 @lando/lamp          ✔ Up to date       All good                                                 
 @lando/laravel       ✔ Up to date       All good                                                 
 @lando/lemp          ✔ Up to date       All good                                                 
 @lando/mailhog       ✔ Up to date       All good                                                 
 @lando/mariadb       ✔ Up to date       All good                                                 
 @lando/mean          ✔ Up to date       All good                                                 
 @lando/memcached     ✔ Up to date       All good                                                 
 @lando/mongo         ✔ Up to date       All good                                                 
 @lando/mssql         ✔ Up to date       All good                                                 
 @lando/mysql         ✔ Up to date       All good                                                 
 @lando/networking    ⚠ Cannot update                                                             
 @lando/nginx         ✔ Up to date       All good                                                 
 @lando/node          ✔ Up to date       All good                                                 
 @lando/pantheon      ✔ Up to date       All good                                                 
 @lando/php           ✔ Up to date       All good                                                 
 @lando/phpmyadmin    ✔ Up to date       All good                                                 
 @lando/platformsh    ✔ Up to date       All good                                                 
 @lando/postgres      ✔ Up to date       All good                                                 
 @lando/proxy         ⚠ Cannot update                                                             
 @lando/python        ✔ Up to date       All good                                                 
 @lando/redis         ✔ Up to date       All good                                                 
 @lando/ruby          ✔ Up to date       All good                                                 
 @lando/scanner       ⚠ Cannot update                                                             
 @lando/sharing       ⚠ Cannot update                                                             
 @lando/solr          ✔ Up to date       All good                                                 
 @lando/symfony       ✔ Up to date       All good                                                 
 @lando/tomcat        ✔ Up to date       All good                                                 
 @lando/varnish       ✔ Up to date       All good                                                 
 @lando/wordpress     ✔ Up to date       All good                                                 

Lando would like to update 1 package(s) listed above.
DO YOU CONSENT?: y
✖ Lando cannot write to /usr/share/lando/bin!
ERROR ==> An update error occured! Rerun with lando update --debug for more info.
❯ cd /usr/share/lando
❯ ls
bin  docs  lando.png
❯ ls -lh
total 52K
drwxr-xr-x 2 root root 4.0K Feb 20 10:26 bin
drwxr-xr-x 2 root root 4.0K Feb 20 10:26 docs
-rwxr-xr-x 1 root root  42K Feb 17 00:12 lando.png

I am also attaching the result of running the command again with the --debug option:

lando_update_debug_log.txt

@vermario vermario added the bug Something isn't working label Feb 21, 2024
@vermario
Copy link
Author

Apologies, I think this probably should have been posted on the general lando repo?

@pirog pirog self-assigned this Feb 21, 2024
@pirog
Copy link
Sponsor Member

pirog commented Feb 21, 2024

@vermario you can post here or in lando/lando but if you post there chances are that ill just triage it over here :)

so short answer is for now i would just make /usr/share/lando/bin writeable by you.

longer answer is that we are working on overhauling our installer to be a script which will appropriately set things up the first time. if you want to replicate what that is going to do i would do something like

mv /usr/share/lando/bin/lando ~/.lando/bin/lando
ln -s ~/.lando/bin/lando /usr/share/lando/bin/lando

and then try the lando update

@oskarmodig
Copy link

I'm having some issues with lando update. It starts running and gives me the matrix of updates, cli v3.21.0-beta.2 being one of them. It starts updating all other packages, and downloading cli at the same time. When the cli download is done the entire process is aborted, regardless of whether the other packages are done. If I run the command multiple times some of the other plugins finish updating before cli is downloaded, each time, so in that way I can get the other packages installed.

After a removing my .lando dir in my %USERPROFILE% (I'm on Windows 11) cli stops interrupting the other packages install, but it never finished installing itself. Download gets to 100% and then it just keeps spinning there.

@reynoldsalec
Copy link
Sponsor Member

reynoldsalec commented Feb 21, 2024

Note that on Mac you'll need to modify /usr/local/bin, not /usr/share/lando/bin; see recommended steps in @GeoJunkie's post below.

@GeoJunkie
Copy link

Note that on Mac I needed to run the following:

sudo chmod a+w /usr/local/bin && sudo chmod a+w /usr/local/bin/lando && lando update

This is very, very dangerous from a security POV as it gives full write access to system executable files. I ran this, which allowed the update to work:

sudo chgrp admin /usr/local/bin
sudo chmod 775 /usr/local/bin
lando update
sudo chmod 755 /usr/local/bin
sudo chgrp wheel /usr/local/bin

This makes it so only admins can update that folder, and then resets it back to its proper state where only root can write to it.

@pirog pirog linked a pull request Feb 26, 2024 that will close this issue
@pirog pirog changed the title [Linux] Cannot run lando update: "lando [FAILED] Lando cannot write to /usr/share/lando/bin!" Updating CLI fail on Linux/macOS with permission denied error Feb 26, 2024
@pirog
Copy link
Sponsor Member

pirog commented Feb 26, 2024

UPDATEZ

We are going to push out an update for this but given its self-blocking nature wrt updating we are going to recommend you use the usual package installer to update the CLI. Will post that here when it is available.

After you do that, and assuming i did a not-shitty job you should be able to get future CLI updates with lando update as intended.

pirog added a commit that referenced this issue Feb 26, 2024
* first pass on lando shellenv

* rework lando update to use new install paths and auto add to path if needed

* clean up

* clean up 2

* breakman

* breakman2
@pirog pirog reopened this Feb 26, 2024
@pirog
Copy link
Sponsor Member

pirog commented Feb 29, 2024

For people having this issue i would recommend:

  1. Turning off Docker Desktop/Engine
  2. Removing ~/.lando/config and ~/.lando/scripts
  3. nstalling the latest beta via the package installer over here: https://github.com/lando/lando/releases. i would not use lando update but once you install from the package installer you should be safe to use lando update with the exception of CLI updates on Windows, a fix is coming for this
  4. Proceeding with stuff as usual
  5. Let us know if it seems to resolve the issue

Double note that there are still issues with updating the CLI on Windows but fixes are forthcoming

@hainovsky
Copy link

I had a problem with "Lando cannot write to /usr/local/bin" error after lando update, the steps above

For people having this issue i would recommend:

  1. Turning off Docker Desktop/Engine
  2. Removing ~/.lando/config and ~/.lando/scripts
  3. nstalling the latest beta via the package installer over here: https://github.com/lando/lando/releases. i would not use lando update but once you install from the package installer you should be safe to use lando update with the exception of CLI updates on Windows, a fix is coming for this
  4. Proceeding with stuff as usual
  5. Let us know if it seems to resolve the issue

Double note that there are still issues with updating the CLI on Windows but fixes are forthcoming

I had a problem with "Lando cannot write to /usr/local/bin" error after lando update, those steps resolved the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants