SolvedPackageVersions Unable to install on vboxfs

The error has already been reported at #98, but the assumption that it is a permission / UID issue is wrong.

When installing under xfs it works without problems:

mkdir /tmp/ocramius
cd /tmp/ocramius
composer require ocramius/package-versions -vvv

But when installing under vboxfs (Virtualbox, Windows) it fails:

mkdir /home/vboxfs/ocramius
cd /home/vboxfs/ocramius
composer require ocramius/package-versions -vvv

The error-message ist:

  - Installing ocramius/package-versions (1.5.1): Downloading https://api.github.com/repos/Ocramius/PackageVersions/zipball/1d32342b8c1eb27353c8887c366147b4c2da673c
Downloading (connecting...)
Following redirect (2) https://codeload.github.com/Ocramius/PackageVersions/legacy.zip/1d32342b8c1eb27353c8887c366147b4c2da673c
Downloading https://codeload.github.com/Ocramius/PackageVersions/legacy.zip/1d32342b8c1eb27353c8887c366147b4c2da673c
Downloading (100%)
 Extracting archiveExecuting command (CWD): unzip -qq  '/home/vboxfs/vendor/ocramius/package-versions/0d1e7190e461948bf156e9fea4add4ee' -d '/home/vboxfs/vendor/composer/e11a586c'
Plugin installation failed, rolling back
  - Removing ocramius/package-versions (1.5.1)

Installation failed, deleting ./composer.json.


  [RuntimeException]
  Could not delete /home/vboxfs/vendor/ocramius/package-versions/src/PackageVersions:


Exception trace:
 () at phar:///usr/local/bin/composer/src/Composer/Util/Filesystem.php:217
 Composer\Util\Filesystem->unlink() at phar:///usr/local/bin/composer/src/Composer/Util/Filesystem.php:170
 Composer\Util\Filesystem->removeDirectoryPhp() at phar:///usr/local/bin/composer/src/Composer/Util/Filesystem.php:137
 Composer\Util\Filesystem->removeDirectory() at phar:///usr/local/bin/composer/src/Composer/Downloader/FileDownloader.php:238
 Composer\Downloader\FileDownloader->remove() at phar:///usr/local/bin/composer/src/Composer/Downloader/DownloadManager.php:299
 Composer\Downloader\DownloadManager->remove() at phar:///usr/local/bin/composer/src/Composer/Installer/LibraryInstaller.php:224
 Composer\Installer\LibraryInstaller->removeCode() at phar:///usr/local/bin/composer/src/Composer/Installer/LibraryInstaller.php:137
 Composer\Installer\LibraryInstaller->uninstall() at phar:///usr/local/bin/composer/src/Composer/Installer/PluginInstaller.php:66
 Composer\Installer\PluginInstaller->install() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:173
 Composer\Installer\InstallationManager->install() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:160
 Composer\Installer\InstallationManager->execute() at phar:///usr/local/bin/composer/src/Composer/Installer.php:597
 Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:229
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/RequireCommand.php:218
 Composer\Command\RequireCommand->doUpdate() at phar:///usr/local/bin/composer/src/Composer/Command/RequireCommand.php:175
 Composer\Command\RequireCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:245
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:835
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:185
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:267
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:106
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:61
 require() at /usr/local/bin/composer:24

require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...

Tested with Cent OS 7, PHP 7.3, composer 1.9.0-1.6.0

I can install many other packages without problems under the vbofs:

composer require chadsikorra/php-simple-enum
composer require friendsofsymfony/rest-bundle
composer require ldaptools/ldaptools-bundle
composer require nelmio/api-doc-bundle
composer require paragonie/random_compat
composer require ramsey/uuid
composer require symfony/routing

However, only when using the sleep-trick at laravel/homestead#1240 (comment) in composer I can install ocramius/package-versions under vboxfs without problems. So it looks like there is something special in ocramius/package-versions which other packages do not have. But what?

34 Answers

✔️Accepted Answer

I will downgrade to 6.0.4 later (if composer is having problems with this, chances are other software will too).

But... if someone just wants a "make it work right now" solution for this specific bug:

  1. You have to have unzip installed (eg. apt install unzip), so that composer will use that instead of php's unzip extension.

  2. Assuming which unzip shows /usr/bin/unzip.

  3. Assuming echo $PATH shows /usr/local/bin listed before /usr/bin.

  4. The hack (pasted in shell as root user):

cat >/usr/local/bin/unzip <<EOF
#!/bin/sh

/usr/bin/unzip "$@"
sleep 1
EOF

chmod 755 /usr/local/bin/unzip

Yeah, I did that. And it works. Hopefully a downgrade to VirtualBox 6.0.4 tomorrow is a better fix.

Other Answers:

I ran into this problem aswell - my solution was removing the vendor folder and do: "composer install --no-scripts --no-custom-installers" which worked for me.

I'll leave it open for now: lots of folks landing here, instead of opening new issues.