Score:0

Why Can't I Create a VirtualBox VM Using Vagrant?

th flag

I recently bought a book called: DevOps for the Desparate and cannot get past chapter 1 exercises to create a VM in Oracle Virtual Box.

In the initial set-up phase for chapter 1, I am creating:

  1. A Hyper-V Ubuntu VM
  2. In the Ubuntu VM, I am creating another VM in Oracle VirtualBox using Vagrant

I've gone through the exercises multiple times now and not having much luck since when I get to the command that creates the VM using

vagrant up

The creation fails.

I've tried the following OS's

  1. Ubuntu 18.04 LTS
  2. Ubuntu 20.04 LTS
  3. Ubuntu 22.04 LTS

image

This was not in the instructions, but when the Hyper-V image is created, I resized the hard drive to 100GB in Hyper-V setting since I kept running out of space when I ran:

$vagrant up

After I resized the hard drive in Hyper-V, I discovered that I also needed to resize the Linux partition which I did using:

growpart

image

All of the other steps I completed successfully, IE:

Page xiv Set-VMProcessor -VMName 'Ubuntu 20.04 LTS' -ExposeVirtualizationExtensions $true

Page xxi $git clone https://github.com/bradleyd/devops_for_the_desperate/

Page 4 Installed Vagrant

Page 7 Installed Ansible

When I get to Page 9, this fails:

$ vagrant up

I've been getting different errors, but now I am getting this one:

$ vagrant up

Bringing machine 'default' up with 'virtualbox' provider...

==> default: Importing base box 'ubuntu/focal64'...

==> default: Matching MAC address for NAT networking...

==> default: Checking if box 'ubuntu/focal64' version '20230719.0.0' is up to date...

==> default: Setting the name of the VM: dftd

==> default: Clearing any previously set network interfaces...


**There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling     VirtualBox. The command and stderr is shown below.


Command: ["hostonlyif", "ipconfig", "vboxnet2", "--ip", "172.28.128.1", "--netmask", "255.255.255.0"]

Stderr: VBoxManage: error: Code E_ACCESSDENIED (0x80070005) - Access denied (extended info not     available)

VBoxManage: error: Context: "EnableStaticIPConfig(Bstr(pszIp).raw(), Bstr(pszNetmask).raw())" at line 242 of file VBoxManageHostonly.cpp**

Thanks in advance.

Organic Marble avatar
us flag
Have you tried just making an Ubuntu Virtualbox VM without some other added on layer of tools? It's pretty easy.
Tikhon avatar
th flag
Yes, just tried with VirtualBox using Ubuntu 20.04. Doesn't work. When I start the image, it hangs with a message saying kworker exited with preempt count 2
Organic Marble avatar
us flag
I use them all the time. Do you have virtualization enabled in your BIOS/EFI? Did you provide adequate resources (CPU, RAM) for the VM?
Tikhon avatar
th flag
Virtualization enabled Base Memory 9216MB - 1 CPU
Tikhon avatar
th flag
Set CPU=4. Still no good
Tikhon avatar
th flag
Again, my laptop is Windows 11 Pro - 1 CPU/14 Cores/20 Logical processors->Within Windows 11 Pro, I running an Ubuntu Linux 22.04 VM in Hyper V that has 11 virtual processors->Within the Hyper-V VM I am running an Ubuntu Linux 22.04 VM Oracle Virtual Box VM that has 5 Processors. Hope that helps
A Rogue Ant. avatar
in flag
It's clear you've plety of spare oomph in the hardware. Thanks for the clarification.
Tikhon avatar
th flag
So since I was striking out with creating the VBox image, I went back to trying $vagrant up. It seems to be hanging here: ==> default: Mounting shared folders... default: /vagrant => /home/user/devops_for_the_desperate/vagrant
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.