Page MenuHomePhabricator

Phabricator role on MediaWiki-Vagrant on Windows fails with manage_config.php not found during provision due to symlinks
Closed, DuplicatePublic

Description

When trying to provision MediaWiki-Vagrant after enabling the Phabricator role, a wild error appears:

==> default: Notice: /Stage[main]/Phabricator/Git::Clone[phabricator]/Exec[git_clone_phabricator]/returns: executed successfully
==> default: Notice: /Stage[main]/Phabricator/Service::Gitupdate[phd]/File[/etc/mw-vagrant/services/phd.conf]/ensure: created
==> default: Error: /vagrant/srv/phabricator/bin/config: 1: /vagrant/srv/phabricator/bin/config: ../scripts/setup/manage_config.php: not found
==> default: Error: /Stage[main]/Phabricator/Phabricator::Config[mysql.host]/Exec[phab_set_mysql.host]/returns: change from notrun to 0 failed: /vagrant/srv/phabricator/bin/config: 1: /vagrant/srv/phabricator/bin/config: ../scripts/setup/manage_config.php: not found
==> default: Error: /vagrant/srv/phabricator/bin/config: 1: /vagrant/srv/phabricator/bin/config: ../scripts/setup/manage_config.php: not found
==> default: Error: /Stage[main]/Phabricator/Phabricator::Config[mysql.port]/Exec[phab_set_mysql.port]/returns: change from notrun to 0 failed: /vagrant/srv/phabricator/bin/config: 1: /vagrant/srv/phabricator/bin/config: ../scripts/setup/manage_config.php: not found
==> default: Error: /vagrant/srv/phabricator/bin/config: 1: /vagrant/srv/phabricator/bin/config: ../scripts/setup/manage_config.php: not found
==> default: Error: /Stage[main]/Phabricator/Phabricator::Config[mysql.pass]/Exec[phab_set_mysql.pass]/returns: change from notrun to 0 failed: /vagrant/srv/phabricator/bin/config: 1: /vagrant/srv/phabricator/bin/config: ../scripts/setup/manage_config.php: not found
==> default: Notice: /Stage[main]/Phabricator/Exec[phab_setup_db]: Dependency Exec[phab_set_mysql.host] has failures: true
==> default: Notice: /Stage[main]/Phabricator/Exec[phab_setup_db]: Dependency Exec[phab_set_mysql.port] has failures: true
==> default: Notice: /Stage[main]/Phabricator/Exec[phab_setup_db]: Dependency Exec[phab_set_mysql.pass] has failures: true
==> default: Warning: /Stage[main]/Phabricator/Exec[phab_setup_db]: Skipping because of failed dependencies
==> default: Error: /vagrant/srv/phabricator/bin/config: 1: /vagrant/srv/phabricator/bin/config: ../scripts/setup/manage_config.php: not found

What happens is that the manage_config.php script is not found in ../scripts/setup/manage_config.php because the executing script is located in /vagrant/srv/phabricator/bin/config. .. resolves here to /vagrant/srv/phabricator/bin, not /vagrant/srv/phabricator, where the script directory is located. ../scripts/setup/manage_config.php should thus instead be ../../scripts/setup/manage_config.php.
config is a file-like symlink - but this didn't properly show on windows - which is the problem. If Phabricator is cloned on Linux, the symlinks will be proper symlinks, however when cloned on Windows, they turn in to regular files, which happens with Vagrant too. The virtual machine shows this too if you run ls -la in /vagrant/srv/phabricator/bin.

Potential solutions

  • Modify the puppet configuration files to use the direct path instead of the symlinks
  • Prevent the role from being enabled on Windows
  • Somehow support Windows symlinks

Event Timeline

Mainframe98 renamed this task from Phabricator role on MediaWiki-Vagrant fails with manage_config.php not found during provision to Phabricator role on MediaWiki-Vagrant on Windows fails with manage_config.php not found during provision due to symlinks.Jul 16 2017, 2:19 PM
Mainframe98 updated the task description. (Show Details)

Alright, so after some testing, it appears that symlinks are unsupported from the vagrant virtual machine, and from git on windows. However, if you manually create a symlink with mklink in cmd, the symlink is created and the vagrant virtual machine will see it a proper symlink. So, if the phabricator repository could get cloned on windows with the proper symlinks (which is a setting you have to enable during the install of git for windows), you might just get it to work.

Puppet handles the installation of Phabricator though, and I don't know if that means if for vagrant puppet checks the git repository out on the host or on the virtual machine. Assuming the former, this should then merely be an installation option to be set (if it uses git for windows), but if it is the latter, virtualbox must be started as administrator to have rights to create symlinks.

As a follow-up to the comment above, adding

config.vm.provider "virtualbox" do |v|
  v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
end

to the vagrant file allows puppet to actually create the repo and install Phabricator succesfully. This requires you to run vagrant with administrator rights.
There are some caveats to this method, though. From what I understand from the VirtualBox website is that this is disabled by default because it is a security risk. Thing is, on Windows, symlinks cannot link to directories outside the shared folders as the file directory structure is different from Linux, so what might be a solution is to add a conditional check to the vagrant file that verifies if the host operating system is Windows, and if so, it should enable symlinks.