A VirtualBox machine with the name 'homestead' already exists

前端 未结 30 4014
旧巷少年郎
旧巷少年郎 2020-12-02 04:58

Since homestead 2.0 homestead laravel has not been working

I don\'t know why \'homestead init\' creates a Homestead.yaml file in mydirectory/.homestead and not in

30条回答
  •  爱一瞬间的悲伤
    2020-12-02 05:38

    If you want to keep keep your machine, without destroying and recreating following steps should solve your problem. (I work on OS X El Captain, Vagrant 1.8.1)

    Run homestead in debug mode

    homestead --debug up
    

    Look for something like in the output:

    INFO machine: Initializing machine: default INFO machine: - Provider: VagrantPlugins::ProviderVirtualBox::Provider INFO machine: - Box: # INFO machine: - Data dir: /Users/YOUR_HOME_DIR/Workspace/Homestead/.vagrant/machines/default/virtualbox

    Data dir, is the path which is interesting for you.

    Then vboxmanage list vms

    "homestead" {0e8438b9-4a67-4fb1-80cb-2c62cf04ab5c} "settler_default_1447385930122_73498_1474294682778_13108" {93ecb93f-f159-4406-a384-5312b4d3ab34}

    Edit id file, in the path which you found out in the previous command

    vi /Users/YOUR_HOME_DIR/Workspace/Homestead/.vagrant/machines/default/virtualbox/id
    

    Replace content of that file, with the id of the VM you want to fix, in this scenario it is

    0e8438b9-4a67-4fb1-80cb-2c62cf04ab5c

    Now try

    homestead up
    

    VM should start booting. It might work, or you might have issues with ssh authentication

    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Authentication failure. Retrying...     default: Warning: Authentication failure. Retrying...
    

    To fix that do following Check Homestead SSH config

    homestead ssh-config
    

    You should get something like

    Host default HostName 127.0.0.1 User vagrant Port 2222
    UserKnownHostsFile /dev/null StrictHostKeyChecking no
    PasswordAuthentication no
    IdentityFile "/Users/pryznar/.vagrant.d/insecure_private_key"
    IdentitiesOnly yes LogLevel FATAL

    Edit IdentityFile file

    /Users/YOUR_HOME_DIR/.vagrant.d/insecure_private_key
    

    Check Homestead.yml

    cat /Users/YOUR_HOME_DIR/.homestead/Homestead.yaml
    

    Then copy path to the file under the key keys, and copy private key from that file

    cat ~/.homestead/ssh/id_rsa
    

    Last step is to replace private key in /Users/YOUR_HOME_DIR/.vagrant.d/insecure_private_key with the one you just copied

    Now try rung homestead again, should work.

    homestead up
    

    I got some warnings, but so far it works without issues

    ==> default: Warning: Using a password on the command line interface can be insecure. ==> default: ERROR 1045 (28000): Access denied for user 'homestead'@'localhost' (using password: YES) The SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed. The output for this command should be in the log above. Please read the output to determine what went wrong.

提交回复
热议问题