Difference between revisions of "Vagrant up --provider=libvirt"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
Tags: Mobile web edit, Mobile edit
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
{{lowercase}}
 +
* https://github.com/vagrant-libvirt/vagrant-libvirt
 +
 +
 +
*<code>[[vagrant init fedora/32-cloud-base]]</code>
 +
 +
*<code>[[vagrant up --provider]]=libvirt</code>
 +
 +
[[vagrant status]]
 +
[[vagrant ssh]] VM_NAME
 +
 +
[[virsh console]] VM_NAME
 +
username: vagrant
 +
password: vagrant
 +
 +
== vagrant up --provider=libvirt ==
 +
<pre>
 +
vagrant up --provider=libvirt
 +
Bringing machine 'YOUR_VM_MACHINE_NAME' up with 'libvirt' provider...
 +
==> YOUR_VM_MACHINE_NAME: Box 'generic/ubuntu2010' could not be found. Attempting to find and install...
 +
    YOUR_VM_MACHINE_NAME: Box Provider: libvirt
 +
    YOUR_VM_MACHINE_NAME: Box Version: >= 0
 +
==> YOUR_VM_MACHINE_NAME: Loading metadata for box 'generic/ubuntu2010'
 +
    YOUR_VM_MACHINE_NAME: URL: https://vagrantcloud.com/generic/ubuntu2010
 +
==> YOUR_VM_MACHINE_NAME: Adding box 'generic/ubuntu2010' (v3.2.16) for provider: libvirt
 +
    YOUR_VM_MACHINE_NAME: Downloading: https://vagrantcloud.com/generic/boxes/ubuntu2010/versions/3.2.16/providers/libvirt.box
 +
Download redirected to host: vagrantcloud-files-production.s3-accelerate.amazonaws.com
 +
    YOUR_VM_MACHINE_NAME: Calculating and comparing box checksum...
 +
==> YOUR_VM_MACHINE_NAME: Successfully added box 'generic/ubuntu2010' (v3.2.16) for 'libvirt'!
 +
==> YOUR_VM_MACHINE_NAME: Uploading base box image as volume into Libvirt storage...
 +
==> YOUR_VM_MACHINE_NAME: Creating image (snapshot of base box volume).
 +
==> YOUR_VM_MACHINE_NAME: Creating domain with the following settings...
 +
==> YOUR_VM_MACHINE_NAME:  -- Name:              YOUR_VM_MACHINE_NAME
 +
==> YOUR_VM_MACHINE_NAME:  -- Domain type:      kvm
 +
==> YOUR_VM_MACHINE_NAME:  -- Cpus:              2
 +
==> YOUR_VM_MACHINE_NAME:  -- Feature:          acpi
 +
==> YOUR_VM_MACHINE_NAME:  -- Feature:          apic
 +
==> YOUR_VM_MACHINE_NAME:  -- Feature:          pae
 +
==> YOUR_VM_MACHINE_NAME:  -- Memory:            8192M
 +
==> YOUR_VM_MACHINE_NAME:  -- Management MAC:
 +
==> YOUR_VM_MACHINE_NAME:  -- Loader:
 +
==> YOUR_VM_MACHINE_NAME:  -- Nvram:
 +
==> YOUR_VM_MACHINE_NAME:  -- Base box:          generic/ubuntu2010
 +
==> YOUR_VM_MACHINE_NAME:  -- Storage pool:      default
 +
==> YOUR_VM_MACHINE_NAME:  -- Image:            /var/lib/libvirt/images/YOUR_VM_MACHINE_NAME.img (128G)
 +
==> YOUR_VM_MACHINE_NAME:  -- Volume Cache:      default
 +
==> YOUR_VM_MACHINE_NAME:  -- Kernel:
 +
==> YOUR_VM_MACHINE_NAME:  -- Initrd:
 +
==> YOUR_VM_MACHINE_NAME:  -- Graphics Type:    vnc
 +
==> YOUR_VM_MACHINE_NAME:  -- Graphics Port:    -1
 +
==> YOUR_VM_MACHINE_NAME:  -- Graphics IP:      127.0.0.1
 +
==> YOUR_VM_MACHINE_NAME:  -- Graphics Password: Not defined
 +
==> YOUR_VM_MACHINE_NAME:  -- Video Type:        cirrus
 +
==> YOUR_VM_MACHINE_NAME:  -- Video VRAM:        256
 +
==> YOUR_VM_MACHINE_NAME:  -- Sound Type:
 +
==> YOUR_VM_MACHINE_NAME:  -- Keymap:            en-us
 +
==> YOUR_VM_MACHINE_NAME:  -- TPM Path:
 +
==> YOUR_VM_MACHINE_NAME:  -- INPUT:            type=mouse, bus=ps2
 +
==> YOUR_VM_MACHINE_NAME: Creating shared folders metadata...
 +
==> YOUR_VM_MACHINE_NAME: Starting domain.
 +
==> YOUR_VM_MACHINE_NAME: Waiting for domain to get an IP address...
 +
==> YOUR_VM_MACHINE_NAME: Waiting for SSH to become available...
 +
    YOUR_VM_MACHINE_NAME:
 +
    YOUR_VM_MACHINE_NAME: Vagrant insecure key detected. Vagrant will automatically replace
 +
    YOUR_VM_MACHINE_NAME: this with a newly generated keypair for better security.
 +
    YOUR_VM_MACHINE_NAME:
 +
    YOUR_VM_MACHINE_NAME: Inserting generated public key within guest...
 +
    YOUR_VM_MACHINE_NAME: Removing insecure key from the guest if it's present...
 +
    YOUR_VM_MACHINE_NAME: Key inserted! Disconnecting and reconnecting using new SSH key...
 +
</pre>
 +
 +
== With errors ==
 +
 +
vagrant up --provider=libvirt
 +
Bringing machine 'default' up with 'libvirt' provider...
 +
==> default: Box 'fedora/32-cloud-base' could not be found. Attempting to find and install...
 +
    default: Box Provider: libvirt
 +
    default: Box Version: >= 0
 +
==> default: Loading metadata for box 'fedora/32-cloud-base'
 +
    default: URL: https://vagrantcloud.com/fedora/32-cloud-base
 +
==> default: Adding box 'fedora/32-cloud-base' (v32.20200422.0) for provider: libvirt
 +
    default: Downloading: https://vagrantcloud.com/fedora/boxes/32-cloud-base/versions/32.20200422.0/providers/libvirt.box
 +
    default: Download redirected to host: download.fedoraproject.org
 +
    default: Calculating and comparing box checksum...
 +
The box failed to unpackage properly. Please verify that the box
 +
file you're trying to add is not corrupted and that enough disk space
 +
is available and then try again.
 +
The output from attempting to unpackage (if any):
 +
 +
x box.img: Write failed
 +
x metadata.json: Write failed
 +
x Vagrantfile: Write failed
 +
bsdtar: Error exit delayed from previous errors.
 +
 +
 +
 +
 +
vagrant up --provider=libvirt
 +
Bringing machine 'default' up with 'libvirt' provider...
 +
There was error while creating libvirt storage pool: Call to virStoragePoolDefineXML failed: operation failed: Storage source conflict with [[pool]]: 'images'
 +
 +
<pre>
 +
vagrant up --provider=libvirt
 +
Bringing machine 'default' up with 'libvirt' provider...
 +
==> default: Box 'fedora/32-cloud-base' could not be found. Attempting to find and install...
 +
    default: Box Provider: libvirt
 +
    default: Box Version: >= 0
 +
==> default: Loading metadata for box 'fedora/32-cloud-base'
 +
    default: URL: https://vagrantcloud.com/fedora/32-cloud-base
 +
==> default: Adding box 'fedora/32-cloud-base' (v32.20200422.0) for provider: libvirt
 +
    default: Downloading: https://vagrantcloud.com/fedora/boxes/32-cloud-base/versions/32.20200422.0/providers/libvirt.box
 +
Download redirected to host: download.fedoraproject.org
 +
    default: Calculating and comparing box checksum...
 +
==> default: Successfully added box 'fedora/32-cloud-base' (v32.20200422.0) for 'libvirt'!
 +
==> default: Uploading base box image as volume into Libvirt storage...
 +
==> default: Creating image (snapshot of base box volume).
 +
==> default: Creating domain with the following settings...
 +
==> default:  -- Name:              root_default
 +
==> default:  -- Domain type:      kvm
 +
==> default:  -- Cpus:              1
 +
==> default:  -- Feature:          acpi
 +
==> default:  -- Feature:          apic
 +
==> default:  -- Feature:          pae
 +
==> default:  -- Memory:            512M
 +
==> default:  -- Management MAC:
 +
==> default:  -- Loader:
 +
==> default:  -- Nvram:
 +
==> default:  -- Base box:          fedora/32-cloud-base
 +
==> default:  -- Storage pool:      default
 +
==> default:  -- Image:            /var/lib/libvirt/images/root_default.img (41G)
 +
==> default:  -- Volume Cache:      default
 +
==> default:  -- Kernel:
 +
==> default:  -- Initrd:
 +
==> default:  -- Graphics Type:    vnc
 +
==> default:  -- Graphics Port:    -1
 +
==> default:  -- Graphics IP:      127.0.0.1
 +
==> default:  -- Graphics Password: Not defined
 +
==> default:  -- Video Type:        cirrus
 +
==> default:  -- Video VRAM:        9216
 +
==> default:  -- Sound Type:
 +
==> default:  -- Keymap:            en-us
 +
==> default:  -- TPM Path:
 +
==> default:  -- INPUT:            type=mouse, bus=ps2
 +
Error while creating domain: Error saving the server: Call to virDomainDefineXML failed: invalid argument: could not get preferred machine for /usr/bin/qemu-system-x86_64 type=kvm
 +
</pre>
 +
 +
  
 
<pre>
 
<pre>
Line 22: Line 169:
  
  
*<code>[[vagrant init fedora/32-cloud-base]]</code>
+
vagrant up --provider=libvirt
 +
Traceback (most recent call last):
 +
  10: from /usr/bin/vagrant:23:in `<main>'
 +
9: from /usr/bin/vagrant:23:in `load'
 +
8: from /usr/share/rubygems-integration/all/gems/vagrant-2.2.6/bin/vagrant:145:in `<top (required)>'
 +
7: from /usr/share/rubygems-integration/all/gems/vagrant-2.2.6/bin/vagrant:145:in `new'
 +
6: from /usr/share/rubygems-integration/all/gems/vagrant-2.2.6/lib/vagrant/environment.rb:124:in `initialize'
 +
5: from /usr/share/rubygems-integration/all/gems/vagrant-2.2.6/lib/vagrant/util/platform.rb:247:in `fs_real_path'
 +
4: from /usr/share/rubygems-integration/all/gems/vagrant-2.2.6/lib/vagrant/util/platform.rb:229:in `fs_case_sensitive?'
 +
3: from /usr/lib/ruby/2.7.0/tmpdir.rb:83:in `mktmpdir'
 +
2: from /usr/lib/ruby/2.7.0/tmpdir.rb:129:in `create'
 +
1: from /usr/lib/ruby/2.7.0/tmpdir.rb:85:in `block in mktmpdir'
 +
/usr/lib/ruby/2.7.0/tmpdir.rb:85:in `mkdir': [[No space left on device]] @ dir_s_mkdir - /tmp/vagrant-fs-case-sensitive20210411-34679-fhqcbq (Errno::ENOSPC)
  
 +
== Related terms ==
 +
* [[Terraform]]
  
 
== See also ==
 
== See also ==
 
* {{Vagrant}}
 
* {{Vagrant}}
 +
* {{libvirt}}
  
 
[[Category:Vagrant]]
 
[[Category:Vagrant]]

Latest revision as of 07:44, 18 October 2021


vagrant status
vagrant ssh VM_NAME
virsh console VM_NAME
username: vagrant
password: vagrant

vagrant up --provider=libvirt[edit]

vagrant up --provider=libvirt
Bringing machine 'YOUR_VM_MACHINE_NAME' up with 'libvirt' provider...
==> YOUR_VM_MACHINE_NAME: Box 'generic/ubuntu2010' could not be found. Attempting to find and install...
    YOUR_VM_MACHINE_NAME: Box Provider: libvirt
    YOUR_VM_MACHINE_NAME: Box Version: >= 0
==> YOUR_VM_MACHINE_NAME: Loading metadata for box 'generic/ubuntu2010'
    YOUR_VM_MACHINE_NAME: URL: https://vagrantcloud.com/generic/ubuntu2010
==> YOUR_VM_MACHINE_NAME: Adding box 'generic/ubuntu2010' (v3.2.16) for provider: libvirt
    YOUR_VM_MACHINE_NAME: Downloading: https://vagrantcloud.com/generic/boxes/ubuntu2010/versions/3.2.16/providers/libvirt.box
Download redirected to host: vagrantcloud-files-production.s3-accelerate.amazonaws.com
    YOUR_VM_MACHINE_NAME: Calculating and comparing box checksum...
==> YOUR_VM_MACHINE_NAME: Successfully added box 'generic/ubuntu2010' (v3.2.16) for 'libvirt'!
==> YOUR_VM_MACHINE_NAME: Uploading base box image as volume into Libvirt storage...
==> YOUR_VM_MACHINE_NAME: Creating image (snapshot of base box volume).
==> YOUR_VM_MACHINE_NAME: Creating domain with the following settings...
==> YOUR_VM_MACHINE_NAME:  -- Name:              YOUR_VM_MACHINE_NAME
==> YOUR_VM_MACHINE_NAME:  -- Domain type:       kvm
==> YOUR_VM_MACHINE_NAME:  -- Cpus:              2
==> YOUR_VM_MACHINE_NAME:  -- Feature:           acpi
==> YOUR_VM_MACHINE_NAME:  -- Feature:           apic
==> YOUR_VM_MACHINE_NAME:  -- Feature:           pae
==> YOUR_VM_MACHINE_NAME:  -- Memory:            8192M
==> YOUR_VM_MACHINE_NAME:  -- Management MAC:
==> YOUR_VM_MACHINE_NAME:  -- Loader:
==> YOUR_VM_MACHINE_NAME:  -- Nvram:
==> YOUR_VM_MACHINE_NAME:  -- Base box:          generic/ubuntu2010
==> YOUR_VM_MACHINE_NAME:  -- Storage pool:      default
==> YOUR_VM_MACHINE_NAME:  -- Image:             /var/lib/libvirt/images/YOUR_VM_MACHINE_NAME.img (128G)
==> YOUR_VM_MACHINE_NAME:  -- Volume Cache:      default
==> YOUR_VM_MACHINE_NAME:  -- Kernel:
==> YOUR_VM_MACHINE_NAME:  -- Initrd:
==> YOUR_VM_MACHINE_NAME:  -- Graphics Type:     vnc
==> YOUR_VM_MACHINE_NAME:  -- Graphics Port:     -1
==> YOUR_VM_MACHINE_NAME:  -- Graphics IP:       127.0.0.1
==> YOUR_VM_MACHINE_NAME:  -- Graphics Password: Not defined
==> YOUR_VM_MACHINE_NAME:  -- Video Type:        cirrus
==> YOUR_VM_MACHINE_NAME:  -- Video VRAM:        256
==> YOUR_VM_MACHINE_NAME:  -- Sound Type:
==> YOUR_VM_MACHINE_NAME:  -- Keymap:            en-us
==> YOUR_VM_MACHINE_NAME:  -- TPM Path:
==> YOUR_VM_MACHINE_NAME:  -- INPUT:             type=mouse, bus=ps2
==> YOUR_VM_MACHINE_NAME: Creating shared folders metadata...
==> YOUR_VM_MACHINE_NAME: Starting domain.
==> YOUR_VM_MACHINE_NAME: Waiting for domain to get an IP address...
==> YOUR_VM_MACHINE_NAME: Waiting for SSH to become available...
    YOUR_VM_MACHINE_NAME:
    YOUR_VM_MACHINE_NAME: Vagrant insecure key detected. Vagrant will automatically replace
    YOUR_VM_MACHINE_NAME: this with a newly generated keypair for better security.
    YOUR_VM_MACHINE_NAME:
    YOUR_VM_MACHINE_NAME: Inserting generated public key within guest...
    YOUR_VM_MACHINE_NAME: Removing insecure key from the guest if it's present...
    YOUR_VM_MACHINE_NAME: Key inserted! Disconnecting and reconnecting using new SSH key...

With errors[edit]

vagrant up --provider=libvirt
Bringing machine 'default' up with 'libvirt' provider...
==> default: Box 'fedora/32-cloud-base' could not be found. Attempting to find and install...
    default: Box Provider: libvirt
    default: Box Version: >= 0 
==> default: Loading metadata for box 'fedora/32-cloud-base'
    default: URL: https://vagrantcloud.com/fedora/32-cloud-base
==> default: Adding box 'fedora/32-cloud-base' (v32.20200422.0) for provider: libvirt
    default: Downloading: https://vagrantcloud.com/fedora/boxes/32-cloud-base/versions/32.20200422.0/providers/libvirt.box
    default: Download redirected to host: download.fedoraproject.org
    default: Calculating and comparing box checksum...
The box failed to unpackage properly. Please verify that the box
file you're trying to add is not corrupted and that enough disk space
is available and then try again.
The output from attempting to unpackage (if any):

x box.img: Write failed
x metadata.json: Write failed
x Vagrantfile: Write failed 
bsdtar: Error exit delayed from previous errors.


vagrant up --provider=libvirt
Bringing machine 'default' up with 'libvirt' provider...
There was error while creating libvirt storage pool: Call to virStoragePoolDefineXML failed: operation failed: Storage source conflict with pool: 'images'
vagrant up --provider=libvirt
Bringing machine 'default' up with 'libvirt' provider...
==> default: Box 'fedora/32-cloud-base' could not be found. Attempting to find and install...
    default: Box Provider: libvirt
    default: Box Version: >= 0
==> default: Loading metadata for box 'fedora/32-cloud-base'
    default: URL: https://vagrantcloud.com/fedora/32-cloud-base
==> default: Adding box 'fedora/32-cloud-base' (v32.20200422.0) for provider: libvirt
    default: Downloading: https://vagrantcloud.com/fedora/boxes/32-cloud-base/versions/32.20200422.0/providers/libvirt.box
Download redirected to host: download.fedoraproject.org
    default: Calculating and comparing box checksum...
==> default: Successfully added box 'fedora/32-cloud-base' (v32.20200422.0) for 'libvirt'!
==> default: Uploading base box image as volume into Libvirt storage...
==> default: Creating image (snapshot of base box volume).
==> default: Creating domain with the following settings...
==> default:  -- Name:              root_default
==> default:  -- Domain type:       kvm
==> default:  -- Cpus:              1
==> default:  -- Feature:           acpi
==> default:  -- Feature:           apic
==> default:  -- Feature:           pae
==> default:  -- Memory:            512M
==> default:  -- Management MAC:
==> default:  -- Loader:
==> default:  -- Nvram:
==> default:  -- Base box:          fedora/32-cloud-base
==> default:  -- Storage pool:      default
==> default:  -- Image:             /var/lib/libvirt/images/root_default.img (41G)
==> default:  -- Volume Cache:      default
==> default:  -- Kernel:
==> default:  -- Initrd:
==> default:  -- Graphics Type:     vnc
==> default:  -- Graphics Port:     -1
==> default:  -- Graphics IP:       127.0.0.1
==> default:  -- Graphics Password: Not defined
==> default:  -- Video Type:        cirrus
==> default:  -- Video VRAM:        9216
==> default:  -- Sound Type:
==> default:  -- Keymap:            en-us
==> default:  -- TPM Path:
==> default:  -- INPUT:             type=mouse, bus=ps2
Error while creating domain: Error saving the server: Call to virDomainDefineXML failed: invalid argument: could not get preferred machine for /usr/bin/qemu-system-x86_64 type=kvm


 vagrant up --provider=libvirt
Bringing machine 'default' up with 'libvirt' provider...
==> default: Box 'bento/fedora-32' could not be found. Attempting to find and install...
    default: Box Provider: libvirt
    default: Box Version: >= 0
==> default: Loading metadata for box 'bento/fedora-32'
    default: URL: https://vagrantcloud.com/bento/fedora-32
The box you're attempting to add doesn't support the provider
you requested. Please find an alternate box or use an alternate
provider. Double-check your requested provider to verify you didn't
simply misspell it.

If you're adding a box from HashiCorp's Vagrant Cloud, make sure the box is
released.

Name: bento/fedora-32
Address: https://vagrantcloud.com/bento/fedora-32
Requested provider: [:libvirt]


vagrant up --provider=libvirt
Traceback (most recent call last):
 	10: from /usr/bin/vagrant:23:in `<main>'
	 9: from /usr/bin/vagrant:23:in `load'
	 8: from /usr/share/rubygems-integration/all/gems/vagrant-2.2.6/bin/vagrant:145:in `<top (required)>'
	 7: from /usr/share/rubygems-integration/all/gems/vagrant-2.2.6/bin/vagrant:145:in `new'
	 6: from /usr/share/rubygems-integration/all/gems/vagrant-2.2.6/lib/vagrant/environment.rb:124:in `initialize'
	 5: from /usr/share/rubygems-integration/all/gems/vagrant-2.2.6/lib/vagrant/util/platform.rb:247:in `fs_real_path'
	 4: from /usr/share/rubygems-integration/all/gems/vagrant-2.2.6/lib/vagrant/util/platform.rb:229:in `fs_case_sensitive?'
	 3: from /usr/lib/ruby/2.7.0/tmpdir.rb:83:in `mktmpdir'
	 2: from /usr/lib/ruby/2.7.0/tmpdir.rb:129:in `create'
	 1: from /usr/lib/ruby/2.7.0/tmpdir.rb:85:in `block in mktmpdir'
/usr/lib/ruby/2.7.0/tmpdir.rb:85:in `mkdir': No space left on device @ dir_s_mkdir - /tmp/vagrant-fs-case-sensitive20210411-34679-fhqcbq (Errno::ENOSPC)

Related terms[edit]

See also[edit]

Advertising: