How I can get /vagrant folder on ubuntu/xenial64

后端 未结 5 1470
情歌与酒
情歌与酒 2021-02-20 16:58

I have just installed vagrant box with command:

vagrant init ubuntu/xenial64

and the booted it up with:

vagrant up --provider v         


        
5条回答
  •  离开以前
    2021-02-20 17:01

    Update:

    This problem was finally fixed in version v20160921.0.0 and higher of the official 16.04 vagrant box. The release before that v20160909.0.0 is also fixed but has another unrelated issue, as pointed out by Poma in the comments.

    You can use the following command to download the new version and also replace your old VM instance with a fresh one. However, upgrading the box wipes your original VM instance.

    vagrant box update
    

    If you don't want to wipe your VM for some reason, you can still apply my original fixes below.

    Original Post:

    Apparently the official ubuntu/xenial64 image is broken, as indicated in this bug report on launchpad.

    Here's a quote from the comments by Louis Zuckerman with all the issues which are still unfixed as of version 20160627.0.0 from what I could tell:

    There are a number of issues with the official vagrant box for xenial:

    1. necessary packages are missing (synced folders not working, no config management)
    2. default /vagrant synced folder is disabled
    3. vm name is static, so you can only have one instance of the box on a host

    [...]

    These steps fixed issues 1 and 2 for me:

    1. ssh into the box and install the missing guest additions manually

      vagrant ssh
      sudo apt-get install virtualbox-guest-utils
      exit 
      
    2. manually add the missing mountpoint to your Vagrantfile

      config.vm.synced_folder ".", "/vagrant/" # fix broken ubuntu/xenial64 image
      

    To fix the third issue you have to give a unique name to the box manually by adding a provider-specific option for VirtualBox to your Vagrantfile.

    config.vm.provider "virtualbox" do |vb|
      vb.name = "This_Name_Is_Unique_For_This_Machine"
    end
    

    There is a more detailed discussion of this issue here as pointed out in the comments to this answer.

提交回复
热议问题