packer-boxes icon indicating copy to clipboard operation
packer-boxes copied to clipboard

New Ubuntu box does not execute the vbguest plugin

Open BenjaminLeibinger opened this issue 2 years ago • 2 comments

After upgrading the vagrant ubuntu box to version 1.0.4 the vbguest plugin does not run his installer. So the Guest Additions are not installed / updated. Without this, its not possible to properly start the vm and mount the vagrant dir.

my setup:

  • Host OS Ubuntu 20.04
  • virtualbox 6.1.26 (also testet with 6.1.32)
  • Vagrant 2.2.19
  • Vagrant plugins: vagrant-hosts-provisioner (2.0, global), vagrant-hostsupdater (1.2.4, global), vagrant-vbguest (0.30.0, global)
xx@xx:~$ vagrant up testvm
Bringing machine 'testvm' up with 'virtualbox' provider...
==> testvm: Importing base box 'geerlingguy/ubuntu2004'...
==> testvm: Matching MAC address for NAT networking...
==> testvm: Checking if box 'geerlingguy/ubuntu2004' version '1.0.4' is up to date...
==> testvm: [vagrant-hostsupdater] Checking for host entries
==> testvm: [vagrant-hostsupdater]   found entry for: 192.168.33.93 testvm.local
==> testvm: [vagrant-hostsupdater]   found entry for: fe80::33:93 testvm.local
==> testvm: Setting the name of the VM: testvm_1646148926205_10396
==> testvm: Clearing any previously set network interfaces...
==> testvm: Preparing network interfaces based on configuration...
    testvm: Adapter 1: nat
    testvm: Adapter 2: hostonly
    testvm: Adapter 3: hostonly
==> testvm: Forwarding ports...
    testvm: 22 (guest) => 2222 (host) (adapter 1)
==> testvm: Running 'pre-boot' VM customizations...
==> testvm: Booting VM...
==> testvm: Waiting for machine to boot. This may take a few minutes...
    testvm: SSH address: 127.0.0.1:2222
    testvm: SSH username: vagrant
    testvm: SSH auth method: private key
==> testvm: Machine booted and ready!
[testvm] GuestAdditions seems to be installed (6.1.32) correctly, but not running.
update-initramfs: Generating /boot/initrd.img-5.4.0-42-generic
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel 
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel 5.4.0-42-generic.

This system is currently not set up to build kernel modules.
Please install the gcc make perl packages from your distribution.
VirtualBox Guest Additions: Running kernel modules will not be replaced until 
the system is restarted
Restarting VM to apply changes...
==> testvm: Attempting graceful shutdown of VM...
==> testvm: Booting VM...
==> testvm: Waiting for machine to boot. This may take a few minutes...
==> testvm: Machine booted and ready!
==> testvm: Checking for guest additions in VM...
==> testvm: Setting hostname...
==> testvm: Configuring and enabling network interfaces...
==> testvm: Mounting shared folders...
    testvm: /vagrant => /home/xxxx
Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:

mount -t vboxsf -o uid=900,gid=900,_netdev vagrant /vagrant

The error output from the command was:

/sbin/mount.vboxsf: mounting failed with the error: Invalid argument

Its possible to manually trigger the guest additions installation by running:

vagrant vbguest hausweblocal --do install --no-cleanup

After downgrading the vagrant box to Version 1.0.3 everything works as expected:

vagrant box remove geerlingguy/ubuntu2004
vagrant box add --box-version 1.0.3 'geerlingguy/ubuntu2004'

And then run vagrant up again:

xx@xx:~$ vagrant up testvm
Bringing machine 'testvm' up with 'virtualbox' provider...
==> testvm: Importing base box 'geerlingguy/ubuntu2004'...
==> testvm: Matching MAC address for NAT networking...
==> testvm: Checking if box 'geerlingguy/ubuntu2004' version '1.0.3' is up to date...
==> testvm: A newer version of the box 'geerlingguy/ubuntu2004' for provider 'virtualbox' is
==> testvm: available! You currently have version '1.0.3'. The latest is version
==> testvm: '1.0.4'. Run `vagrant box update` to update.
==> testvm: [vagrant-hostsupdater] Checking for host entries
==> testvm: [vagrant-hostsupdater]   found entry for: 192.168.33.93 testvm.local
==> testvm: [vagrant-hostsupdater]   found entry for: fe80::33:93 testvm.local
==> testvm: Setting the name of the VM: testvm_1646149817701_5418
==> testvm: Clearing any previously set network interfaces...
==> testvm: Preparing network interfaces based on configuration...
    testvm: Adapter 1: nat
    testvm: Adapter 2: hostonly
    testvm: Adapter 3: hostonly
==> testvm: Forwarding ports...
    testvm: 22 (guest) => 2222 (host) (adapter 1)
==> testvm: Running 'pre-boot' VM customizations...
==> testvm: Booting VM...
==> testvm: Waiting for machine to boot. This may take a few minutes...
    testvm: SSH address: 127.0.0.1:2222
    testvm: SSH username: vagrant
    testvm: SSH auth method: private key
==> testvm: Machine booted and ready!
[testvm] GuestAdditions versions on your host (6.1.26) and guest (6.1.22) do not match.
Reading package lists...
Building dependency tree...
Reading state information...
linux-headers-5.4.0-42-generic is already the newest version (5.4.0-42.46).
The following additional packages will be installed:
  build-essential dctrl-tools dpkg-dev fakeroot g++ g++-9 gcc gcc-9
  libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl
  libasan5 libatomic1 libc-dev-bin libc6-dev libcc1-0 libcrypt-dev
  libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-9-dev libgomp1
  libitm1 liblsan0 libquadmath0 libstdc++-9-dev libtsan0 libubsan1
  linux-libc-dev manpages-dev
Suggested packages:
  debtags menu debian-keyring g++-multilib g++-9-multilib gcc-9-doc
  gcc-multilib autoconf automake libtool flex bison gdb gcc-doc gcc-9-multilib
  gcc-9-locales glibc-doc bzr libstdc++-9-doc
The following NEW packages will be installed:
  build-essential dctrl-tools dkms dpkg-dev fakeroot g++ g++-9 gcc gcc-9
  libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl
  libasan5 libatomic1 libc-dev-bin libc6-dev libcc1-0 libcrypt-dev
  libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-9-dev libgomp1
  libitm1 liblsan0 libquadmath0 libstdc++-9-dev libtsan0 libubsan1
  linux-libc-dev manpages-dev
0 upgraded, 31 newly installed, 0 to remove and 4 not upgraded.
Need to get 29.4 MB of archives.
....

BenjaminLeibinger avatar Mar 01 '22 16:03 BenjaminLeibinger

Hmm... /sbin/mount.vboxsf: mounting failed with the error: Invalid argument I wonder if there's a version mismatch somewhere?

geerlingguy avatar Mar 01 '22 16:03 geerlingguy

I also had in one run the following addition in the output:

.....
    testvm: SSH auth method: private key
==> testvm: Machine booted and ready!
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   6.1.6
VBoxService inside the vm claims: 6.1.32
Going on, assuming VBoxService is correct...
[hausweblocal] GuestAdditions seems to be installed (6.1.32) correctly, but not running.
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   6.1.6
VBoxService inside the vm claims: 6.1.32
Going on, assuming VBoxService is correct...
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   6.1.6
VBoxService inside the vm claims: 6.1.32
Going on, assuming VBoxService is correct...
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel 
....

and the Virtualbox on your host claims: 6.1.6 could be verified by:

xx@yyy$:~ vboxmanage showvminfo --machinereadable testvm | grep GuestAdditionsVersion
GuestAdditionsVersion="6.1.6_Ubuntu r137129"

BenjaminLeibinger avatar Mar 01 '22 16:03 BenjaminLeibinger