Is it possible to run an ARM64 vagrant instance on the x86_64 host - linux

I'm trying to run an ARM64 Ubuntu VM on an x86_64 host with vagrant for development purposes. I searched the vagrant box on their website only found this one:
https://app.vagrantup.com/boxes/search?provider=libvirt&q=arm64&sort=downloads&utf8=%E2%9C%93
However, I failed to bring that VM up (using vagrant up --provider libvirt) as it seems using the qemu-system-x86_64 as the simulator instead of the qemu-system-aarch64. The vagrantfile I used:
Vagrant.configure("2") do |config|
config.vm.box = "MalibuKoKo/ubuntu-18.04.3-server-arm64-raspberry-4"
config.vm.define "ubuntu18.04-aarch64"
config.vm.provider :libvirt do |libvirt|
libvirt.machine_arch = "aarch64"
libvirt.uri = 'qemu:///system'
libvirt.emulator_path = "/usr/bin/qemu-system-aarch64"
end
end
Any suggestion how to bring it up? Thanks

Related

How to share (config.vm.synced_folder), directories between Windows 10 and CentOS7 Virtual Machine created using Vagrant and VirtualBox

I'm trying to create a VM CentOS7 using Vagrant (2.2.3) and Virtual Box (6.0.4), on Windows 10 using the following Vagrant file
Vagrant.configure("2") do |config|
config.vm.box = "bento/centos-7"
config.vm.network "private_network", ip: "192.168.56.3"
config.vm.synced_folder "D://SharedWithVM//CentOS7-Work", "/media/sf_CentOS7-Work", type: "virtualbox"
config.vm.provider "virtualbox" do |vb|
vb.name = "Test"
end
config.vm.provision "shell", path: "./scripts/InstallGuestAdditions.sh"
end
and the InstallGuestAdditions.sh shell script is the follow ..
#!/bin/bash
curl -C - -O http://download.virtualbox.org/virtualbox/6.0.4/VBoxGuestAdditions_6.0.4.iso
sudo mkdir /media/VBoxGuestAdditions
sudo mount -o loop,ro VBoxGuestAdditions_6.0.4.iso /media/VBoxGuestAdditions
sudo sh /media/VBoxGuestAdditions/VBoxLinuxAdditions.run
rm VBoxGuestAdditions_6.0.4.iso
sudo umount /media/VBoxGuestAdditions
sudo rmdir /media/VBoxGuestAdditions
All works fine and the CentOS7 VM is created.
If I check the machine properties about shared directories I can see this
So I'm quite surprised about this path \\?\D:\SharedWithVM\CentOS7-Work.
How should I change my Vagrantfile to obtain a right path?
I've tried to connect at my CentOS 7 VM using vagrant ssh command and all works. Also the command cd /media/sf_CentOS7-Work works fine but no file or directory can be listed or shared between the two systems.
I've tried to create files or directories in Windows 10 and also in CentOS7 VM.
Any suggestion or example will be appreciated.

vagrant synced folders not working real-time on virtualbox

my synced folders are not working properly, they are synced one-time at start but when I make changes on the host machine, vagrant is not syncing it real-time.
First some details on my system:
OS: Linux Mint 18 Sarah
Virtualbox version: 5.0.24-dfsg-0ubuntu1.16.04.1
Vagrant version: 1.9.0
vagrant-hostmanager (1.8.5)
vagrant-share (1.1.6)
vagrant-vbguest (0.13.0)
Before we start discussing, I am not using newest version of Virtualbox since it is not in the repository and a simple vagrant up fails.
My Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.network "private_network", ip: "192.168.88.88"
config.vm.hostname = "my.centos.dev"
end
vagrant up gives me this.
Now when I create a file on the host machine:
falnyr#mint:~/centos-vagrant $ ls
ansible Vagrantfile
falnyr#mint:~/centos-vagrant $ touch file.txt
falnyr#mint:~/centos-vagrant $ ls
ansible file.txt Vagrantfile
And ssh to guest machine:
falnyr#mint:~/centos-vagrant $ vagrant ssh
[vagrant#my ~]$ ls /vagrant/
ansible Vagrantfile
As you can see, the file is not created. When I perform vagrant reload the sync is executed again during machine boot.
Note: I cannot use NFS sync, since I need cross-platform ready environment.
Any ideas on how to enable real-time sync?
The owner of the box has enabled rsync by default on the sync type. If you look at Vagrantfile of your box (in my case its ~/.vagrant.d/boxes/centos-VAGRANTSLASH-7/0/vmware_fusion but yours might probably under the virtualbox provider) you'll see a Vagrantfile with content
Vagrant.configure("2") do |config|
config.vm.synced_folder ".", "/vagrant", type: "rsync"
end
Just remove this file from the box directory and it will work.
note if you plan to use nfs you can change the sync type in your Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.network "private_network", ip: "192.168.88.88"
config.vm.hostname = "my.centos.dev"
config.vm.synced_folder ".", "/vagrant", type: "nfs"
end
You can use rsync-auto command:
vagrant rsync-auto
Actually, when I had a problem with sync, adding type: nfs helped me:
config.vm.synced_folder ".", "/home/ubuntu/qb-online", type: "nfs"
You can read more information from the documentation:
https://www.vagrantup.com/docs/synced-folders/rsync.html
Vagrant.configure("2") do |config|
config.vm.synced_folder ".", "/vagrant", type: "nfs",
rsync__exclude: ".git/"
end
just use the 2nd and 3rd line inside
Vagrant.configure("2") do |config|
#place here
end
If Anyone is Facing this issue vbox "Syncing/Mount" just enter the Vagrant ssh where the vagrant file is without vagrant up and run the command "sudo yum upgrade" dat'll Take time once it'll get finished exit the vagrant and hit vagrant up again.Issue will resolved. .. :)
and make sure If You are using Centos use "Bento/Centos" in Your VagrantFile
List item
vagrant ssh
sudo yum upgrade
vagrant reload

Vagrant ssh and private network broken

Server is a fresh centos72 install, with pretty much dead in the water vagrant/vbox provider installed.
I have vagrant 1.8.6 rpm installed on a server with vbox 5.1.8r111374
, the box boxcutter/centos72 comes up, with error:
SSH auth method: private key
gocd: Warning: Remote connection disconnect. Retrying...
And yet... vagrant ssh works. The config file is basic af.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.define "boxname" do |boxname|
boxname.vm.box = "boxcutter/centos72"
boxname.vm.hostname = "test"
boxname.vm.network "private_network", ip: "192.168.111.10"
boxname.vm.provision :shell,
path: "prov.sh"
end
end
This can't run the prov script as it never gets past ssh set up. And vagrant provision won't work either because of the error above. I've obviously specified a private network, however once on the box the ifcfg-enp file looks like this:
TYPE=Ethernet
BOOTPROTO=dhcp
And the IP is a 10 address.
VirtualBox 5.1.x seems to be having major issues. Revert to 5.0.26 (5.0.28 seems to have major networking issues, too).

Provision Vagrant Linux VM with another Vagrant Linux VM running Ansible

I know Ansible has issues running on windows. Which is why, I want to avoid using it for my host. I want to provision a local linux vm running in VirtualBox.
I was wondering if anyone can tell me if it is possible, to use vagrant to bring up two independent VMs on the same box. Then install Ansible on one of those VMs, then using SSH log into that VM. From there, use the Linux VM with Ansible as the host, to provision another Linux VM, that was created via the windows host machine. So, this is not a VM inside a VM. It is just two VMs running on windows using vagrant, then SSH to one of those VMs to use Ansible to provision the other VM.
Steps:
Vagrant VM 1 and install Ansible
Vangrant VM 2
SSH to VM 1
Use Ansible to provision VM 2 using VM 1.
Can that be done? Sorry if that sounded confusing.
There is now a new Ansible local provisioner in Vagrant 1.8.0, which you can use in your scenario.
Especially, look at "Tips and Tricks" section of the documentation, there is an exact solution (which worked for me).
Below is my Vagrantfile for this scenario (slightly different from the one in the documentation), which also solves potential problems with the ssh permissions and "executable" inventory file (if you're using Cygwin):
Vagrant.configure(2) do |config|
config.vm.synced_folder "./", "/vagrant",
owner: "vagrant",
mount_options: ["dmode=775,fmode=600"]
config.vm.define "vm2" do |machine|
machine.vm.box = "box-cutter/ubuntu1404-desktop"
machine.vm.network "private_network", ip: "172.17.177.21"
end
config.vm.define 'vm1' do |machine|
machine.vm.box = "ubuntu/trusty64"
machine.vm.network "private_network", ip: "172.17.177.11"
machine.vm.provision :ansible_local do |ansible|
ansible.provisioning_path = "/vagrant"
ansible.playbook = "provisioning/playbook.yml"
ansible.limit = "vm2"
ansible.inventory_path = "inventory"
ansible.verbose = "vvv"
ansible.install = true
end
end
end
and inventory file:
vm1 ansible_connection=local
vm2 ansible_ssh_host=172.17.177.21 ansible_ssh_private_key_file=/vagrant/.vagrant/machines/vm2/virtualbox/private_key
In order to provision a box you don't necessary need to do it using another box, in this windows scenario you could simply write your playbooks, share it to your guest and hit it with ansible-playbook using shell provisioning.
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
$script = <<SCRIPT
sudo apt-get install -y software-properties-common
sudo apt-add-repository -y ppa:ansible/ansible
sudo apt-get update
sudo apt-get install -y ansible
ansible-playbook /home/vagrant/provisioning/playbook.yml
SCRIPT
config.vm.synced_folder "./provisioning", "/home/vagrant/provisioning"
config.vm.provision "shell", inline: $script
end
The first lines will get ansible on your box then it will target the playbook that you have shared to your box and run the playbooks.
This is an example, I once used this approach to provision my working vagrant box, hope this idea can help you.

Configuring Vagrantfile for multiple machine - Vagrant

I have setup a Virtual box with two VMs a) Ubuntu b) Windows 10. I have created vagrant boxes for each of these VMs from scratch. Each of the vagrant box runs good individually. But I want to launch both the VMs at once. So I created a Vagrantfile (shown below) with the help of this documentation: https://docs.vagrantup.com/v2/multi-machine/
With the following Vagrantfile, the box declared first gets launched while the other doesn't. Is there any error in my Vagrantfile?
Any solutions, hints on how to fix this problem? How do I launch both the VMs?
-----------Vagrantfile---------------
Vagrant.configure(2) do |config|
config.vm.define "linux" do |linux|
linux.vm.box = "ubuntu"
linux.vm.box_url = "/Users/xyz/Desktop/vagrant/linux_package.box"
end
config.vm.define "win" do |win|
win.vm.box = "Windows10"
win.vm.box_url = "/Users/xyz/Desktop/vagrant/win_package.box"
end
config.vm.provider "virtualbox" do |v|
v.gui = true
end
end
Output on terminal:
When linux machine is launched first, I get below message on terminal:
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mkdir -p /vagrant
Stdout from the command:
Stderr from the command:
sudo: no tty present and no askpass program specified
Logging in to the guest (through gui mode) and making sure the vagrant user was set up like so in /etc/sudoers with the fix :
vagrant ALL=(ALL) NOPASSWD: ALL
Run visudo as root in order to edit this file.

Resources