vagrant on centos 7 vbox drv issue enable VT-x vagrant box ubuntu-bionic

[root@localhost ~]# yum remove vagrant
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package vagrant.i686 1:2.2.5-1 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================
 Package            Arch            Version                 Repository            Size
=======================================================================================
Removing:
 vagrant            i686            1:2.2.5-1               installed             97 M

Transaction Summary
=======================================================================================
Remove  1 Package

Installed size: 97 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : 1:vagrant-2.2.5-1.i686                                              1/1
  Verifying  : 1:vagrant-2.2.5-1.i686                                              1/1

Removed:
  vagrant.i686 1:2.2.5-1                                                             

Complete!
[root@localhost ~]# yum -y install https://releases.hashicorp.com/vagrant/1.9.6/vagrant_1.9.6_x86_64.rpm
Loaded plugins: fastestmirror, langpacks
vagrant_1.9.6_x86_64.rpm                                        |  75 MB  00:00:34   
Examining /var/tmp/yum-root-3juNJv/vagrant_1.9.6_x86_64.rpm: 1:vagrant-1.9.6-1.x86_64
Marking /var/tmp/yum-root-3juNJv/vagrant_1.9.6_x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package vagrant.x86_64 1:1.9.6-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================
 Package         Arch           Version            Repository                     Size
=======================================================================================
Installing:
 vagrant         x86_64         1:1.9.6-1          /vagrant_1.9.6_x86_64         190 M

Transaction Summary
=======================================================================================
Install  1 Package

Total size: 190 M
Installed size: 190 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:vagrant-1.9.6-1.x86_64                                            1/1
  Verifying  : 1:vagrant-1.9.6-1.x86_64                                            1/1

Installed:
  vagrant.x86_64 1:1.9.6-1                                                           

Complete!
[root@localhost ~]# vagrant --version
Vagrant 1.9.6
[root@localhost ~]# sudo mkdir ~/vagrant-centos-7
[root@localhost ~]# cd ~/vagrant-centos-7
[root@localhost vagrant-centos-7]# vagrant box add centos/7
==> box: Loading metadata for box 'centos/7'
    box: URL: https://vagrantcloud.com/centos/7
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.

1) hyperv
2) libvirt
3) virtualbox
4) vmware_desktop

Enter your choice: 4
==> box: Adding box 'centos/7' (v1905.1) for provider: vmware_desktop
    box: Downloading: https://vagrantcloud.com/centos/boxes/7/versions/1905.1/providers/vmware_desktop.box
==> box: Successfully added box 'centos/7' (v1905.1) for 'vmware_desktop'!
[root@localhost vagrant-centos-7]# touch Vagrantfile
[root@localhost vagrant-centos-7]# vagrant up
VirtualBox is complaining that the kernel module is not loaded. Please
run `VBoxManage --version` or open the VirtualBox GUI to see the error
message which should contain instructions on how to fix this error.
[root@localhost vagrant-centos-7]# VBoxManage --version
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
         available for the current kernel (3.10.0-862.el7.x86_64) or it failed to
         load. Please recompile the kernel module and install it by

           sudo /sbin/vboxconfig

         You will not be able to start VMs until this problem is fixed.
6.0.10r132072
[root@localhost vagrant-centos-7]# sudo /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the gcc make perl packages from your distribution.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
    kernel-devel kernel-devel-3.10.0-862.el7.x86_64
This system is currently not set up to build kernel modules.
Please install the gcc make perl packages from your distribution.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
    kernel-devel kernel-devel-3.10.0-862.el7.x86_64

There were problems setting up VirtualBox.  To re-start the set-up process, run
  /sbin/vboxconfig
as root.  If your system is using EFI Secure Boot you may need to sign the
kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
them. Please see your Linux system's documentation for more information.
[root@localhost vagrant-centos-7]# vagrant up
VirtualBox is complaining that the kernel module is not loaded. Please
run `VBoxManage --version` or open the VirtualBox GUI to see the error
message which should contain instructions on how to fix this error.
[root@localhost vagrant-centos-7]# vagrant box add centos/7
==> box: Loading metadata for box 'centos/7'
    box: URL: https://vagrantcloud.com/centos/7
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.

1) hyperv
2) libvirt
3) virtualbox
4) vmware_desktop

Enter your choice: 2
==> box: Adding box 'centos/7' (v1905.1) for provider: libvirt
    box: Downloading: https://vagrantcloud.com/centos/boxes/7/versions/1905.1/providers/libvirt.box
==> box: Successfully added box 'centos/7' (v1905.1) for 'libvirt'!
[root@localhost vagrant-centos-7]# vagrant up
VirtualBox is complaining that the kernel module is not loaded. Please
run `VBoxManage --version` or open the VirtualBox GUI to see the error
message which should contain instructions on how to fix this error.
[root@localhost vagrant-centos-7]#
325  ansible localhost -m shell -a  "virt-manager"
  yum groupinstall "Development tools"
  yum install https://centos7.iuscommunity.org/ius-release.rpm
  yum install dkms
  yum install kernel-devel
  
  336  yum install -y kernel-devel kernel-headers gcc make perl

  340  yum update
  reboot
[root@localhost vagrant-centos-7]# root@localhost ~]# service vboxdrv status
Redirecting to /bin/systemctl status vboxdrv.service
● vboxdrv.service - VirtualBox Linux kernel module
   Loaded: loaded (/usr/lib/virtualbox/vboxdrv.sh; enabled; vendor preset: disabled)
   Active: active (exited) since Sun 2019-08-25 19:16:04 IST; 2min 54s ago
  Process: 790 ExecStart=/usr/lib/virtualbox/vboxdrv.sh start (code=exited, status=0/SUCCESS)
    Tasks: 0

Aug 25 19:11:38 localhost.localdomain systemd[1]: Starting VirtualBox Linux kernel ....
Aug 25 19:11:45 localhost.localdomain vboxdrv.sh[790]: vboxdrv.sh: Starting Virtual....
Aug 25 19:11:45 localhost.localdomain vboxdrv.sh[955]: Starting VirtualBox services.
Aug 25 19:11:45 localhost.localdomain vboxdrv.sh[790]: vboxdrv.sh: Building Virtual....
Aug 25 19:11:45 localhost.localdomain vboxdrv.sh[960]: Building VirtualBox kernel m....
Aug 25 19:16:04 localhost.localdomain systemd[1]: Started VirtualBox Linux kernel m....
Hint: Some lines were ellipsized, use -l to show in full.

[root@localhost vagrant-centos-7]# yum install -y VirtualBox-5.1
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.nbrc.ac.in
 * epel: ftp.jaist.ac.jp
 * extras: mirror.nbrc.ac.in
 * updates: mirror.nbrc.ac.in
Resolving Dependencies
--> Running transaction check
---> Package VirtualBox-5.1.x86_64 0:5.1.38_122592_el7-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================
 Package              Arch         Version                      Repository        Size
=======================================================================================
Installing:
 VirtualBox-5.1       x86_64       5.1.38_122592_el7-1          virtualbox        76 M

Transaction Summary
=======================================================================================
Install  1 Package

Total size: 76 M
Installed size: 170 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : VirtualBox-5.1-5.1.38_122592_el7-1.x86_64                           1/1

Creating group 'vboxusers'. VM users must be member of that group!

  Verifying  : VirtualBox-5.1-5.1.38_122592_el7-1.x86_64                           1/1

Installed:
  VirtualBox-5.1.x86_64 0:5.1.38_122592_el7-1                                       

Complete!

[root@localhost ~]# vagrant box list
centos/7 (libvirt, 1905.1)
centos/7 (virtualbox, 1905.1)
centos/7 (vmware_desktop, 1905.1)
[root@localhost ~]# 

root@localhost ~]# vagrant init ubuntu/bionic64
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.
[root@localhost ~]# vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/bionic64' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/bionic64'
    default: URL: https://vagrantcloud.com/ubuntu/bionic64
==> default: Adding box 'ubuntu/bionic64' (v20190822.0.0) for provider: virtualbox
    default: Downloading: https://vagrantcloud.com/ubuntu/boxes/bionic64/versions/20190822.0.0/providers/virtualbox.box
==> default: Successfully added box 'ubuntu/bionic64' (v20190822.0.0) for 'virtualbox'!
==> default: Importing base box 'ubuntu/bionic64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/bionic64' is up to date...
==> default: Setting the name of the VM: root_default_1566751134434_56427
==> 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: Running 'pre-boot' VM customizations...
==> default: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "fd467d2b-3e69-4438-94d3-4e1bffa5802c", "--type", "headless"]

Stderr: VBoxManage: error: VT-x is not available (VERR_VMX_NO_VMX)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ConsoleWrap, interface IConsole
to Enable VT-x on vm .shutdown vm 
and select processor enable VT-x 
[root@localhost ~]# 
[root@vagrant ~]# vagrant ssh
Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-58-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Sun Aug 25 17:14:05 UTC 2019

  System load:  0.02             Processes:             93
  Usage of /:   9.9% of 9.63GB   Users logged in:       0
  Memory usage: 12%              IP address for enp0s3: 10.0.2.15
  Swap usage:   0%


0 packages can be updated.
0 updates are security updates.


vagrant@ubuntu-bionic:~$

[root@vagrant ~]# cd vagrant-centos-7/
[root@vagrant vagrant-centos-7]# ls
Vagrantfile
[root@vagrant vagrant-centos-7]# rm Vagrantfile
rm: remove regular file ‘Vagrantfile’? y
[root@vagrant vagrant-centos-7]# vagrant init 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.
[root@vagrant vagrant-centos-7]# vagrant ssh
VM must be running to open SSH connection. Run `vagrant up`
to start the virtual machine.
[root@vagrant vagrant-centos-7]# vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'centos/7' is up to date...
==> default: Clearing any previously set forwarded ports...
==> 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:
    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: 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: Rsyncing folder: /root/vagrant-centos-7/ => /vagrant
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.

[root@vagrant vagrant-centos-7]# vagrant ssh
[vagrant@localhost ~]$ uname -a
Linux localhost.localdomain 3.10.0-957.12.2.el7.x86_64 #1 SMP Tue May 14 21:24:32 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
[vagrant@localhost ~]$ uname -r
3.10.0-957.12.2.el7.x86_64
[vagrant@localhost ~]$ uname -s
Linux
[vagrant@localhost ~]$ cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core) 
[vagrant@localhost ~]$ 

Comments