Can I simply change the config.vm.box
from ubuntu/precise64
to
ubuntu/trusty64
and then do a vagrant provision (or is it reload?), or
will this potentially cause problems on my existing vm which has a lot
of software installed on it already?
Well, if you change the value from ubuntu/precise64
to ubuntu/trusty64
all that will do is indicate that if you destroy the existing Vagrant VM (via vagrant destroy [box name]
) and then rebuild it via vagrant up [box name]
that the new Vagrant box will be ubuntu/trusty64
. Meaning, you will not affect an OS upgrade of your existing boxes by simply changing the value of config.vm.box
.
Upgrading Ubuntu 12 to 14 on an existing virtual machine.
If you want to upgrade your existing box to Ubuntu 14 from Ubuntu 12 without affecting already installed software on the the Ubuntu 12 install, you need to SSH into that Ubuntu 12 box and run this command to get the update manager core package installed:
sudo apt-get install update-manager-core
The run do-release-upgrade
to actually do the upgrade from Ubuntu 12 to Ubuntu 14:
sudo do-release-upgrade
That said, read my note at the bottom on how a clean upgrade from one major release of an OS to another is not as simple as you might think.
You should investigate using provisioning scripts.
But that said, this is really not the way Vagrant should be upgraded or what it’s intended for. You are saying you have tons of software installed on the box, but if you installed those manually, you are not really leveraging Vagrant’s core strength: The ability to build, destroy and rebuild virtual machines on demand.
The way I use Vagrant is to have it build boxes but also run a provisioning script that can automate the process of software install and configuration.
You might need to reinstall or upgrade software and configs anyway.
But that said, when I had to upgrade my own Vagrant stuff from Ubuntu 12 to Ubuntu 14, I had to adjust my provisioning scripts to account for new items such as new file system locations, new versions of core software and such… Meaning, it’s not always a straightforward process and is highly dependent on what software you are using and what your specific configuration of that software is.
Thanks Jake this is awesome. I overstated the situation of lots of software configured, I'm actually doing most of that in the VagrantFile. So you've answered my question and also your mention of update-manager-core before do-release-upgrade is new to me and helpful! – David – 2016-12-14T15:46:21.133