Error: Could not find dependency Package[php5-cli] for Exec[download composer] - virtual-machine

I'm trying to deploy a Symfony2 project with this Vagrant virtual machine. The problem comes when I try to run the environment with vagrant up commandand it outputs the following:
$vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'debian-php-dev'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] -- 80 => 8080 (adapter 1)
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
[default] The guest additions on this VM do not match the installed version of
VirtualBox! In most cases this is fine, but in rare cases it can
cause things such as shared folders to not work properly. If you see
shared folder errors, please make sure the guest additions within the
virtual machine match the version of VirtualBox you have installed on
your host and reload your VM.
Guest Additions Version: 4.2.10
VirtualBox Version: 4.3
[default] Setting hostname...
[default] Configuring and enabling network interfaces...
[default] Exporting NFS shared folders...
Preparing to edit /etc/exports. Administrator privileges will be required...
Password:
[default] Mounting NFS shared folders...
[default] Mounting shared folders...
[default] -- /vagrant
[default] -- /tmp/vagrant-puppet-1/manifests
[default] -- /tmp/vagrant-puppet-1/modules-0
[default] Running provisioner: puppet...
Running Puppet with site.pp...
stdin: is not a tty
Error: Could not find dependency Package[php5-cli] for Exec[download composer]
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
puppet apply --hiera_config /vagrant/config/hiera.yaml --modulepath '/tmp/vagrant-puppet-1/modules-0' --manifestdir /tmp/vagrant-puppet-1/manifests --detailed-exitcodes /tmp/vagrant-puppet-1/manifests/site.pp || [ $? -eq 2 ]
Stdout from the command:
Stderr from the command:
stdin: is not a tty
Error: Could not find dependency Package[php5-cli] for Exec[download composer]

Try adding:
include php::cli
To the manifests / site.pp file just below include php::dev on line 70
The error is pretty self explanatory - the php5-cli package is missing from this particular Vagrant setup that you have chosen to use... adding it in is easy and everything else should work... as long as there are no other modules or packages missing.

Related

Packer error - sudo: no tty present and no askpass program specified

I'm been learning how to use Packer this week on my home lab where I have an ESXi 7 host.
I'm simply trying to deploy a Ubuntu 18.04 VM however at the end of the build I get this error in the packer console:
sudo: no tty present and no askpass program specified
This is what I have done.
Build.json
Preseed.cfg
variables.json
Command I run:
sudo packer build -var-file=variables.json build.json
In ESXi I see the VM build and complete and reboot and it gets an IP and I get a SSH prompt briefly before Packer deletes the VM after I see the above message.
This is the full error:
==> Ubuntu-18.04: Connecting to VNC over websocket...
==> Ubuntu-18.04: Waiting 10s for boot...
==> Ubuntu-18.04: Typing the boot command over VNC...
==> Ubuntu-18.04: Waiting for SSH to become available...
==> Ubuntu-18.04: Connected to SSH!
==> Ubuntu-18.04: Provisioning with shell script: /tmp/packer-shell382031289
==> Ubuntu-18.04: sudo: no tty present and no askpass program specified
==> Ubuntu-18.04: Provisioning step had errors: Running the cleanup provisioner, if present...
==> Ubuntu-18.04: Stopping virtual machine...
==> Ubuntu-18.04: Destroying virtual machine...
Build 'Ubuntu-18.04' errored after 8 minutes 21 seconds: Script exited with non-zero exit status: 1.Allowed exit codes are: [0]
==> Wait completed after 8 minutes 21 seconds
==> Some builds didn't complete successfully and had errors:
--> Ubuntu-18.04: Script exited with non-zero exit status: 1.Allowed exit codes are: [0]
==> Builds finished but no artifacts were created.
What am I doing wrong?
You need to tell sudo to read from stdin like this:
echo 'password' | sudo -S echo "I am groot"
This way your sudo command should work.

aerospike installed using vagrant is not working properly

I'm trying to install aerospike in my local by following the steps here.
mkdir ~/aerospike-vm && cd ~/aerospike-vm
vagrant init aerospike/aerospike-ce
vagrant up
All the above commands are successful and there are no error.
Below is the minimal log of the vagrant up command.
default: Successfully added box 'aerospike/aerospike-ce' (v4.5.0.5) for 'virtualbox'!
.
.
.
Going on, assuming VBoxService is correct...
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 5.2.12
default: VirtualBox Version: 6.0
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => /Users/rajkumar.natarajan/aerospike-vm
Below command clearly show only amc is running but not aerospike.
BOSM0001-RANATA:aerospike-vm rajkumar.natarajan$ vagrant ssh -c "sudo service aerospike status"
asd is stopped
Connection to 127.0.0.1 closed.
BOSM0001-RANATA:aerospike-vm rajkumar.natarajan$ vagrant ssh -c "sudo service amc status"
amc (pid 1458) is running...
Connection to 127.0.0.1 closed.
BOSM0001-RANATA:aerospike-vm rajkumar.natarajan$ vagrant ssh -c "sudo grep -i cake /var/log/aerospike/aerospike.log"
Connection to 127.0.0.1 closed.
Any idea what is wrong here.
Do: $ vagrant ssh
that will get you inside the shell. Then see why aerospike did not start.
First try:
$ sudo service aerospike start
then
$ sudo service aerospike status
If it is not running, go through /var/log/aerospike/aerospike.log and see what the log file is showing as the error.

Vagrant GuestAdditions issue

Host OS: Windows 10
Vagrant: 2.2.4
VirtualBox: 6.0.6 r130049
When I run vagrant up, it prints this error message:
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
setup
Stdout from the command:
Stderr from the command:
bash: line 4: setup: command not found
The machine can be booted normally and SSH from my host to Virtual machine is OK but the synced folder is not working. I know this may not be a critical issue but still feel frustrated as I use my host machine to develop codes and "sync" these codes so that they can be loaded in my virtual machine.
Any advice is highly appreciated.
ps: When I boot a full UI virtual machine (different from my above mentioned) from my VirtualBox directly, it seems OK to have a "sync" directory and the VBGuestAdditions can be installed without errors.
It is a bug in VirtualBox 6.0.6 and it still exists in 6.0.8. The solution is to downgrade your VirtualBox itself and the Guest Extensions to 6.0.4.

Vagrant can't connect to the VM

EDIT6: submitted an official path bug: https://github.com/mitchellh/vagrant/issues/7512
EDIT5: When I do vagrant destroy and vagrant up, everything works easily. But when I turn off the VM and turn it back on (you have to restart your PC some day), it won't work again. Either the sequence for vagrant up when the VM is created is bugged or VirtualBox is bugged. Destroying and rebuilding the VM is not the option, cause the DB migration and everything takes ~30 mins at least. Either way, DON'T USE VAGRANT ON WINDOWS 10.
EDIT4: I downgraded to Virtual Box 5.0.0.10, that fix the wrong path problem, but the error Command not in installer persists.
EDIT3: When I went into vagrant up --debug, I found out that it cycles. It gets into line
INFO subprocess: Starting process: ["C:/Program Files/Oracle/VirtualBox/VBoxManage.exe", "showvminfo", "8aaee3a3-806f-4
8ad-9928-91e2b7baba5d", "--machinereadable"]
and then it does
INFO subprocess: Command not in installer, restoring original environment...
The path to VM uses forwards slashes instead of backslashes. Is this a bug? Is there a way to manually set path to VM? I have put C:\Program Files\Oracle\VirtualBox in my PATH.
EDIT2: DON'T USE VAGRANT ON WINDOWS 10, it's bugged in many ways, also VM is not optimalized for win10 yet, you'll get bunch of issues that you won't be able to solve. Also tried the Otto from Hashicorp, not working either. Rip.
EDIT: okay, so when I do vagrant destroy and vagrant up, after 10 minutes of installation it works like a charm. But after I restart my PC or logout in any way, Vagrant is unable to connect to the VM, neither with a private key, nor with login/password. Is that a bug?
When I do vagrant up, VM starts properly, but Vagrant is unable to connect. All it says is Warning: Remote connection disconnect. Retrying...
When I try to connect via vagrant ssh, I get only ssh_exchange_identification: read: Connection reset by peer. When I check GUI of the VM, it is waiting for login, and when I login with defult login/password, it is working as intended, so the problem must be Vagrant not being able to connect to the VM.
I tried:
checking if my pc supports virtualization and checking if it is on
trying to connect with password instead of a key
configuring networking adapetrs
turning off firewall
clean reinstall
I am using Vagrant 1.8.1 and VirtualBox 5.0.20 on Windows 10.
This is my vagrant file:
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provider :virtualbox do |vb|
vb.memory = 2048
vb.gui = true
vb.cpus = 2
end
config.vm.network :private_network, type: "dhcp"
config.vbguest.auto_update = false
config.ssh.insert_key = false
config.vm.provision :shell, path: "bootstrap.sh"
end
[Edit 17/06/2016]
The problem should be resolved with Virtualbox 5.0.22.
https://www.virtualbox.org/wiki/Changelog
https://www.virtualbox.org/ticket/15412
[Original answer below]
In contrast to my earlier answer I now don't think that I encounter the same problem as you have described here. However I still think that you encounter a different variation the problem.
As of feedback received from Virtualbox development https://www.virtualbox.org/ticket/15412 I learned that Virtualbox 5.0.20 includes changes to the NAT Forwarding Rules to address other bugs. When a VM is saved and started again, Virtualbox now removes the network cable for 5 seconds. This is supposed to trigger the DHCP client to request a new lease. This information in turn is then used by Virtualbox to infer the IP address and NAT should work.
In my particular case I encounter this problem with Ubuntu 16.04 as guest VM whereas with Ubuntu 14.04 it works. This indicates to me that the DHClient on Ubuntu 14.04 does request a new lease after the cable was disconnected by Virtualbox whereas this is not the case with Ubuntu 16.04.
In order to verify that you encounter the same problem, I wonder if you could run the below test and let me know.
Login to the Trusty VM console (i.e. the one that you get displayed when you run the VM in the foreground)
Install 'arping' (sudo apt-get -y install arping)
Create the below script 'sendARP.sh'
#!/bin/bash
IFACE=$(ifconfig | grep 'Link encap:Ethernet' | awk '{print $1}')
IP=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
arping -c 1 -i $IFACE $IP
Make it an executable 'chmod +x sendARP.sh'
Save the Trusty VM (vagrant suspend)
Start your Trusty VM from saved state (vagrant up)
Login to the Trusty VM console (i.e. the one that you get displayed when you run the VM in the foreground)
Run the script 'sudo ./sendARP.sh'
Test whether you can connect via SSH from the remote location/ Virtualbox host
Bugs:
https://github.com/mitchellh/vagrant/issues/7306
https://www.virtualbox.org/ticket/15412

Changing vagrant ssh user creates permission erros

I'm trying to alter an Vagrant box I created for my office. Currently, like most boxes, running vagrant ssh logins me in as the vagrant user, but team members get frustrated having to use su - xxadmin to switch to our primary admin user.
In my Vagrantfile, I added: config.ssh.username = "xxadmin", but then I started receiving the common Vagrant error when running vagrant up:
[default] Configuring and enabling network interfaces...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/network/interfaces > /tmp/vagrant-network-interfaces
Stdout from the command:
Stderr from the command:
sudo: no tty present and no askpass program specified
and when running vagrant halt:
[default] Attempting graceful shutdown of VM...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
shutdown -h now
Stdout from the command:
Stderr from the command:
sudo: no tty present and no askpass program specified
What's going on here? Why would simply changing the ssh user create these errors? How do i find a solution forward?
Specs:
OS X Mavericks (host)
Vagrant 1.3.5
Virtualbox 4.3.2
Debian 7 Wheezy (vm client)
In your box, you need to modify your sudoers file by running visudo and adding the following:
Defaults !requiretty
I kept running into this error until I made sure that my user's NOPASSWD sudoers entry was not being squashed.