Varying-Vagrant-Vagrants / VVV

An open source Vagrant configuration for developing with WordPress
https://varyingvagrantvagrants.org
MIT License
4.54k stars 848 forks source link

sudo: unable to execute /usr/local/bin/wp: Permission denied #2492

Closed JHSheridan closed 3 years ago

JHSheridan commented 3 years ago

What was The Command Used To Provision

vagrant reload --provision

What Kind of VVV Provision Was This

This was a reprovision of an already working VVV

Logs/What Broke

I had a working VVV environment with 6 or 7 sites on it (see config below for specifics). I'm about to start on some new projects, so I decided I'd update my VVV. I git pulled to the latest version and was running into some issues. I decided to vagrant box update, vagrant destroy, and then vagrant up --provision. When I do this, I get the expected behavior. All of my sites work just as they did before.

I then added the 3 new sites to my config.yml and ran vagrant reload --provision. That's when I got the following error: "sudo: unable to execute /usr/local/bin/wp: Permission denied"

I then removed those 3 new sites from config.yml, ran vagrant destroy, vagrant up --provision, and all my original sites were back again. In an effort to narrow down what could be causing the problem, I then ran vagrant reload --provision without adding the 3 new sites and I still get the same error:

default: sudo: unable to execute /usr/local/bin/wp: Permission denied
default:  ! The 'main' provisioner ran into problems, the full log is available at '/var/log/provisioners/2021.06.25_02-28-59/provisioner-main.log'. It completed in 47 seconds.
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

Here is a gist with the full provisioner log: https://gist.github.com/JHSheridan/b4cd28ab7c6fd2bb6d6177dff54a1f41

Here is my config file

---

# This file is a YAML formatted file. YAML indenting is done in spaces not
# tabs, and whitespace is significant. If you don't stick to this, it will
# fail on provision

#
# IMPORTANT, if you change this file, you have to reprovision,  no exceptions
# Do this by running either this command:
# vagrant reload --provision

# Or, if your machine is already turned on:
# vagrant provision
#

# These are your websites, and their names map on to the folders they're
# located in. See the docs for how to define these, and what all the keys
# and options are
sites:

  # JHSheridan.com
  jhsheridan:
    description: "JHSheridan.com"
    repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
    hosts:
      - jhs.test

  # Communities in Schools
  cis:
    description: "Communities in Schools - Nation's Capital"
    repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
    hosts:
      - cis.test

  # Resolution Public Affairs
  rpa:
    description: "Resolution Public Affairs"
    repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
    hosts:
      - rpa.test

  # Anthony Coley
  anthony-coley:
    description: "Anthony Coley's personal website"
    repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
    hosts:
      - ac.test

  # Old WiFi Forward
  old-wff:
    description: "Old WiFi Forward website"
    repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
    hosts:
      - oldwff.test

  # New WiFi Forward
  wff:
    description: "New Wifi Forward website"
    repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
    hosts:
      - wff.test

  # Hoop Notebook
  hoop-notebook:
    description: "Hoop Notebook Wordpress Site"
    repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
    hosts:
      - hoop.test

  # Starting Block 
  starting-block:
    description: "Starting Block Wordpress Theme"
    repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
    hosts:
      - sb.test

  # UC Free Speech Center
  uc:
    description: "UC Free Speech Center"
    repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
    hosts:
      - uc.test

# Utilities https://varyingvagrantvagrants.org/docs/en-US/utilities/
# are system level items that aren't websites, that install tools or packages
# the core utilities install tools such as phpmyadmin
utilities:
  core: # The core VVV utility
    - tls-ca # HTTPS SSL/TLS certificates
    - phpmyadmin # Web based database client
    #- memcached-admin # Object cache management
    #- opcache-status # opcache management
    #- webgrind # PHP Debugging
    #- mongodb # needed for Tideways/XHGui
    #- tideways # PHP profiling tool, also installs xhgui check https://varyingvagrantvagrants.org/docs/en-US/references/tideways-xhgui/
    #- nvm # Node Version Manager
    #- php56
    #- php70
    #- php71
    #- php72
    #- php73
    #- php74

# vm_config controls how Vagrant provisions the virtual machine, and can be used to
# increase the memory given to VVV and the number of CPU cores.
# It can also be used to override the default provider being used within Vagrant.

vm_config:
  # For WP core development we recommend at least 2GB ( 2048 ),
  # If you have 4GB of RAM, lower this to 768MB or you may encounter issues
  memory: 2048
  # CPU cores:
  cores: 2

  # this tells VVV to use the prebuilt box copied from the USB drive at contributor days
  # once set to false, do not change back to true, and reprovision
  # wordcamp_contributor_day_box: false

  # Due to a limitation within Vagrant, the specified provider is only respected on a clean `vagrant up`
  # as Vagrant currently restricts you to one provider per machine
  # https://www.vagrantup.com/docs/providers/basic_usage.html#vagrant-up
  # provider: virtualbox
  # provider: hyperv
  # provider: parallels
  # provider: vmware_desktop

# General VVV options
general:
  # Backup the databases to the database/backups subfolder on halt/suspend/destroy, set to false to disable
  db_backup: true
  # Import the databases if they're missing from backups
  db_restore: true
  # set to true to use a synced shared folder for MariaDB database storage
  db_share_type: false
  # GitHub token to use from composer
  #github_token: xxxxxx

# Settings for the vagrant plugins supported by VVV
vagrant-plugins:
  disksize: 10GB # requires the disk size vagrant plugin

Your Environment

Screenshot from 2021-06-24 22-11-55

Thanks in advance for your help!

welcome[bot] commented 3 years ago

Thanks for opening your first issue here! Be sure to follow the issue template and include your OS/Vagrant/VVV versions! Don't forget you can get support in the VVV slack at https://varyingvagrantvagrants.org/docs/en-US/slack/

VVV
VVV Slack Workspace
Join the VVV Slack Workspace
Mte90 commented 3 years ago

I don't know what was the previous VVV version. Probably you need to do a vagrant destroy and provision everything again.

JHSheridan commented 3 years ago

I don't know what was the previous VVV version. Probably you need to do a vagrant destroy and provision everything again.

I believe I was on vvv 3.2.0 before the update

tomjn commented 3 years ago

A vagrant destroy is the thermonuclear last resort after all other options are exhausted.

It also destroys all useful debugging information

This is probably related to the most recent commits. A chmod should fix this

tomjn commented 3 years ago
-rwxr-xr-x  1 vagrant vagrant   6094601 Jun  2 20:32 wp

Is what it should be if you run ls -al /usr/local/bin/wp

vagrant@vvv:/usr/local/bin$ ls -al /usr/local/bin/wp
-rwxr-xr-x 1 vagrant vagrant 6094601 Jun  2 20:32 /usr/local/bin/wp
tomjn commented 3 years ago

@JHSheridan can you test this PR? https://github.com/Varying-Vagrant-Vagrants/VVV/pull/2493

JHSheridan commented 3 years ago

@tomjn I was able to resolve the issue by ssh'ing into my vagrant box and chmod'ing the path causing the problem.

More than happy to help you test your PR, but unfortunately I'm completely out of time today. I'll come back to it this weekend.

Thank you so much for your help!