dotless-de / vagrant-vbguest

A Vagrant plugin to keep your VirtualBox Guest Additions up to date

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provisioning of centos 7 boxes on virtualbox 6.1.x fails due to unavailable upstream repo

endemics opened this issue · comments

Running vagrant up of a centos 7 VM on a macos 10.14.6 host with virtualbox 6.1.6 fails with:

$ vagrant up --provision admin
Bringing machine 'admin' up with 'virtualbox' provider...
==> admin: Importing base box 'centos/7'...
==> admin: Matching MAC address for NAT networking...
==> admin: Checking if box 'centos/7' version '1905.1' is up to date...
==> admin: Setting the name of the VM: platform-ansible_admin_1588037835907_99480
==> admin: Clearing any previously set network interfaces...
==> admin: Preparing network interfaces based on configuration...
    admin: Adapter 1: nat
==> admin: Forwarding ports...
    admin: 22 (guest) => 2222 (host) (adapter 1)
==> admin: Booting VM...
==> admin: Waiting for machine to boot. This may take a few minutes...
    admin: SSH address: 127.0.0.1:2222
    admin: SSH username: vagrant
    admin: SSH auth method: private key
    admin: 
    admin: Vagrant insecure key detected. Vagrant will automatically replace
    admin: this with a newly generated keypair for better security.
    admin: 
    admin: Inserting generated public key within guest...
    admin: Removing insecure key from the guest if it's present...
    admin: Key inserted! Disconnecting and reconnecting using new SSH key...
==> admin: Machine booted and ready!
[admin] No Virtualbox Guest Additions installation found.
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.melbourneitmirror.net
 * extras: mirror.intergrid.com.au
 * updates: centos.melbourneitmirror.net
Resolving Dependencies
--> Running transaction check
---> Package centos-release.x86_64 0:7-6.1810.2.el7.centos will be updated
---> Package centos-release.x86_64 0:7-8.2003.0.el7.centos will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package              Arch         Version                     Repository  Size
================================================================================
Updating:
 centos-release       x86_64       7-8.2003.0.el7.centos       base        26 k

Transaction Summary
================================================================================
Upgrade  1 Package

Total download size: 26 k
Downloading packages:
No Presto metadata available for base
Public key for centos-release-7-8.2003.0.el7.centos.x86_64.rpm is not installed
warning: /var/cache/yum/x86_64/7/base/packages/centos-release-7-8.2003.0.el7.centos.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-6.1810.2.el7.centos.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : centos-release-7-8.2003.0.el7.centos.x86_64                  1/2 
  Cleanup    : centos-release-7-6.1810.2.el7.centos.x86_64                  2/2 
  Verifying  : centos-release-7-8.2003.0.el7.centos.x86_64                  1/2 
  Verifying  : centos-release-7-6.1810.2.el7.centos.x86_64                  2/2 

Updated:
  centos-release.x86_64 0:7-8.2003.0.el7.centos                                 

Complete!
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.melbourneitmirror.net
 * extras: mirror.intergrid.com.au
 * updates: centos.melbourneitmirror.net
http://vault.centos.org/7.7.1908/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below wiki article 

https://wiki.centos.org/yum-errors

If above article doesn't help to resolve this issue please use https://bugs.centos.org/.



 One of the configured repositories failed (CentOS-7.7.1908 - Base),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=C7.7.1908-base ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable C7.7.1908-base
        or
            subscription-manager repos --disable=C7.7.1908-base

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=C7.7.1908-base.skip_if_unavailable=true

failure: repodata/repomd.xml from C7.7.1908-base: [Errno 256] No more mirrors to try.
http://vault.centos.org/7.7.1908/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
==> admin: Checking for guest additions in VM...
    admin: No guest additions were detected on the base box for this VM! Guest
    admin: additions are required for forwarded ports, shared folders, host only
    admin: networking, and more. If SSH fails on this machine, please install
    admin: the guest additions and repackage the box to continue.
    admin: 
    admin: This is not an error message; everything may continue to work properly,
    admin: in which case you may ignore this message.
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

yum install -y kernel-devel-`uname -r` --enablerepo=C*-base --enablerepo=C*-updates

Stdout from the command:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.melbourneitmirror.net
 * extras: mirror.intergrid.com.au
 * updates: centos.melbourneitmirror.net


Stderr from the command:

http://vault.centos.org/7.7.1908/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below wiki article 

https://wiki.centos.org/yum-errors

If above article doesn't help to resolve this issue please use https://bugs.centos.org/.



 One of the configured repositories failed (CentOS-7.7.1908 - Base),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=C7.7.1908-base ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable C7.7.1908-base
        or
            subscription-manager repos --disable=C7.7.1908-base

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=C7.7.1908-base.skip_if_unavailable=true

failure: repodata/repomd.xml from C7.7.1908-base: [Errno 256] No more mirrors to try.
http://vault.centos.org/7.7.1908/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found

Following the indications of the error message I was able to install the virtualbox guest additions after ssh-ing to the box:

yum-config-manager --save --setopt=C7.7.1908-base.skip_if_unavailable=true
yum-config-manager --save --setopt=C7.7.1908-update.skip_if_unavailable=true
yum install -y kernel-devel-`uname -r` --enablerepo=C*-base --enablerepo=C*-updates

And then vagrant vbguest --do install

I have checked http://vault.centos.org/7.7.1908/os/ and it does not indeed contain a x86_64 directory anymore, just Sources.

commented

so when vagrant up a new vm, i must ssh in vm and manually run some scripts above everytime?

Obviously not really a sustainable solution but this could be a workaround if you are not destroying the vm regularly. Naturally, a fix must be found. I am just not too sure what the cleanest solution would be.

Another workaround would be to not use a centos7 box that requires virtualbox extensions to be installed, such as bento/centos-7, so you won't need the vbguest plugin.

commented

But the error not happened before i upgrade VirtualBox from 6.0.x to 6.1.x via brew.

So when i saw the error, my first thought is current virtualbox version not compatible with vagrant 2.2.7

commented

you means that the source removed last month?

I am experiencing this, too. It started happening yesterday morning, somewhere between 9AM and 11:30AM CST. No change of Virtualbox version (6.0.18) or anything else. Just rebuilding the VM. I maintain a developer-oriented VM automation project, and the VM does get destroyed and rebuilt regularly.

commented

@johann-koebbe-fidelity I give up box centos/7, use bentos/centos-7 instead.

@johann-koebbe-fidelity I give up box centos/7, use bentos/centos-7 instead.

@seyvoue I'm using a custom base box built directly from a CentOS 7.7 ISO.

@endemics Do you know what is the purpose of using the C7.*-base repos? I was just doing a little poking around and experimenting, and it doesn't look like I actually need to use them.

=> yum search --show-duplicates kernel-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.mi.incx.net
 * epel: mirror.twinlakes.net
 * extras: mirrors.codec-cluster.org
 * updates: ewr.edge.kernel.org
========================================================================= N/S matched: kernel-devel =========================================================================
kernel-devel-3.10.0-1127.el7.x86_64 : Development package for building kernel modules to match the kernel

Which is coming out of /etc/yum.repos.d/CentOS-Base.repo. When I enable C7.*-base, I get a much longer list (due to --show-duplicates), but the last one (most recent) is the same.

Possibly related: #373

@endemics Do you know what is the purpose of using the C7.*-base repos? I was just doing a little poking around and experimenting, and it doesn't look like I actually need to use them.

@johann-koebbe-fidelity actually no, I was a bit unclear about the whole approach, which is why I haven't proposed a solution.

It was the original attempt to get a matching kernel-devel package for the installed kernel. And it also worked for quite some time

@fnordfish I can report that the fix for #373 present in 0.24.0.beta1 also fix this issue for me.

I've been looking at this for the last couple of days and thought I just add a footnote to this.

When vbguest plugin is installing kernel-devel :
yum install -y kernel-devel-uname -r --enablerepo=C*-base --enablerepo=C*-updates
The wildcards in the enablerepo will pick up definitions from within /etc/yum.repos.d/CentOS-Vault.repo e.g.
[C7.0.1406-base]
name=CentOS-7.0.1406 - Base
baseurl=http://vault.centos.org/7.0.1406/os/$basearch/

During a CentOS upgrade (One started on the 27th April 2020, which aligns with the raising of this ticket), some repos are offline and the yum repo resolving logic falls back to the vault repos.
When the CentOS upgrade process completes (after a few days), this problem will be resolved, but it really shouldn't be a problem in the first place.

As mentioned above, are the enablerepos really needed? I would have though the default enabled repos would be enough for this kind of build process.

The CentOS Installer was introduced in #314 combining ideas from #231, #223
Those discussions are pretty old (dating back to 2016), so chances are centos changed stuff in the meantime.