-
Notifications
You must be signed in to change notification settings - Fork 213
Installation/Update of Virtualbox Guest Additions fails #351
Comments
We are having the same issue, similar setup as above but with box "debian/jessie64" From vagrant up:
|
Having the same issue. |
I found it. I was using a debian base box (stretch64) which has linux kernel 4.9.0-9 installed. The vbguest plugin is using uname -r to define the version, so it tries to install linux-headers-4.9.0-9 which does not exist on the mirrors anymore (it's 4.9.0-11 now). Not sure how to solve it. Of course it needs to get the headers of the current kernel, but it limits you to base boxes which are very up to date. |
For me a solution similar to the apt update (that can be turned off from config) would be just perfect. |
As a workaround I created a provisioning step for a dist-upgrade on my debian pipeline while disabling the plugin in that step. |
As a workaround you can disable auto update in Vagrantfile.
It won't raise error on provision and won't install Virtualbox Guest Additions as well. |
@Mephistokrates Would you mind sharing how you did that? I've fiddled with triggers for a bit now and couldn't get that to work. |
This is how far I got:
But synced folder mount still fails fir the first vagrant up.
Also there is an interesting part during guest install that might be related:
Any suggestion? |
Experiencing the same issue. In my opinion, doing an apt-get update is tolerable. However, an apt-get upgrade can only be a workaround at best. It makes the whole concept of version-controlling the configuration of a virtual machine pointless. Example: Let's say one uses desktop VMs for development. Some day a bug occurs that is suspected to be related to machine configuration. One recreates a machine from a couple weeks ago to track down the bug. With upgrading being a part of machine creation this will lead nowhere. |
I may have an alternative solution that doesn't require to upgrade the whole system. It requires adding appropriate debian archive repositories (snapshots) to sources.list before running apt-get update and installing the guest additions. Source: |
I can confirm this problem with a "debian/contrib-buster64" box in this environment:
I can also confirm that manually upgrading and rebooting the box is a workaround. The error happens when it is tried to install the kernel headers with the command |
Case solved for me: |
@gzp-crey The reason why Ubuntu is working is probably because the base box is more current. Some of them (for example xenial) have been released some days ago. I still think the "right" solution would be to have a configuration parameter that allows the plugin to run apt-get update and a kernel-upgrade before actually installing the additions. If I was familiar with Ruby I would submit a PR by myself, but... I'm not. @fnordfish ? :) |
@checkphi yes, your recommendation for a solution seems to be the most useful variant. The aproach, shown by @zpgaal seems to be a starting point. It only lacks the reboot after the upgrade. |
RE forcing reboot: with 0.20.0 there’s a new optional method installer classes can provide: `reboot_after_install?(opts=nil, &block)` https://github.com/dotless-de/vagrant-vbguest/blob/2be16c7ef4bd4b28d2208c3a9822cfff1e807f43/lib/vagrant-vbguest/installers/base.rb#L128
In your custom installer, just define this method and let it return true and vbguest will issue a “vagrant restart” after the install step
From: Josef Wachtler <[email protected]><mailto:[email protected]>
Reply: dotless-de/vagrant-vbguest <[email protected]><mailto:[email protected]>
Date: 1. October 2019 at 09:41:08
To: dotless-de/vagrant-vbguest <[email protected]><mailto:[email protected]>
CC: Robert Schulze <[email protected]><mailto:[email protected]>, Mention <[email protected]><mailto:[email protected]>
Subject: Re: [dotless-de/vagrant-vbguest] Installation/Update of Virtualbox Guest Additions fails (#351)
@checkphi<https://github.com/checkphi> yes, your recommendation for a solution seems to be the most useful variant. The aproach, shown by @zpgaal<https://github.com/zpgaal> seems to be a starting point. It only lacks the reboot after the upgrade.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#351?email_source=notifications&email_token=AAADEJ3TX7ZAAZXB5F56CYLQML5JJA5CNFSM4I2MX76KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAAJ5VQ#issuecomment-536911574>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AAADEJYEKGRBSKFVA3PA5YDQML5JJANCNFSM4I2MX76A>.
|
@fnordfish But wouldn't you say that this should be a native feature of the plugin instead of fixing it with a custom method? Although it's not affecting every user and depends on the version of the base box, it's a systematic problem which is very likely to happen in the future again. |
@fnordfish When exactly will this reboot happen? After installing the guest additions is too late because the reboot has to happen before the installation but after the upgrade of the box. @checkphi I am also the oppinion that this should be a native feature of the plugin because of the same reasons. |
I've confirmed the error with debian/buster64 as well. |
We ran into this issue a few days ago. I'm sure it doesn't apply to everyone's use case, but for ours, we are also the same people building the Vagrant box with packer, and we use the Debian 9.9.0 ISO to do it. I worked around this by adding This avoids having to figure out how to fetch them later (e.g. from a snapshot repo), and also ensures this won't happen again when we start using a later ISO and its kernel headers get removed from public repos, too. |
@moduspwnens That sounds awesome and thank you but how exactly do I fix the issue? What do I need to do or not do? Thank you! |
@shrimpwagon It only applies if you're building your own VirtualBox box files from one of the official Debian ISOs, which I don't think is the most common use case for Vagrant. From my research, it looks like it's far more common to use one of the ones Vagrant Cloud packages up and provides (e.g. If you're building them from the ISOs, your work will look more like this example here: In that repo, you'll find a But switching to building your own Debian vagrant boxes (if you're not already doing that) just to workaround this issue is likely overkill. |
I had some time to try a few things. As we know, the headers are no longer available from the repositories and we can get them from the snapshot archive repositories (snapshot.debian.org). Here is a custom installer that works for FIle:
File:
Hopefully they'll upgrade boxes to run a kernel which is available from the repository, and this can be useful when we need to run an older box. |
Thanks a lot @djomlastic, you probably just saved my week :-) |
@fnordfish can you comment if a native fix is planned? |
@checkphi sorry to say, but I totally really on pull requests for fixing OS support stuff. |
Problem seems to also affect CentOS 7 as well, just to chime in. |
Which version of CentOS? As for Debian, I've been trying something like this:
On buster (Debian 10) the modules build sucessfully but don't load after reboot with errors like On stretch (Debian 9) the process hangs while getting packages from the repo. One thing that's bugging me is what changed? Is the removal of old packages from the repos a new thing? Last time I've checked, I could I'm using VirtualBox 6.0.12, can't remember what version I was using the last time I launched VMs with these OSes. |
@carlosefr bento/centos-7 v201907.24.0 $ vagrant init bento/centos-7
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
$ vagrant plugin install vagrant-vbguest
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Fetching: micromachine-3.0.0.gem (100%)
Fetching: vagrant-vbguest-0.20.0.gem (100%)
Installed the plugin 'vagrant-vbguest (0.20.0)'!
$ export VAGRANT_DEFAULT_PROVIDER=virtualbox
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'bento/centos-7'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'bento/centos-7' version '201907.24.0' is up to date...
==> default: Setting the name of the VM: 7_default_1570759763507_25565
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2200 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2200
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection reset. Retrying...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
[default] GuestAdditions versions on your host (6.0.12) and guest (6.0.10) do not match.
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.iij.ad.jp
* extras: ftp.iij.ad.jp
* updates: ftp.iij.ad.jp
No package kernel-devel-3.10.0-957.21.3.el7.x86_64 available.
Package 4:perl-5.16.3-294.el7_6.x86_64 already installed and latest version
Package bzip2-1.0.6-13.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package binutils.x86_64 0:2.27-34.base.el7 will be updated
---> Package binutils.x86_64 0:2.27-41.base.el7 will be an update
---> Package gcc.x86_64 0:4.8.5-39.el7 will be installed
--> Processing Dependency: libgomp = 4.8.5-39.el7 for package: gcc-4.8.5-39.el7.x86_64
--> Processing Dependency: cpp = 4.8.5-39.el7 for package: gcc-4.8.5-39.el7.x86_64
--> Processing Dependency: libgcc >= 4.8.5-39.el7 for package: gcc-4.8.5-39.el7.x86_64
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.8.5-39.el7.x86_64
---> Package kernel-devel.x86_64 0:3.10.0-1062.1.2.el7 will be installed
---> Package make.x86_64 1:3.82-23.el7 will be updated
---> Package make.x86_64 1:3.82-24.el7 will be an update
--> Running transaction check
---> Package cpp.x86_64 0:4.8.5-39.el7 will be installed
---> Package glibc-devel.x86_64 0:2.17-292.el7 will be installed
--> Processing Dependency: glibc-headers = 2.17-292.el7 for package: glibc-devel-2.17-292.el7.x86_64
--> Processing Dependency: glibc = 2.17-292.el7 for package: glibc-devel-2.17-292.el7.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.17-292.el7.x86_64
---> Package libgcc.x86_64 0:4.8.5-36.el7_6.2 will be updated
---> Package libgcc.x86_64 0:4.8.5-39.el7 will be an update
---> Package libgomp.x86_64 0:4.8.5-36.el7_6.2 will be updated
---> Package libgomp.x86_64 0:4.8.5-39.el7 will be an update
--> Running transaction check
---> Package glibc.x86_64 0:2.17-260.el7_6.6 will be updated
--> Processing Dependency: glibc = 2.17-260.el7_6.6 for package: glibc-common-2.17-260.el7_6.6.x86_64
---> Package glibc.x86_64 0:2.17-292.el7 will be an update
---> Package glibc-headers.x86_64 0:2.17-292.el7 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.17-292.el7.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.17-292.el7.x86_64
--> Running transaction check
---> Package glibc-common.x86_64 0:2.17-260.el7_6.6 will be updated
---> Package glibc-common.x86_64 0:2.17-292.el7 will be an update
---> Package kernel-headers.x86_64 0:3.10.0-1062.1.2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
gcc x86_64 4.8.5-39.el7 base 16 M
kernel-devel x86_64 3.10.0-1062.1.2.el7 updates 18 M
Updating:
binutils x86_64 2.27-41.base.el7 base 5.9 M
make x86_64 1:3.82-24.el7 base 421 k
Installing for dependencies:
cpp x86_64 4.8.5-39.el7 base 5.9 M
glibc-devel x86_64 2.17-292.el7 base 1.1 M
glibc-headers x86_64 2.17-292.el7 base 687 k
kernel-headers x86_64 3.10.0-1062.1.2.el7 updates 8.7 M
Updating for dependencies:
glibc x86_64 2.17-292.el7 base 3.6 M
glibc-common x86_64 2.17-292.el7 base 11 M
libgcc x86_64 4.8.5-39.el7 base 102 k
libgomp x86_64 4.8.5-39.el7 base 158 k
Transaction Summary
================================================================================
Install 2 Packages (+4 Dependent packages)
Upgrade 2 Packages (+4 Dependent packages)
Total download size: 72 M
Downloading packages:
No Presto metadata available for base
No Presto metadata available for updates
--------------------------------------------------------------------------------
Total 6.2 MB/s | 72 MB 00:11
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : libgcc-4.8.5-39.el7.x86_64 1/18
Updating : glibc-common-2.17-292.el7.x86_64 2/18
Updating : glibc-2.17-292.el7.x86_64 3/18
warning: /etc/nsswitch.conf created as /etc/nsswitch.conf.rpmnew
Installing : cpp-4.8.5-39.el7.x86_64 4/18
Updating : binutils-2.27-41.base.el7.x86_64 5/18
Updating : libgomp-4.8.5-39.el7.x86_64 6/18
Installing : kernel-headers-3.10.0-1062.1.2.el7.x86_64 7/18
Installing : glibc-headers-2.17-292.el7.x86_64 8/18
Installing : glibc-devel-2.17-292.el7.x86_64 9/18
Installing : gcc-4.8.5-39.el7.x86_64 10/18
Updating : 1:make-3.82-24.el7.x86_64 11/18
Installing : kernel-devel-3.10.0-1062.1.2.el7.x86_64 12/18
Cleanup : 1:make-3.82-23.el7.x86_64 13/18
Cleanup : libgomp-4.8.5-36.el7_6.2.x86_64 14/18
Cleanup : binutils-2.27-34.base.el7.x86_64 15/18
Cleanup : glibc-common-2.17-260.el7_6.6.x86_64 16/18
Cleanup : glibc-2.17-260.el7_6.6.x86_64 17/18
Cleanup : libgcc-4.8.5-36.el7_6.2.x86_64 18/18
Verifying : glibc-devel-2.17-292.el7.x86_64 1/18
Verifying : glibc-2.17-292.el7.x86_64 2/18
Verifying : kernel-headers-3.10.0-1062.1.2.el7.x86_64 3/18
Verifying : cpp-4.8.5-39.el7.x86_64 4/18
Verifying : binutils-2.27-41.base.el7.x86_64 5/18
Verifying : kernel-devel-3.10.0-1062.1.2.el7.x86_64 6/18
Verifying : libgomp-4.8.5-39.el7.x86_64 7/18
Verifying : 1:make-3.82-24.el7.x86_64 8/18
Verifying : gcc-4.8.5-39.el7.x86_64 9/18
Verifying : glibc-common-2.17-292.el7.x86_64 10/18
Verifying : libgcc-4.8.5-39.el7.x86_64 11/18
Verifying : glibc-headers-2.17-292.el7.x86_64 12/18
Verifying : libgomp-4.8.5-36.el7_6.2.x86_64 13/18
Verifying : libgcc-4.8.5-36.el7_6.2.x86_64 14/18
Verifying : glibc-2.17-260.el7_6.6.x86_64 15/18
Verifying : 1:make-3.82-23.el7.x86_64 16/18
Verifying : glibc-common-2.17-260.el7_6.6.x86_64 17/18
Verifying : binutils-2.27-34.base.el7.x86_64 18/18
Installed:
gcc.x86_64 0:4.8.5-39.el7 kernel-devel.x86_64 0:3.10.0-1062.1.2.el7
Dependency Installed:
cpp.x86_64 0:4.8.5-39.el7
glibc-devel.x86_64 0:2.17-292.el7
glibc-headers.x86_64 0:2.17-292.el7
kernel-headers.x86_64 0:3.10.0-1062.1.2.el7
Updated:
binutils.x86_64 0:2.27-41.base.el7 make.x86_64 1:3.82-24.el7
Dependency Updated:
glibc.x86_64 0:2.17-292.el7 glibc-common.x86_64 0:2.17-292.el7
libgcc.x86_64 0:4.8.5-39.el7 libgomp.x86_64 0:4.8.5-39.el7
Complete!
Copy iso file /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
Mounting Virtualbox Guest Additions ISO to: /mnt
mount: /dev/loop0 is write-protected, mounting read-only
Installing Virtualbox Guest Additions 6.0.12 - guest version is 6.0.10
Verifying archive integrity... All good.
Uncompressing VirtualBox 6.0.12 Guest Additions for Linux........
VirtualBox Guest Additions installer
Removing installed version 6.0.10 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
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: Kernel headers not found for target kernel
3.10.0-957.21.3.el7.x86_64. Please install them and execute
/sbin/rcvboxadd setup
VirtualBox Guest Additions: Running kernel modules will not be replaced until
the system is restarted
An error occurred during installation of VirtualBox Guest Additions 6.0.12. Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
Redirecting to /bin/systemctl start vboxadd.service
Redirecting to /bin/systemctl start vboxadd-service.service
Unmounting Virtualbox Guest Additions ISO from: /mnt
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims: 6.0.10
VBoxService inside the vm claims: 6.0.12
Going on, assuming VBoxService is correct...
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims: 6.0.10
VBoxService inside the vm claims: 6.0.12
Going on, assuming VBoxService is correct...
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims: 6.0.10
VBoxService inside the vm claims: 6.0.12
Going on, assuming VBoxService is correct...
Restarting VM to apply changes...
==> default: Attempting graceful shutdown of VM...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: No guest additions were detected on the base box for this VM! Guest
default: additions are required for forwarded ports, shared folders, host only
default: networking, and more. If SSH fails on this machine, please install
default: the guest additions and repackage the box to continue.
default:
default: This is not an error message; everything may continue to work properly,
default: in which case you may ignore this message.
==> default: Mounting shared folders...
default: /vagrant => /Users/andrew.miller/Development/tests/centos/7
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=1000,gid=1000 vagrant /vagrant
The error output from the command was:
/sbin/mount.vboxsf: mounting failed with the error: No such device
|
my understanding is that the fact that it works is purely circumstantial and is due to the fact that there are no kernel updates necessary in the new box; and that the problem will reappear once kernel updates are available. Or am I mistaken? |
@eroux This is my understanding too. The most useful workaround is the way of @shrimpwagon . |
Drawing heavily from #351 (comment) and the follow-up comment from @fnordfish got me to this solution, which seems to do the job for my local boxes:
|
why closing the issue? |
Well, It's still happening to me for a |
@HubertSadecki Please reopen the issue. |
I have the same problem with debian/jessie64. |
I had the same problem under Arch Linux.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@fnordfish Can you please reopen this issue and label it so that it doesn't get automatically closed? |
I tried this solution, but still not able to silence the $vbguest_install = <<~HEREDOC_VBGUEST
apt-get -y --force-yes update
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential linux-headers-amd64 linux-image-amd64 dkms
HEREDOC_VBGUEST
if opts[:vbguest] == true
# VAGRANT_EXPERIMENTAL="typed_triggers" env var should be present!
node.trigger.before :"VagrantPlugins::ProviderVirtualBox::Action::CheckGuestAdditions", type: :action do |trigger|
trigger.info = "Trigger run before vagrant-vbguest install!"
trigger.run_remote = {inline: $vbguest_install}
node.vm.provision :reload
end
else
node.vbguest.auto_update = false
end I tried to use vagrant-reload plugin, but the provision reload didn't triggered after installing I also want to ask is there any action to target vagrant-vbguest? So far I tried the following ones without luck: VagrantVbguest::Installers::Debian
VagrantVbguest::Installers::Linux
vbguest Only targeting If anyone have some tips how to solve this issue using Vagrant triggers without writing custom classes, I'm all open. @fnordfish This issue needs to be reopen because this effecting current dev environments which targeting legacy OS (like Stretch) in production. The currently hardcoded |
Yall..... my solution up top works best so far: #issuecomment-545391139 |
Observing issue with Windows 10 1909 and config.vm.box = "hashicorp/bionic64" |
This also appears to be an issue with the CentOS 8 boxes I used from here: http://cloud.centos.org/centos/8/x86_64/images/CentOS-8-Vagrant-8.2.2004-20200611.2.x86_64.vagrant-virtualbox.box
I was able to resolve by:
|
For CentOS 8, please see: https://github.com/dotless-de/vagrant-vbguest#installer-specific-options-installer_options Especially: That fixed my problem by installing the latest kernel and performing a reboot of the Vagrant VM before continuing the provisioning. |
For Ubuntu, it is |
This works for Ubuntu Focal (20.04) as well |
Environment:
Using latest debian stretch (9.9.1) vagrant box:
And latest vagrant-vbguest:
When running
vagrant up
orvagrant vbguest
I got following error:The text was updated successfully, but these errors were encountered: