2

I am trying to run craft inside a homestead box. The box boots and installs everything correctly, and when I navigate to http://localhost:8000/admin I see the install screen and can click through the prompts. However, after clicking through the final screen I always get "Install failed 😞 Please check your logs for more info.".

Here are the details for my setup:

  • Host OS: Windows 10 1809
  • Vagrant version: 2.2.4
  • Virtualbox version: 6.0.8
  • Homestead version: 8.5.5 (vagrant box 8.0.0-alpha2)
  • Guest OS: Ubuntu 18.04.2
  • Guest PHP version: 7.3.5-1

phperrors.log has this to say:

[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

I've googled this error message but didn't find anyone with the same problem. The referenced line of code (FileMutex.php:161) offers the clue that it may be an issue with operating systems (a different file unlock/delete procedure is used on windows).

In the vagrant box, the permissions on that file are wide open and I can delete the file with no problem.

vagrant@craftycoffee:/vagrant/storage/runtime/mutex$ ls -al
total 8
drwxrwxrwx 1 vagrant vagrant 4096 Jun  3 02:39 .
drwxrwxrwx 1 vagrant vagrant 4096 Jun  3 02:35 ..
-rwxrwxrwx 1 vagrant vagrant    0 Jun  3 02:35 4f99fda3d17d57459c4105d023bcba69.lock
-rwxrwxrwx 1 vagrant vagrant    0 Jun  3 02:35 52fa75c9044f6df80d2103fad929036e.lock
-rwxrwxrwx 1 vagrant vagrant    0 Jun  3 19:56 a78d6a4ecc5877cd5617ca990a2be38b.lock
vagrant@craftycoffee:/vagrant/storage/runtime/mutex$ rm a78d6a4ecc5877cd5617ca990a2be38b.lock
vagrant@craftycoffee:/vagrant/storage/runtime/mutex$ ls
4f99fda3d17d57459c4105d023bcba69.lock  52fa75c9044f6df80d2103fad929036e.lock

My best guess is that there is some weird interaction between windows and ubuntu when vagrant mounts that folder. However, I use vagrant for several other projects (all with windows host and linux guest) and have never seen any problems like this. I'm a complete noob with homestead/craft/php so I'm not really sure where to go from here; Any guidance on troubleshooting is appreciated. If there is any more info I can provide please let me know.

EDIT: I tried using SMB to do the file mounting (I believe NFS is the default?) and it worked. However, this isn't an optimal solution because I have to put in my username and password every time I boot the box.

1 Answer 1

4

See this issue: https://github.com/craftcms/cms/issues/4355#issuecomment-498829513

reproduced here for completeness:

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);
        },
    ],
];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.