Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

Laravel HomesteadをHyper-Vで起動しようとすると、"Exporting an SMB share failed!"となる場合の回避策

More than 1 year has passed since last update.

2019/01/06追記
2019/01/03に記載した回避策は全く見当違いでしたので、記事修正しました。修正はvagrantのmasterにマージされたようなので、近くvagrantのリリースに取り込まれると思われます。

筆者の環境

  • Windows 10 Pro (1809)
  • Vagrant 2.2.2
  • PHP 7.2.13
  • Vagrant Box laravel/homestead (hyperv, 6.4.0)
  • PHP Package laravel/homestead v7.20.0

現象

Homestead.yamlは、.\vendor\bin\homestead.bat makeで生成したものから、providerhypervに書き換えたのみ。

C:\Users\UserName\Documents\your-app にてvagrantで仮想マシンを起動しようとすると、以下のエラーが出て正常に起動しない。

> vagrant up
Bringing machine 'your-app-name' up with 'hyperv' provider...
==> your-app-name: Verifying Hyper-V is enabled...
==> your-app-name: Verifying Hyper-V is accessible...
==> your-app-name: Importing a Hyper-V instance
    your-app-name: Creating and registering the VM...
    your-app-name: Successfully imported VM
    your-app-name: Please choose a switch to attach to your Hyper-V instance.
    your-app-name: If none of these are appropriate, please open the Hyper-V manager
    your-app-name: to create a new virtual switch.
    your-app-name:
    your-app-name: 1) DockerNAT
    your-app-name: 2) Default Switch
    your-app-name:
    your-app-name: What switch would you like to use? 2
    your-app-name: Configuring the VM...
==> your-app-name: Starting the machine...
==> your-app-name: Waiting for the machine to report its IP address...
    your-app-name: Timeout: 120 seconds
    your-app-name: IP: 172.17.186.66
==> your-app-name: Waiting for machine to boot. This may take a few minutes...
    your-app-name: SSH address: 172.17.186.66:22
    your-app-name: SSH username: vagrant
    your-app-name: SSH auth method: private key
    your-app-name:
    your-app-name: Vagrant insecure key detected. Vagrant will automatically replace
    your-app-name: this with a newly generated keypair for better security.
    your-app-name:
    your-app-name: Inserting generated public key within guest...
    your-app-name: Removing insecure key from the guest if it's present...
    your-app-name: Key inserted! Disconnecting and reconnecting using new SSH key...
==> your-app-name: Machine booted and ready!
==> your-app-name: Preparing SMB shared folders...
    your-app-name: You will be asked for the username and password to use for the SMB
    your-app-name: folders shortly. Please use the proper username/password of your
    your-app-name: account.
    your-app-name:
    your-app-name: Username: YourName
    your-app-name: Password (will be hidden):

Vagrant requires administrator access to create SMB shares and
may request access to complete setup of configured shares.
Exporting an SMB share failed! Details about the failure are shown
below. Please inspect the error message and correct any problems.

Host path:

Stderr:

Stdout:


回避策

このリンク先の修正内容に従い、C:\HashiCorp\Vagrant\embedded\gems\2.2.2\gems\vagrant-2.2.2\lib\vagrant\util\powershell.rb 内の Base64.urlsafe_encode64Base64.strict_encode64 に置き換える。

> vagrant up
Bringing machine 'your-app-name' up with 'hyperv' provider...
==> your-app-name: Verifying Hyper-V is enabled...
==> your-app-name: Verifying Hyper-V is accessible...
==> your-app-name: Importing a Hyper-V instance
    your-app-name: Creating and registering the VM...
    your-app-name: Successfully imported VM
    your-app-name: Please choose a switch to attach to your Hyper-V instance.
    your-app-name: If none of these are appropriate, please open the Hyper-V manager
    your-app-name: to create a new virtual switch.
    your-app-name:
    your-app-name: 1) DockerNAT
    your-app-name: 2) Default Switch
    your-app-name:
    your-app-name: What switch would you like to use? 2
    your-app-name: Configuring the VM...
==> your-app-name: Starting the machine...
==> your-app-name: Waiting for the machine to report its IP address...
    your-app-name: Timeout: 120 seconds
    your-app-name: IP: 172.17.186.77
==> your-app-name: Waiting for machine to boot. This may take a few minutes...
    your-app-name: SSH address: 172.17.186.77:22
    your-app-name: SSH username: vagrant
    your-app-name: SSH auth method: private key
    your-app-name:
    your-app-name: Vagrant insecure key detected. Vagrant will automatically replace
    your-app-name: this with a newly generated keypair for better security.
    your-app-name:
    your-app-name: Inserting generated public key within guest...
    your-app-name: Removing insecure key from the guest if it's present...
    your-app-name: Key inserted! Disconnecting and reconnecting using new SSH key...
==> your-app-name: Machine booted and ready!
==> your-app-name: Preparing SMB shared folders...
    your-app-name: You will be asked for the username and password to use for the SMB
    your-app-name: folders shortly. Please use the proper username/password of your
    your-app-name: account.
    your-app-name:
    your-app-name: Username: YourName
    your-app-name: Password (will be hidden):

Vagrant requires administrator access to create SMB shares and
may request access to complete setup of configured shares.
==> your-app-name: Setting hostname...
==> your-app-name: Mounting SMB shared folders...
    your-app-name: C:/Users/YourName/Documents/your-app => /home/vagrant/code
    your-app-name: C:/Users/YourName/Documents/your-app => /vagrant
(以下略)

以上で、正常に起動できました。

data9824
ソフトウェアエンジニア / 代表取締役社長 - 株式会社ヨドウェア / 機械学習の投稿については http://goo.gl/Pdvp0 の資料もご参照ください。
https://data9824.com
yodoware
ソフトウェア技術でできることがたくさんあります。私たちソフトウェアの専門家にお任せください。
https://yodoware.co.jp
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away