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

Craft fails to install in Unix VM + Windows Host (filemutex) #4355

ethanmdavidson opened this issue Jun 4, 2019 · 2 comments


None yet
2 participants
Copy link

commented Jun 4, 2019


I'm running craft inside the homestead box. The box will up correctly with everything installed, and when I navigate to http://localhost:8000/admin the setup wizard screen displays correctly and works fine, but every time I click through the final screen I get "Install Failed". phperrors.log says:

[03-Jun-2019 19:56:07 UTC] PHP Fatal error:  Uncaught yii\base\ErrorException: unlink(/home/vagrant/code/storage/runtime/mutex/a78d6a4ecc5877cd5617ca990a2be38b.lock): Text file busy in /home/vagrant/code/vendor/yiisoft/yii2/mutex/FileMutex.php:161
Stack trace:
#0 /home/vagrant/code/vendor/yiisoft/yii2/mutex/FileMutex.php(161): ::unlink()
#1 /home/vagrant/code/vendor/yiisoft/yii2/mutex/Mutex.php(88): yii\mutex\FileMutex->releaseLock()
#2 /home/vagrant/code/vendor/yiisoft/yii2/mutex/Mutex.php(57): yii\mutex\FileMutex->release()
#3 {main}
  thrown in /home/vagrant/code/vendor/yiisoft/yii2/mutex/FileMutex.php on line 161

which I believe is the same as #3879 and #3881. However, the fix for those issues (a custom FileMutex) has been deprecated in #3884. A yii variable 'isWindows' is apparently the way to correct this issue, but I haven't been able to find any documentation describing where/how to set this. I was following the up and running with Craft 3 tutorial as recommended in Developers New to Craft, but I have also googled it to no avail. Additionally, I couldn't find any mention of it anywhere in the documentation. I am new to craft and php, so perhaps I am missing something obvious.

The best solution would be for craft/yii to autodetect when it is running inside a VM, and use the host OS for this setting. I'm not sure this is possible, so the second-best solution is being able to override/force this setting.

Steps to reproduce

  1. Set up a windows host with vagrant, virtualbox, composer, etc.
  2. create a new craft project with composer create-project craftcms/craft .
  3. install homestead with the per-project installation: composer require laravel/homestead --dev and .\vendor\bin\homestead make
  4. run vagrant up to boot the box
  5. Once the box boots, open http://localhost:8000/admin and complete the craft install steps

Expected: craft installs correctly and redirects to the admin console.

Actual: an error message is displayed.

Additional info

  • Craft version: 3.1.28
  • PHP version: 7.3.6 (host) and 7.3.5 (guest)
  • Vagrant version: 2.2.4
  • Virtualbox version: 6.0.8
  • Homestead version: 7.20.0
  • Host OS: Windows 10 1809


The install is completed successfully if vagrant uses SMB for the file sharing instead of the default (virtualbox). However, this is unsatisfactory because it requires admin privileges.


This comment has been minimized.

Copy link

commented Jun 4, 2019

A yii variable 'isWindows' is apparently the way to correct this issue, but I haven't been able to find any documentation describing where/how to set this.

From your Craft config/app.php file, you can use this to set the isWindows property of the FileMutex class to true.

return [
    'components' => [
        'mutex' => function() {
            $config = craft\helpers\App::mutexConfig();
            $config['isWindows'] = true;
            return Craft::createObject($config);

@angrybrad angrybrad closed this Jun 4, 2019


This comment has been minimized.

Copy link

commented Jun 4, 2019

Thank you, I can confirm that works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.