Homestead updating

Published 3 months ago by Mattiman

So, like every six months or so I'm back asking for help fixing Homestead update problems. From the last time I asked https://laracasts.com/discuss/channels/general-discussion/homestead-upgrade?page=1 I have had this list of command I run to update. It worked for a couple of times:

Download and install latest VirtualBox
https://www.virtualbox.org/wiki/Downloads
Download and install latest vagrant
https://www.vagrantup.com/downloads.html
Update box and repo Homestead:
$ cd ~/Homestead
$ git fetch origin
$ git checkout v7.1.0 // whichever tag is released
$ vagrant box update
$ vagrant destroy
$ rm -rf .vagrant
$ vagrant up

But today I tried this again but I get this:

$ cd ~/Homestead
$ git fetch origin
remote: Counting objects: 15, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 15 (delta 8), reused 14 (delta 8), pack-reused 0
Unpacking objects: 100% (15/15), done.
From https://github.com/laravel/homestead
   4ee5e98..9f36545  master     -> origin/master
 * [new tag]         v7.3.0     -> v7.3.0
 * [new tag]         v7.2.0     -> v7.2.0
$ git checkout v7.3.0
Previous HEAD position was 4ee5e98... ? ? Update version to 7.1.2
HEAD is now at 9f36545... ❄️ ? ? Require box v5.2.x and tag v7.3.0
$ vagrant box update
==> homestead-7: Box 'laravel/homestead' not installed, can't check for updates.

So why do I get this message? I certainly have Homestead installed. And what can I do now?

ejdelmonico

I would change your process a bit. I never seem to have any issues with Homestead but I use only about 20% of the time now that Valet is out. What I do is update VirtualBox and Vagrant to the latest. Get rid of the last homestead box. I do not delete the .vagrant file and you should not have to either. I then make sure that the box is deleted in VirtualBox. Next, I run vagrant box update to get the latest box. Last, go to Homestead directory and do a git fetch and git checkout and then vagrant up. The process will tell you if you don't meet the box and repo version number requirements.

You might be getting those messages because you are removing .vagrant.

Mattiman

Hi @ejdelmonico I created that list of commands thanks to your help last year https://laracasts.com/discuss/channels/general-discussion/homestead-upgrade?page=1 You description now is different from the one you gave then.

About the "I do not delete the .vagrant file and you should not have to either": To be honest I don't even think I have a .vagrant file. So the command $ rm -rf .vagrant probably doesn't do anything. I do have a .vagrant.d directory with a directory inside called "boxes".

At the moment I have these files in my user directory:

.homestead/
  .vagrant/
    machines/
      default/
        virtualbox/
          // empty
    after.sh
    aliases
.vagrant.d/
  boxes/
    laravel-VAGRANTSLASH-homestead/
      5.2.0/
        virtual box/
    // some more files
code/Homestead/
   // some more files

But I did solve the problem, by doing this command:

$ vagrant box update
==> homestead-7: Box 'laravel/homestead' not installed, can't check for updates.
$ vagrant box add laravel/homestead

$ rm -rf .vagrant
$ vagrant up

It's all still very fuzzy to me. You have Vagrant, vagrant boxes, Homestead box, homestead code, etc. Haven't found a clear explanation of what everything is exactly yet. The official docs are lacking as well, since the only command you need according to those are:

vagrant box update
git pull origin master

So nothing about destroying or removing boxes.

ejdelmonico

I should have more clear. The only reason to remove .vagrant is if you have had a troubled install and want to start over (several homestead versions ago). That is why I mentioned you shouldn't have to.

The .vagrant and .vagrant.d directories live in your home directory by default on a Mac or Linux. The .vagrant file is not used by Homestead any longer. Also note that there is a specific command for destroying the box vagrant destroy [name|id]. You can run vagrant box list to get box names. Destroy removes the currently built box and its providers while remove deletes the box and prune deletes old box versions.

Mattiman

Ok I will leave out the rm -rf .vagrant command from now on.

About what you say "Destroy removes the currently built box and its providers while remove deletes the box and prune deletes old box versions" This is not very clear. If I break up the sentence:

  • Destroy removes the currently built box and its providers
  • remove deletes the box
  • prune deletes old box versions

What is the difference between remove and delete (of a box)?

What is "its providers"?

Prune is the same as vagrant box remove laravel/homestead --box-version=0.4.4 (but then for all older boxes?)

Thanks for the help, appreciated

Please sign in or create an account to participate in this conversation.