dotless-de / vagrant-vbguest

A Vagrant plugin to keep your VirtualBox Guest Additions up to date
MIT License
2.88k stars 206 forks source link

Installation/Update of Virtualbox Guest Additions fails #351

Closed HubertSadecki closed 9 months ago

HubertSadecki commented 5 years ago

Environment:

Windows: 10 ver. 1803
Virtualbox version: 6.0.12r133076 # The same error occured for Virtualbox 5.2.26
Vagrant version: Vagrant 2.2.4

Using latest debian stretch (9.9.1) vagrant box:

  config.vm.box = "debian/stretch64"

And latest vagrant-vbguest:

vagrant-vbguest (0.19.0, global)

When running vagrant up or vagrant vbguest I got following error:

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

apt-get install -y linux-headers-`uname -r` dkms

Stdout from the command:

Reading package lists...
Building dependency tree...
Reading state information...

Stderr from the command:

E: Unable to locate package linux-headers-4.9.0-9-amd64
E: Couldn't find any package by glob 'linux-headers-4.9.0-9-amd64'
E: Couldn't find any package by regex 'linux-headers-4.9.0-9-amd6
ecom-db commented 5 years ago

We are having the same issue, similar setup as above but with box "debian/jessie64"

From vagrant up:


[default] No Virtualbox Guest Additions installation found.
...
0 upgraded, 32 newly installed, 0 to remove and 0 not upgraded.
...
Err http://security.debian.org/ jessie/updates/main linux-libc-dev amd64 3.16.68-1
  404  Not Found [IP: 151.101.36.204 80]
Err http://security.debian.org/ jessie/updates/main linux-compiler-gcc-4.9-x86 amd64 3.16.68-1
  404  Not Found [IP: 151.101.36.204 80]
Err http://security.debian.org/ jessie/updates/main linux-headers-3.16.0-9-common amd64 3.16.68-1
  404  Not Found [IP: 151.101.36.204 80]
Err http://security.debian.org/ jessie/updates/main linux-headers-3.16.0-9-amd64 amd64 3.16.68-1
  404  Not Found [IP: 151.101.36.204 80]
Err http://security.debian.org/ jessie/updates/main linux-headers-amd64 amd64 3.16+63+deb8u5
  404  Not Found [IP: 151.101.36.204 80]
Fetched 22.9 MB in 8s (2,756 kB/s)
E: Failed to fetch http://security.debian.org/pool/updates/main/l/linux/linux-libc-dev_3.16.68-1_amd64.deb  404  Not Found [IP: 151.101.36.204 80]
E: Failed to fetch http://security.debian.org/pool/updates/main/l/linux/linux-compiler-gcc-4.9-x86_3.16.68-1_amd64.deb  404  Not Found 
[IP: 151.101.36.204 80]
E: Failed to fetch http://security.debian.org/pool/updates/main/l/linux/linux-headers-3.16.0-9-common_3.16.68-1_amd64.deb  404  Not Found [IP: 151.101.36.204 80]
E: Failed to fetch http://security.debian.org/pool/updates/main/l/linux/linux-headers-3.16.0-9-amd64_3.16.68-1_amd64.deb  404  Not Found [IP: 151.101.36.204 80]
E: Failed to fetch http://security.debian.org/pool/updates/main/l/linux-latest/linux-headers-amd64_3.16+63+deb8u5_amd64.deb  404  Not Found [IP: 151.101.36.204 80]
...
E: Unable to locate package linux-headers-3.16.0-9-amd64
E: Couldn't find any package by regex 'linux-headers-3.16.0-9-amd64'
...
checkphi commented 5 years ago

Having the same issue. I think vbguest should perform "apt-get update" before running install.

checkphi commented 5 years ago

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.

ghost commented 5 years ago

For me a solution similar to the apt update (that can be turned off from config) would be just perfect. At the moment we cannot automate our pipline due to this limitation. Is there any "automatic" workaround? Ex perform some "provision" steps before executing the plugin or customizing and addng custom script to the plugin through the Vagrant config file ?

Mephistokrates commented 5 years ago

As a workaround I created a provisioning step for a dist-upgrade on my debian pipeline while disabling the plugin in that step. This at least keeps the chain working further up.

HubertSadecki commented 5 years ago

As a workaround you can disable auto update in Vagrantfile.

config.vbguest.auto_update = false

It won't raise error on provision and won't install Virtualbox Guest Additions as well.

FunTimeCoding commented 5 years ago

@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.

ghost commented 5 years ago

This is how far I got:

# -*- mode: ruby -*-
# vi: set ft=ruby :

unless Vagrant.has_plugin?("vagrant-vbguest")
  puts 'Installing vagrant-vbguest Plugin...'
  system('vagrant plugin install vagrant-vbguest')
end

Vagrant.configure("2") do |config|

  config.vm.box = "debian/buster64"

  class WorkaroundVbguest < VagrantVbguest::Installers::Linux
    def install(opts=nil, &block)
      puts 'Executing update workaround...'
      communicate.sudo('apt-get -y --force-yes update', (opts || {}).merge(:error_check => false), &block)
      communicate.sudo('apt-get -y --force-yes upgrade', (opts || {}).merge(:error_check => false), &block)
          communicate.sudo('apt-get -y install build-essential', (opts || {}).merge(:error_check => false), &block)=> false), &block)
      puts 'Continue vbguest installation...'
      super
         puts 'Perform vbguest post installation steps...'
      communicate.sudo('usermod -a -G vboxsf vagrant', (opts || {}).merge(:error_check => false), &block)
    end
  end

  config.vbguest.installer = WorkaroundVbguest

  config.vm.synced_folder "../image", "/image"
end

But synced folder mount still fails fir the first vagrant up. (But executing the command again mounts the folders and so it seems as a reboot is missing from somewhere)

default: /image => D:/work/tank/cross_compile/image
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 image /image

The error output from the command was:

/sbin/mount.vboxsf: mounting failed with the error: No such device

Also there is an interesting part during guest install that might be related:

Setting up build-essential (12.6) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.28-10) ...
Continue vbguest installation...
Copy iso file C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
Mounting Virtualbox Guest Additions ISO to: /mnt
mount: /mnt: WARNING: device write-protected, mounted read-only.
Installing Virtualbox Guest Additions 6.0.12 - guest version is 5.2.0
Verifying archive integrity... All good.
Uncompressing VirtualBox 6.0.12 Guest Additions for Linux........
VirtualBox Guest Additions installer
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
4.19.0-5-amd64. 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.
Unmounting Virtualbox Guest Additions ISO from: /mnt

Any suggestion?

Flo2345 commented 5 years ago

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.

Flo2345 commented 5 years ago

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: Why do previous versions of debian packages vanish in the package repositories? Failed to update linux headers on debian stretch

wachjose88 commented 5 years ago

I can confirm this problem with a "debian/contrib-buster64" box in this environment:

Virtualbox 6.0.12,
Vagrant 2.2.5,
vagrant-vbguest 0.20.0,

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 apt-get install -y linux-headers-`uname -r` dkms. This fails because the headers for the old running kernel are no longer in the repositories. Using apt-get install -y linux-headers-`dpkg --print-architecture` dkms is no solution because the kernel is not updated through this package.

gzp79 commented 5 years ago

Case solved for me: As the virtual env is used for cross compile, and actually all major distros have the required toolset I could easily switch to ubuntu (where it is working for some reason). Debian is only the target for the cross compile which is just fine. In other words the host and cross compile target don't have to be the same and it solve the issue for me. (Though it'd be grate if vbguest can work out of the box for debian too)

checkphi commented 5 years ago

@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 ? :)

wachjose88 commented 5 years ago

@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.

fnordfish commented 5 years ago

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 notifications@github.commailto:notifications@github.com Reply: dotless-de/vagrant-vbguest reply@reply.github.commailto:reply@reply.github.com Date: 1. October 2019 at 09:41:08 To: dotless-de/vagrant-vbguest vagrant-vbguest@noreply.github.commailto:vagrant-vbguest@noreply.github.com CC: Robert Schulze robert@dotless.demailto:robert@dotless.de, Mention mention@noreply.github.commailto:mention@noreply.github.com Subject: Re: [dotless-de/vagrant-vbguest] Installation/Update of Virtualbox Guest Additions fails (#351)

@checkphihttps://github.com/checkphi yes, your recommendation for a solution seems to be the most useful variant. The aproach, shown by @zpgaalhttps://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 GitHubhttps://github.com/dotless-de/vagrant-vbguest/issues/351?email_source=notifications&email_token=AAADEJ3TX7ZAAZXB5F56CYLQML5JJA5CNFSM4I2MX76KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAAJ5VQ#issuecomment-536911574, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAADEJYEKGRBSKFVA3PA5YDQML5JJANCNFSM4I2MX76A.

checkphi commented 5 years ago

@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.

wachjose88 commented 5 years ago

@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.

shrimpwagon commented 5 years ago

I've confirmed the error with debian/buster64 as well.

moduspwnens commented 5 years ago

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 linux-headers-$(uname -r) to the debian preseed config file as a d-i pkgsel/include value. My understanding is this results in the appropriate Linux headers package being installed during that initial setup and pulled from the ISO media, so they're then already installed when vagrant-vbguest goes to install / upgrade the guest additions.

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.

shrimpwagon commented 5 years ago

@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!

moduspwnens commented 5 years ago

@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. config.vm.box = "debian/stretch64").

If you're building them from the ISOs, your work will look more like this example here: https://github.com/geerlingguy/packer-debian-9

In that repo, you'll find a http/preseed.cfg file and a line starting with d-i pkgsel/include. You'd want to add linux-headers-$(uname -r) to that line.

But switching to building your own Debian vagrant boxes (if you're not already doing that) just to workaround this issue is likely overkill.

djomlastic commented 5 years ago

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 debian/stretch64 v9.9.1 box, and will work for debian/buster64 v9.99.2 if you uncomment the command. I tried it with debian/buster64 v10.0.0, the headers are there, but it doesn't mount shared folders: Vagrant was unable to mount VirtualBox shared folders (tested with virtualbox 5.2.32 and 5.2.18). I don't use a buster box, so it might be some problem on my side, if you had a working one you can give it a try.

FIle: ./utility/vbg-installer.rb

module Utility

    # Custom Debian installer for Vbguest
    class DebianCustom < VagrantVbguest::Installers::Debian

        # Adds snapshot archive repo to sources
        def install(opts=nil, &block)

            cmd = <<~SCRIPT
                cat <<EOF > /etc/apt/sources.list.d/snapshot_archive.list
                deb [check-valid-until=no] http://snapshot.debian.org/archive/debian/20190801T025637Z/ stretch main
                deb [check-valid-until=no] http://snapshot.debian.org/archive/debian-security/20190801T025637Z/ stretch/updates main
                EOF
            SCRIPT

            # Uncomment if running a Buster box
            # cmd = <<~SCRIPT
            #     cat <<EOF > /etc/apt/sources.list.d/snapshot_archive.list
            #     deb [check-valid-until=no] http://snapshot.debian.org/archive/debian/20190812T140702Z/ buster main
            #     deb [check-valid-until=no] http://snapshot.debian.org/archive/debian-security/20190812T140702Z/ buster/updates main
            #     EOF
            # SCRIPT

            communicate.sudo(cmd, opts, &block)

            super
        end

        def cleanup
            # Uncomment to remove the snapshot archive repo from sources
            # communicate.sudo('rm /etc/apt/sources.list.d/snapshot_archive.list')

            super
        end
    end
end

File: ./Vagrantfile

...
# Vagrant configuration
Vagrant.configure('2') do |config|

    # Load custom vbguest installer
    if defined?(VagrantVbguest::Installers::Debian)

        require_relative 'utility/vbg-installer'
        config.vbguest.installer = Utility::DebianCustom
    end
...

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.

hsarbia commented 4 years ago

Thanks a lot @djomlastic, you probably just saved my week :-)

checkphi commented 4 years ago

@fnordfish can you comment if a native fix is planned? I know I'm asking every week, but I love your plugin and want to continue using it...

fnordfish commented 4 years ago

@checkphi sorry to say, but I totally really on pull requests for fixing OS support stuff. I might plan to rebuild how the entire install/restart/rebuild step (aka run list) are build, giving more control to integrations. But I cannot give any time frame on this.

ikari7789 commented 4 years ago

Problem seems to also affect CentOS 7 as well, just to chime in.

carlosefr commented 4 years ago

Which version of CentOS?

As for Debian, I've been trying something like this:

begin
    class FixGuestAdditions < VagrantVbguest::Installers::Debian
        def install(opts=nil, &block)
            # If the "linux-headers" package matching the running kernel can't be found in the default
            # repositories, then we will look for it in the archives at the time the kernel was current...
            communicate.sudo("SNAPSHOT=$(stat -c %Y /lib/modules/$(uname -r) | xargs -I{} date -d @{} -u +'%Y%m%dT%H%M%SZ') &&" \
                             "RELEASE=$(lsb_release -s -c) &&" \
                             "REPOSITORY=https://snapshot.debian.org/archive &&" \
                             "printf \"deb\t${REPOSITORY}/debian/${SNAPSHOT}/ ${RELEASE} main\n" \
                                      "deb\t${REPOSITORY}/debian-security/${SNAPSHOT}/ ${RELEASE}/updates main\n\"" \
                                      "> /etc/apt/sources.list.d/snapshot.list &&" \
                             "printf 'Package: linux-headers linux-headers-$(dpkg --print-architecture)\n" \
                                     "Pin: origin \"snapshot.debian.org\"\n" \
                                     "Pin-Priority: 1001\n'" \
                                     "> /etc/apt/preferences.d/snapshot")
            super
        end

        def cleanup
            communicate.sudo("rm -f /etc/apt/sources.list.d/snapshot.list /etc/apt/preferences.d/snapshot")
            super
        end
    end

    # Anything with priority over 5 overrides the default installer...
    VagrantVbguest::Installer.register(FixGuestAdditions, 100)
rescue NameError
    # The "VagrantVbguest" class won't be available during the first pass,
    # when vagrant is checking for required plugins and stuff like that...
end

On buster (Debian 10) the modules build sucessfully but don't load after reboot with errors like x86/modules: Skipping invalid relocation target (seems related to the kernel being signed or something).

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 vagrant up stretch and buster VMs just fine without these shenanigans and I'm using the same debian/buster64 from 3 months ago and debian/stretch64 is even older at 4 months.

I'm using VirtualBox 6.0.12, can't remember what version I was using the last time I launched VMs with these OSes.

ikari7789 commented 4 years ago

@carlosefr bento/centos-7 v201907.24.0 It cannot find the kernel-devel package in the update and installs a newer version of the kernel-headers and then fails to install, but still reboots.

$ 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
carlosefr commented 4 years ago

@ikari7789 That's because CentOS 7.7 is out, but you're using a CentOS 7.6 base image. See if this works for you: https://github.com/carlosefr/vagrant-templates/blob/master/vm-centos/Vagrantfile#L33

neikei commented 4 years ago

Unfortunately this error is still reproducible with the new version vagrant-vbguest 0.20.0.

Tested with new vagrant-vbguest version:

vagrant-vbguest (0.20.0, global)

Used the same Debian box:

==> default: Box 'debian/stretch64' (v9.9.1) is running the latest version.

Got the following error:

apt-get install -y linux-headers-uname -r dkms

Stdout from the command:

Reading package lists... Building dependency tree... Reading state information...

Stderr from the command:

E: Unable to locate package linux-headers-4.9.0-9-amd64 E: Couldn't find any package by glob 'linux-headers-4.9.0-9-amd64' E: Couldn't find any package by regex 'linux-headers-4.9.0-9-amd64'

Any idea to prevent this issue in this plugin? I really like this plugin and don't think a disable of auto update makes sense.

antoinetran commented 4 years ago

I have the same issue with CentOs 7.6 basebox here. Our goal is to create a base image, from 7.6, using versionned Yum repositories, to update to 7.7. That kind of script is done by overriding VagrantVbguest::Installers::CentOS. But the issue is after updating from 7.6 to 7.7, we cannot reboot without breaking Vagrant. So we let it do the work for old kernel kernel-devel x86_64 3.10.0-957.12.2.el7 C7.6.1810-updates 17 M

The fact that a more recent kernel-devel is installed before does not change this behavior.

So we update to 7.7, Vagrant installs an older kernel and compile Guest Additions, everything works. Then I do vagrant reload and Vagrant uninstall old Guest Additions and recompile with the new kernel. But I have this error:

Building the main Guest Additions module for kernel 3.10.0-1062.1.1.el7.x86_64.
Building the shared folder support module.
Building the graphics driver module.
Error building the module.  Build output follows.
make V=1 CONFIG_MODULE_SIG= -C /lib/modules/3.10.0-1062.1.1.el7.x86_64/build SUBDIRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j4 modules
make[1]: warning: -jN forced in submake: disabling jobserver mode.
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (                \
echo >&2;                                                       \
echo >&2 "  ERROR: Kernel configuration is invalid.";           \
echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it.";      \
echo >&2 ;                                                      \
/bin/false)
mkdir -p /tmp/vbox.0/.tmp_versions ; rm -f /tmp/vbox.0/.tmp_versions/*
make -f scripts/Makefile.build obj=/tmp/vbox.0
  gcc -Wp,-MD,/tmp/vbox.0/.hgsmi_base.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include -I./arch/x86/include -Iarch/x86/include/generated  -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -std=gnu89 -O2 -m64 -mno-mmx -mno-sse -mpreferred-stack-boundary=3 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -Wframe-larger-than=2048 -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mindirect-branch=thunk-extern -mindirect-branch-register -DRETPOLINE -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -pg -mfentry -DCC_USING_FENTRY -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -I/lib/modules/3.10.0-1062.1.1.el7.x86_64/build/include -I/tmp/vbox.0 -Iinclude/drm -D__KERNEL__ -DMODULE  -DMODULE  -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(hgsmi_base)"  -D"KBUILD_MODNAME=KBUILD_STR(vboxvideo)" -c -o /tmp/vbox.0/.tmp_hgsmi_base.o /tmp/vbox.0/hgsmi_base.c
  gcc -Wp,-MD,/tmp/vbox.0/.modesetting.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include -I./arch/x86/include -Iarch/x86/include/generated  -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -std=gnu89 -O2 -m64 -mno-mmx -mno-sse -mpreferred-stack-boundary=3 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -Wframe-larger-than=2048 -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mindirect-branch=thunk-extern -mindirect-branch-register -DRETPOLINE -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -pg -mfentry -DCC_USING_FENTRY -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -I/lib/modules/3.10.0-1062.1.1.el7.x86_64/build/include -I/tmp/vbox.0 -Iinclude/drm -D__KERNEL__ -DMODULE  -DMODULE  -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(modesetting)"  -D"KBUILD_MODNAME=KBUILD_STR(vboxvideo)" -c -o /tmp/vbox.0/.tmp_modesetting.o /tmp/vbox.0/modesetting.c
  gcc -Wp,-MD,/tmp/vbox.0/.vbox_drv.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include -I./arch/x86/include -Iarch/x86/include/generated  -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -std=gnu89 -O2 -m64 -mno-mmx -mno-sse -mpreferred-stack-boundary=3 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -Wframe-larger-than=2048 -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mindirect-branch=thunk-extern -mindirect-branch-register -DRETPOLINE -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -pg -mfentry -DCC_USING_FENTRY -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -I/lib/modules/3.10.0-1062.1.1.el7.x86_64/build/include -I/tmp/vbox.0 -Iinclude/drm -D__KERNEL__ -DMODULE  -DMODULE  -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(vbox_drv)"  -D"KBUILD_MODNAME=KBUILD_STR(vboxvideo)" -c -o /tmp/vbox.0/.tmp_vbox_drv.o /tmp/vbox.0/vbox_drv.c
  gcc -Wp,-MD,/tmp/vbox.0/.vbox_fb.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include -I./arch/x86/include -Iarch/x86/include/generated  -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -std=gnu89 -O2 -m64 -mno-mmx -mno-sse -mpreferred-stack-boundary=3 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -Wframe-larger-than=2048 -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mindirect-branch=thunk-extern -mindirect-branch-register -DRETPOLINE -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -pg -mfentry -DCC_USING_FENTRY -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -I/lib/modules/3.10.0-1062.1.1.el7.x86_64/build/include -I/tmp/vbox.0 -Iinclude/drm -D__KERNEL__ -DMODULE  -DMODULE  -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(vbox_fb)"  -D"KBUILD_MODNAME=KBUILD_STR(vboxvideo)" -c -o /tmp/vbox.0/.tmp_vbox_fb.o /tmp/vbox.0/vbox_fb.c
In file included from /tmp/vbox.0/vboxvideo_guest.h:32:0,
                 from /tmp/vbox.0/modesetting.c:27:
/tmp/vbox.0/vbox_drv.h:169:31: error: field ‘mem_global_ref’ has incomplete type
   struct drm_global_reference mem_global_ref;^M
                               ^
/tmp/vbox.0/vbox_drv.h:170:28: error: field ‘bo_global_ref’ has incomplete type
   struct ttm_bo_global_ref bo_global_ref;^M
                            ^

My plugin list:

$ vagrant plugin list
vagrant-proxyconf (2.0.6, global)
  - Version Constraint: > 0
vagrant-reload (0.0.1, global)
vagrant-vbguest (0.20.0, global)
  - Version Constraint: > 0
vagrant-vbguest-centos (0.2.0, global)
  - Version Constraint: > 0

So we need to be able to update before Guest Additions installs (we can do that see below), and reboot before it installs too (breaks Vagrant).

if Vagrant.has_plugin?('vagrant-vbguest')
  #class GuestAdditionsFixer < VagrantVbguest::Installers::Linux
  # https://github.com/dotless-de/vagrant-vbguest/blob/v0.18.0/lib/vagrant-vbguest/installers/centos.rb
  class GuestAdditionsFixer < VagrantVbguest::Installers::CentOS
    def install(opts=nil, &block)
      # https://www.rubydoc.info/github/mitchellh/vagrant/Vagrant/Plugin/V2/Communicator#upload-instance_method
      communicate.upload("install-prerequisites.sh", "/tmp/install-prerequisites.sh")
      communicate.sudo("sh -x /tmp/install-prerequisites.sh 2>&1 | tee /tmp/vagrant-vbguest.log")
      super
    end
  end
end
wachjose88 commented 4 years ago

I am working on an installer for Debian boxes which updates the box before installing the guest additions. However I have a problem with the required reboot after updating. Does anybody have an idea how I can initiate a reboot in an installer?

jhuebner79 commented 4 years ago

[...]Here is a custom installer that works for debian/stretch64 v9.9.1 box, and will work for debian/buster64 v9.99.2 if you uncomment the command. [...]

Can confirm this working on debian/stretch64 v9.8.0 as well. Thanks for providing this workaround!

JenCant commented 4 years ago

Confirm @djomlastic fix worked on a fresh debian/stretch64 9.9.1 with Win10 host. Thank you so much.

https://github.com/dotless-de/vagrant-vbguest/issues/351#issuecomment-538096696

jstnbr commented 4 years ago

This happened to me when doing vagrant up on a base Debian Buster box. I wanted to install some things on the box, and then output it.

What worked for me was adding config.vbguest.auto_update = false to the Vagrantfile of the base box (as mentioned above, so it does not auto-update with the wrong headers). Then once the base box is up I run apt-get dist-upgrade -q -y inside the VM (this will update the right headers).

I first tried this with apt-get upgrade with no luck — but apt-get dist-upgrade did work for me.

Thanks all for the helpful comments here!

ghost commented 4 years ago

I think this should be reported upstream: https://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=cloud.debian.org;dist=unstable

oORustyOo commented 4 years ago

I had success with this box box-image https://app.vagrantup.com/c33s/boxes/debian-10-buster-x64

Vagrant.configure("2") do |config| config.vm.box = "c33s/debian-10-buster-x64" config.vm.box_version = "1.0.0" end

Maybe it will help.

shrimpwagon commented 4 years ago

For Linux... maybe Mac... if you use an install script this works really well and I'm having perfect success. Seems to be the easiest and simplest workaround for now:

install.sh

export FIRST_RUN='true'
vagrant up --no-provision
vagrant ssh -c 'sudo apt-get update'
vagrant ssh -c 'sudo apt-get upgrade'
vagrant ssh -c 'sudo apt-get install -y build-essential linux-headers-amd64 linux-image-amd64 python-pip'
vagrant halt
export FIRST_RUN='false'
vagrant up

Vagrant

Vagrant.configure("2") do |config|

  if ENV['FIRST_RUN'] == 'true'
    config.vbguest.auto_update = false
    config.vm.synced_folder ".", "/vagrant", disabled: true
  else
    config.vm.synced_folder ".", "/vagrant", create: true, type: "virtualbox"
    config.vm.synced_folder "./www", "/var/www", create: true, type: "virtualbox", owner: "www-data", group: "www-data"
  end
end

On first run it will not try to update, sync folders and provision. Only after the updates and shutting it back down will it do its normal run.

sandorspruit commented 4 years ago

I have successfully used @shrimpwagon 's solution on Mac, too. Nice work.

coderovich commented 4 years ago

@oORustyOo it works :) is it safe to use noname box-image?

Franz333 commented 4 years ago

Had the same issue, installing from this https://app.vagrantup.com/digital-port/boxes/debian-stretch64/versions/1.0.0 sorted it out

poluditsny commented 4 years ago

There was an update of "debian/stretch64" and it's working again.

llsousa commented 4 years ago

I can also confirm that the use of the plugin vagrant-vbguest is working again with the box debian/stretch64.

@HubertSadecki , can you please close this issue?

eroux commented 4 years ago

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?

wachjose88 commented 4 years ago

@eroux This is my understanding too. The most useful workaround is the way of @shrimpwagon .

alxbridge commented 4 years ago

Drawing heavily from https://github.com/dotless-de/vagrant-vbguest/issues/351#issuecomment-536282015 and the follow-up comment from @fnordfish got me to this solution, which seems to do the job for my local boxes:

  # Workaround to prevent missing linux headers making new installs fail.
  # Put into Vagrantfile directly under your `config.vm.box` definition

  class WorkaroundVbguest < VagrantVbguest::Installers::Linux
    def install(opts=nil, &block)
          puts 'Ensuring we\'ve got the correct build environment for vbguest...'
          communicate.sudo('apt-get -y --force-yes update', (opts || {}).merge(:error_check => false), &block)
          communicate.sudo('apt-get -y --force-yes install -y build-essential linux-headers-amd64 linux-image-amd64', (opts || {}).merge(:error_check => false), &block)
          puts 'Continuing with vbguest installation...'
        super
          puts 'Performing vbguest post-installation steps...'
            communicate.sudo('usermod -a -G vboxsf vagrant', (opts || {}).merge(:error_check => false), &block)
    end
    def reboot_after_install?(opts=nil, &block)
      true
    end
  end

  config.vbguest.installer = WorkaroundVbguest
  # End workaround
eroux commented 4 years ago

why closing the issue?

hyamamoto commented 4 years ago

Well, It's still happening to me for a debian/buster image with vagrant-vbguest 0.23.0

glen-84 commented 4 years ago

@HubertSadecki Please reopen the issue.

kergekacsa commented 4 years ago

I have the same problem with debian/jessie64. Thanks for the workaround thou, that helped me out. But it's still just a workaround :(