neubert
neubert

Reputation: 16782

make it so vagrant doesn't run apt-get update automatically

When I do vagrant up on a new machine it tries do a sudo apt-get update before it runs of the provisioning lines. It appears that the process still exists however.

My Vagrantfile:

Vagrant.configure("2") do |config|
    config.vm.box = "scotch/box"
    config.vm.box_version = "1.5.0"
    config.vm.box_check_update = false
    config.vm.network "private_network", ip: "192.168.33.10"
    config.vm.hostname = "vagrant"

    config.vm.provision "shell", inline: <<-SHELL
        apt-get -y install pdftk
    SHELL
end

The problem is that some of the APT repos are returning 404's. This is causing output to stderr which appears to be preventing the shell provisioner winds up not running. Doing vagrant halt and then vagrant up a second time seems to do the trick but I'd rather not have to do 3x commands when 1x could be sufficient.

Anyway ideas how to disable this behavior?

Here's the output when I do vagrant up after doing vagrant destroy:

https://pastebin.com/4Hh49J7c

Upvotes: 1

Views: 1873

Answers (1)

Frederic Henri
Frederic Henri

Reputation: 53713

The errors in the logs are due to the vagrant vbguest plugin. This plugin will need to install the guest additions package for virtualbox matching your version and to do so some apt-get update are run.

You can disable this if this is causing issues during the creation of your VM

Vagrant.configure("2") do |config|
  config.vbguest.auto_update = false
end

If you later want to align the version between virtualbox and the guest addition (this is recommended) you can run the following command

$ vagrant vbguest install

Upvotes: 4

Related Questions