beetboxvm / beetbox

Pre-provisioned L*MP stack
http://beetbox.rtfd.org
92 stars 19 forks source link

not enough permission inside SSH for vagrant user (composer install fails) #442

Closed rwitchell closed 7 years ago

rwitchell commented 7 years ago

Problem/Motivation

ssh user vagrant does not have enough permission to delete files

Expected behaviour

composer install via phpstorm's SSH into vagrant should complete successfully.

Actual behaviour

composer fails, unable to delete a folder.

"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",

    vagrant@__app__:/var/beatbox/__rootdoc__$ composer install
    > AppBundle\HerokuDatabase::populateEnvironment
DATABASE_URL=
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Package facebook/php-sdk-v4 is abandoned, you should avoid using it. Use facebook/graph-sdk instead.
Generating autoload files
ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class
    > Incenteev\ParameterHandler\ScriptHandler::buildParameters
Updating the "app/config/parameters.yml" file
    > Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
    > Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache

  [Symfony\Component\Filesystem\Exception\IOException]                         
  Failed to remove file "/var/beatbox/__rootdoc__/var/cache/de~/pools/rULQUUapr  
  j/V/W/OJwX-3z+9+63CJPDw+6j": .                                               

cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception

  [RuntimeException]                                                               
  An error occurred when executing the "'cache:clear --no-warmup'" command:        

    [Symfony\Component\Filesystem\Exception\IOException]                           
    Failed to remove file "/var/beetbox/__rootdoc__/var/cache/de~/pools/rULQUUapr    
    j/V/W/OJwX-3z+9+63CJPDw+6j": .                                                 

  cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|  
  vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e  
  |--env ENV] [--no-debug] [--] <command>        

Steps to reproduce

Proposed changes

thom8 commented 7 years ago

By default the vagrant user has conservative permissions but also full password less sudo access so you should be able to run sudo composer install as a workaround.

The vagrant user has write access to the home directory /home/vagrant, project root /var/beetbox & /tmp you could create a pre provisioning task which allows access to other directories but there could be easier ways.

Does the package allow you to set the cache path? Are there any related upstream issues with this package and permissions?

thom8 commented 7 years ago

@rwitchell will likely keep the existing conservative permissions as you're still able to override for specific cases.

rwitchell commented 6 years ago

this is still an issue. Even when running sudo composer install the vagrant ssh user is unable to delete the file (due to usage by apache/ nginx?)

vagrant@Project__APP__:/var/beetbox/__APP__$ sudo composer install
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Nothing to install or update
Generating autoload files
ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class
> iter8\FandangoBundle\HerokuDatabase::populateEnvironment
DATABASE_URL=
> Incenteev\ParameterHandler\ScriptHandler::buildParameters
Updating the "app/config/parameters.yml" file
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
03:23:24 ERROR     [console] Error thrown while running command "--ansi cache:clear --no-warmup". Message: "Failed to remove file "/var/beetbox/__APP__/var/cache/de~/twig/ff/ff33e0f8187862e72b4234546d5613742019c351d5bd94ac3167d561a35614f4.php": ." ["error" => Symfony\Component\Filesystem\Exception\IOException { …},"command" => "--ansi cache:clear --no-warmup","message" => "Failed to remove file "/var/beetbox/__APP__/var/cache/de~/twig/ff/ff33e0f8187862e72b4234546d5613742019c351d5bd94ac3167d561a35614f4.php": ."] []

  [Symfony\Component\Filesystem\Exception\IOException]                         
  Failed to remove file "/var/beetbox/__APP__/var/cache/de~/twig/ff/ff33e0f  
  8187862e72b4234546d5613742019c351d5bd94ac3167d561a35614f4.php": .            

cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception

  [RuntimeException]                                        
  An error occurred when executing the "'cache:clear --no-  
  warmup'" command:                                         
  03:23:24 ERROR     [console] Error thrown while running   
  command "--ansi cache:clear --no-warmup". Message: "Fail  
  ed to remove file "/var/beetbox/__APP__/var/cache/de~/  
  twig/ff/ff33e0f8187862e72b4234546d5613742019c351d5bd94ac  
  3167d561a35614f4.php": ." ["error" => Symfony\Component\  
  Filesystem\Exception\IOException { …},"command" => "--an  
  si cache:clear --no-warmup","message" => "Failed to remo  
  ve file "/var/beetbox/__APP__/var/cache/de~/twig/ff/ff  
  33e0f8187862e72b4234546d5613742019c351d5bd94ac3167d561a3  
  5614f4.php": ."] []                                       

    [Symfony\Component\Filesystem\Exception\IOException]    

    Failed to remove file "/var/beetbox/__APP__/var/cach  
  e/de~/twig/ff/ff33e0f                                     
    8187862e72b4234546d5613742019c351d5bd94ac3167d561a3561  
  4f4.php": .                                               

  cache:clear [--no-warmup] [--no-optional-warmers] [-h|--  
  help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version]   
  [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV  
  ] [--no-debug] [--] <command>                             

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...

vagrant@Project__APP__:/var/beetbox/__APP__$ 
rwitchell commented 6 years ago

workaround: delete the whole 'cache' folder on your host machine, which will then sync and delete on the guest. Run composer install again on the guest.