Vagrant บน Windows 10 Pro และ Hyper-V General access ปฏิเสธข้อผิดพลาดในโฟลเดอร์แชร์ SMB

สิ่งแวดล้อม

Windows 10 pro พร้อม Hyper-V
Vagrant v.2.2.6

สถานะ

กำลังพยายามเริ่มต้น homestead VM ด้วยโฟลเดอร์แชร์ SMB ผ่าน Powershell และผู้ใช้ผู้ดูแลระบบ แต่ก็ไม่มีโชค

แชร์โฟลเดอร์ 'Site' และสร้างผู้ใช้เฉพาะ (usr:vagrant, pwd:vagrant) พร้อมสิทธิ์เข้าถึงโฟลเดอร์แชร์โดยสมบูรณ์

ลำบากจริงๆกับเรื่องนี้

ตั้งค่าโฟลเดอร์แชร์เป็น Sites\mysite (ไม่มีพาธที่สมบูรณ์) เนื่องจากฉันแชร์เฉพาะโฟลเดอร์นี้ใช่ไหม

ข้อผิดพลาด

PS C:\Users\sgrat\Desktop\Sites\Homestead> vagrant up --provision
Bringing machine 'homestead' up with 'hyperv' provider...
==> homestead: Verifying Hyper-V is enabled...
==> homestead: Verifying Hyper-V is accessible...
    homestead: Configuring the VM...
==> homestead: Starting the machine...
An error occurred while executing a PowerShell script. This error
is shown below. Please read the error message and see if this is
a configuration error with your system. If it is not, then please
report a bug.

Script: start_vm.ps1
Error:

Failed to start VM 'homestead' failed to start.

Synthetic SCSI Controller (Instance ID 480D9BCD-B214-461F-976E-2A9A546F9BB8): Failed to Power on with Error 'General access denied error'.

 Account does not have permission to open attachment 'C:\Users\sgrat\Desktop\Sites\Homestead\.vagrant\machines\homestead\hyperv\Virtual Hard Disks\ubuntu-18.04-amd64.vhdx'. Error: 'General access denied error'.

'homestead' failed to start. (Virtual machine ID 555B1C43-AC2B-4B9C-A9B2-94BF40753C40)

'homestead' Synthetic SCSI Controller (Instance ID 480D9BCD-B214-461F-976E-2A9A546F9BB8): Failed to Power on with Error 'General access denied error' (0x80070005). (Virtual machine ID 555B1C43-AC2B-4B9C-A9B2-94BF40753C40)

'homestead':  Account does not have permission to open attachment 'C:\Users\sgrat\Desktop\Sites\Homestead\.vagrant\machines\homestead\hyperv\Virtual Hard Disks\ubuntu-18.04-amd64.vhdx'. Error: 'General access denied error' (0x80070005). (Virtual machine ID 555B1C43-AC2B-4B9C-A9B2-94BF40753C40)

Homestead.yaml

ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: hyperv

authorize: c:/Users/sgrat/.ssh/id_rsa.pub

keys:
    - c:/Users/sgrat/.ssh/id_rsa

folders:
    - map: Sites\mysite
      to: /home/vagrant/mysite
      php: '7.2'
      type: "smb"
      smb_host: 127.0.0.1
      smb_username: vagrant
      smb_password: vagrant

sites:
    - map: mysite.test
      to: /home/vagrant/mysite

databases:
    - mysitedb

features:
    - mariadb: true
    - ohmyzsh: false
    - webdriver: false

person fudo    schedule 03.12.2019    source แหล่งที่มา


คำตอบ (1)


ฉันไม่สามารถพูดถึงความถูกต้องของการใช้เส้นทางไฟล์แบบสัมพันธ์ได้ ฉันแค่จำได้ว่าฉันมีปัญหาบางอย่างเมื่อฉันไม่ได้ใช้แบบเต็ม ฉันใช้ Git Bash แต่นอกเหนือจากการตั้งค่าเดียวกันกับคุณ: Win 10, Hyper-V, Vagrant 2.2.6

นี่คือไฟล์ Homestead.yaml ของฉัน:

---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: C:\Users\leif.lundberg\code
      to: /home/vagrant/code
      type: "nfs"

sites:
    - map: homestead.test
      to: /home/vagrant/code/symfobase/public

databases:
    - homestead

features:
    - mariadb: false

นอกจากนี้ ฉันไม่ทราบว่าการแมป keys ของคุณถูกต้องหรือไม่ และอาจทำให้เกิดปัญหาในการใช้ฟอร์เวิร์ดสแลช "/" แทนแบ็กสแลช "\"

person leiflundberg    schedule 04.12.2019
comment
ฉันไม่คิดว่าเส้นทาง keys ของฉันเป็นปัญหาเนื่องจากฉันไม่ได้รับข้อผิดพลาดเกี่ยวกับ 'ไม่พบไฟล์' หรือเช่นนั้น - person fudo; 04.12.2019
comment
คุณได้ลองใช้เส้นทางแบบเต็มไปยังโฟลเดอร์ Sites ของคุณแล้วหรือยัง? คล้ายกับวิธีการสร้าง Homestead.yaml ของฉัน - person leiflundberg; 04.12.2019