Last active
October 17, 2023 12:02
-
-
Save fernandoaleman/5083680 to your computer and use it in GitHub Desktop.
How to update VirtualBox Guest Additions with vagrant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Start the old vagrant | |
$ vagrant init centos-6.3 | |
$ vagrant up | |
# You should see a message like: | |
# [default] The guest additions on this VM do not match the install version of | |
# VirtualBox! This may cause things such as forwarded ports, shared | |
# folders, and more to not work properly. If any of those things fail on | |
# this machine, please update the guest additions and repackage the | |
# box. | |
# | |
# Guest Additions Version: 4.1.18 | |
# VirtualBox Version: 4.2.8 | |
$ vagrant ssh | |
vagrantup:~$ sudo yum -y update | |
vagrantup:~$ cd /opt | |
vagrantup:~$ sudo wget -c http://download.virtualbox.org/virtualbox/4.2.8/VBoxGuestAdditions_4.2.8.iso \ | |
-O VBoxGuestAdditions_4.2.8.iso | |
vagrantup:~$ sudo mount VBoxGuestAdditions_4.2.8.iso -o loop /mnt | |
vagrantup:~$ cd /mnt | |
vagrantup:~$ sudo sh VBoxLinuxAdditions.run --nox11 | |
vagrantup:~$ cd /opt | |
vagrantup:~$ sudo rm *.iso | |
vagrantup:~$ sudo /etc/init.d/vboxadd setup | |
vagrantup:~$ sudo chkconfig --add vboxadd | |
vagrantup:~$ sudo chkconfig vboxadd on | |
vagrantup:~$ exit | |
# Now check that the Guest Additions work | |
$ vagrant halt | |
$ vagrant up | |
# Package the new VM | |
$ vagrant halt | |
$ vagrant package | |
$ mv package.box centos-6.3.box |
@krutcha this guide is for CentOS, not Ubuntu.
Thanks for that tip.It worked like charm!
Saved me many hours of investigation.
Hi guys, I'm sorry I'm pretty late to this party.
I have two apparent issues with Vagrant: the guest additions not matching and the NFS mount error. When I run Vagrant Up/Reload I get this...
Mathews-MacBook-Pro:ansible mathewthomas$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Removing hosts
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: A newer version of the box 'ubuntu/trusty64' is available! You currently
==> default: have version '20160323.0.0'. The latest is version '20160509.1.0'. Run
==> default: `vagrant box update` to update.
==> default: VirtualBox VM is already running.
Mathews-MacBook-Pro:ansible mathewthomas$ vagrant reload
==> default: Removing hosts
==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: A newer version of the box 'ubuntu/trusty64' is available! You currently
==> default: have version '20160323.0.0'. The latest is version '20160509.1.0'. Run
==> default: `vagrant box update` to update.
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
**default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.3.36
default: VirtualBox Version: 5.0**
==> default: Checking for host entries
==> default: Skipping adding host entries (config.vm.network hostsupdater: "skip" is set)
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Exporting NFS shared folders...
==> default: Preparing to edit /etc/exports. Administrator privileges will be required...
==> default: Mounting NFS shared folders...
**The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mount -o 'vers=3,udp' 192.168.50.1:'/Users/mathewthomas/Sites/eightloop/site' /vagrant-nfs-eightloop.io
Stdout from the command:
Stderr from the command:
mount.nfs: requested NFS version or transport protocol is not supported**
I have been having trouble for a few days. Do you think these isses could be related?
Thanks.
Sorted.
I just ran 'vagrant ssh', 'apt-get update', and 'apt-get install nfs-common nfs-kernel-server'.
Ran like a dream.
Sorry to bother you, cheers.
"sudo /etc/init.d/vboxadd setup" : "command not found".
edit added: this gist requires some extra one-time preparatory steps ...
Can you help me? It can't find that path
sudo: /etc/init.d/vboxadd: command not found```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This does not seem to work for me, perhaps I am doing it wrong. I used a basebox (precise32), then uninstalled the guest additions, installed the kernel headers, dkms, etc, and latest guest additions (5.0.10). I then ran the guest additions. After exiting and halting, I did a vagrant package. When I deploy this new .box (vagrant box add, vagrant init, vagrant up).. it has the OLD guest additions it seems every time. Is there something special needed to make the modified additions stick in a 'package'?