drupal-vm icon indicating copy to clipboard operation
drupal-vm copied to clipboard

Task firewall config does not complete

Open carnnia opened this issue 10 years ago • 44 comments

Fix

If you're on Windows and you cloned Drupal VM in a way that resulted in some files getting Windows line endings, it could be the line endings cause issues when you try to run vagrant up or vagrant provision. A quick fix:

  1. Find /drupalvm/provisioning/roles/geerlingguy.firewall/templates/firewall.j2
  2. Edit it in notepad++ and convert it to Unix format (LF)
  3. Edit > EOL Conversion > UNIX Format
  4. Save the file
  5. Run vagrant up or vagrant provision again.

Original Issue

the drupal folder that the documentation refers to is not generated. the synced folder that i put in config.yml is empty. the error printed to screen is:

TASK [geerlingguy.firewall : Ensure the firewall is enabled and will start on boot.] *** fatal: [drupalvm]: FAILED! => {"changed": false, "failed": true, "msg": "Error when trying to enable firewall: rc=1 firewall.service is not a native service, redirecting to systemd-sysv-install\nExecuting /lib/systemd/systemd-sysv-install enable firewall\nupdate-rc.d: error: firewall Default-Start contains no runlevels, aborting.\n"}

carnnia avatar Jul 26 '16 17:07 carnnia

my host is windows7. here is the put put of vagrant up:

ccarnnia@CST328169 MINGW64 /d/drupal-vm (master)
$ vagrant up
Bringing machine 'drupalvm' up with 'virtualbox' provider...
==> drupalvm: Cloning VM...
==> drupalvm: Matching MAC address for NAT networking...
==> drupalvm: Checking if box 'geerlingguy/ubuntu1604' is up to date...
==> drupalvm: Setting the name of the VM: drupalvm.dev
==> drupalvm: Clearing any previously set network interfaces...
==> drupalvm: Preparing network interfaces based on configuration...
    drupalvm: Adapter 1: nat
    drupalvm: Adapter 2: hostonly
==> drupalvm: Forwarding ports...
    drupalvm: 22 (guest) => 2222 (host) (adapter 1)
==> drupalvm: Running 'pre-boot' VM customizations...
==> drupalvm: Booting VM...
==> drupalvm: Waiting for machine to boot. This may take a few minutes...
    drupalvm: SSH address: 127.0.0.1:2222
    drupalvm: SSH username: vagrant
    drupalvm: SSH auth method: private key
==> drupalvm: Machine booted and ready!
==> drupalvm: Checking for guest additions in VM...
==> drupalvm: Setting hostname...
==> drupalvm: Configuring and enabling network interfaces...
==> drupalvm: Mounting shared folders...
    drupalvm: /vagrant => D:/drupal-vm
    drupalvm: /var/www/drupalvm => D:/drupal-vm/data
==> drupalvm: Running provisioner: ansible_local...
    drupalvm: Installing Ansible...
    drupalvm: Running ansible-playbook...

PLAY [all] *********************************************************************

TASK [setup] *******************************************************************
ok: [drupalvm]

TASK [Define config_dir.] ******************************************************
skipping: [drupalvm]

TASK [include_vars] ************************************************************
ok: [drupalvm] => (item=/vagrant/config.yml)

TASK [include] *****************************************************************
included: /vagrant/provisioning/tasks/init-debian.yml for drupalvm

TASK [Update apt cache if needed.] *********************************************
ok: [drupalvm]

TASK [Get software for Python-based control.] **********************************
changed: [drupalvm] => (item=[u'curl', u'python-apt', u'python-pycurl', u'build-essential', u'sudo', u'unzip'])

TASK [Disable the ufw firewall (since we use a simple iptables firewall).] *****
changed: [drupalvm]

TASK [Add repository for Apache 2.4 on Ubuntu 12.] *****************************
skipping: [drupalvm]

TASK [Add repository for PHP 5.5.] *********************************************
skipping: [drupalvm]

TASK [Add repository for PHP 5.6.] *********************************************
skipping: [drupalvm]

TASK [Add repository for PHP 7.0.] *********************************************
skipping: [drupalvm]

TASK [Define php_xhprof_html_dir.] *********************************************
skipping: [drupalvm]

TASK [include] *****************************************************************
skipping: [drupalvm]

TASK [Run configured pre-provision shell scripts.] *****************************

TASK [Run configured pre-provision ansible task files.] ************************

TASK [Set the PHP webserver daemon correctly when nginx is in use.] ************
skipping: [drupalvm]

TASK [geerlingguy.repo-remi : Install remi repo.] ******************************
skipping: [drupalvm]

TASK [geerlingguy.repo-remi : Import remi GPG key.] ****************************
skipping: [drupalvm]

TASK [geerlingguy.firewall : Ensure iptables is installed (RedHat).] ***********
skipping: [drupalvm]

TASK [geerlingguy.firewall : Ensure iptables is installed (Debian).] ***********
ok: [drupalvm]

TASK [geerlingguy.firewall : Flush iptables the first time playbook runs.] *****
changed: [drupalvm]

TASK [geerlingguy.firewall : Copy firewall script into place.] *****************
changed: [drupalvm]

TASK [geerlingguy.firewall : Copy firewall init script into place.] ************
changed: [drupalvm]

**TASK [geerlingguy.firewall : Ensure the firewall is enabled and will start on boot.] ***
fatal: [drupalvm]: FAILED! => {"changed": false, "failed": true, "msg": "Error when trying to enable firewall: rc=1 firewall.service is not a native service, redirecting to systemd-sysv-install\nExecuting /lib/systemd/systemd-sysv-install enable firewall\nupdate-rc.d: error: firewall Default-Start contains no runlevels, aborting.\n"}**

NO MORE HOSTS LEFT *************************************************************

RUNNING HANDLER [geerlingguy.firewall : restart firewall] **********************
        to retry, use: --limit @/vagrant/provisioning/playbook.retry

PLAY RECAP *********************************************************************
drupalvm                   : ok=10   changed=5    unreachable=0    failed=1

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

carnnia avatar Jul 26 '16 18:07 carnnia

@carnnia

the drupal folder that the documentation refers to is not generated.

The part of Drupal VM that builds the drupal site via composer doesn't run until a little later in the build process.

firewall Default-Start contains no runlevels, aborting.

Can I ask what version of Drupal VM are you running, and also what version of Vagrant and VirtualBox is installed? Also, can you give the output of vagrant box list?

One note—I haven't tested Drupal VM on Windows 7 in at least a year, and I'm not sure if anyone else using it on windows is still on 7 (I think there are some users... but everyone who helps with bugfixes/testing on Windows is at least on 8, mostly on 10), so I can't help much if it turns out there's something related to Windows 7...

geerlingguy avatar Jul 26 '16 19:07 geerlingguy

i am now trying to install it on my ubuntu machine. i'll keep you informed. back to windows: Drupal VM: the latest, I guess. I just cloned the repo. VirtualBox: Version 5.0.26 r108824 Vagrant: Vagrant 1.8.5 List of boxes: ccarnnia@CST328169 MINGW64 /d/drupal-vm (master) $ vagrant box list geerlingguy/ubuntu1604 (virtualbox, 1.0.4) precise32 (virtualbox, 0)

carnnia avatar Jul 26 '16 19:07 carnnia

Okay, thanks, very helpful!

Also, does anything in this issue help? https://github.com/geerlingguy/drupal-vm/issues/695

Maybe try vagrant provision to see if the second run through works?

geerlingguy avatar Jul 26 '16 22:07 geerlingguy

I have the same issue on win7 64 pro. Tried with both bento/ubuntu-14.04 and geerlingguy/ubuntu1604.

Drupal VM: latest (git clone) Vagrant: 1.8.4 VirtualBox: Version 5.0.20 r106931

$ vagrant plugin list
vagrant-hostsupdater (1.0.2)
vagrant-share (1.1.5, system)
vagrant-vbguest (0.12.0)
vagrant-winnfsd (1.2.1)
$ vagrant box list
bento/ubuntu-14.04     (virtualbox, 2.2.7)
geerlingguy/ubuntu1604 (virtualbox, 1.0.4)
miya0001/vccw          (virtualbox, 2.19.0)
ubuntu/trusty32        (virtualbox, 20160519.0.2)
ubuntu/trusty64        (virtualbox, 20160627.0.1)

nikosath avatar Jul 30 '16 19:07 nikosath

@oliperas - Can you try with geerlingguy/ubuntu1404? There are some differences between that box and the bento box.

geerlingguy avatar Aug 10 '16 02:08 geerlingguy

Tried with geerlingguy/ubuntu1404

TASK [geerlingguy.firewall : Ensure the firewall is enabled and will start on bo                                               ot.] ***
fatal: [drupalvm]: FAILED! => {"changed": false, "failed": true, "msg": "failed                                                determining service state, possible typo of service name?"}

NO MORE HOSTS LEFT *************************************************************

RUNNING HANDLER [geerlingguy.firewall : restart firewall] **********************
        to retry, use: --limit @/vagrant/provisioning/playbook.retry

PLAY RECAP *********************************************************************
drupalvm                   : ok=9    changed=6    unreachable=0    failed=1

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

nikosath avatar Aug 10 '16 05:08 nikosath

@oliperas - Just to confirm, are you on windows, and what version of Windows if so? Also, what version of Vagrant are you running (run vagrant --version).

geerlingguy avatar Aug 10 '16 11:08 geerlingguy

Facing same problem..

TASK [geerlingguy.firewall : Ensure the firewall is enabled and will start on boot.] ***
fatal: [drupalvm]: FAILED! => {"changed": false, "failed": true, "msg": "failed determining service state, possible typo of service name?"}

NO MORE HOSTS LEFT *************************************************************

RUNNING HANDLER [geerlingguy.firewall : restart firewall] **********************
to retry, use: --limit @/vagrant/provisioning/playbook.retry

PLAY RECAP *********************************************************************
drupalvm : ok=9 changed=6 unreachable=0 failed=1

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

Here are few details for your information.

OS: windows 7 Enterprise Service Pack1. Virtaul Box version: 5.1.2 vagrant version: 1.8.5 vagrant boxlist: geerlingguy/ubuntu1404 (Virtualbox 1.1.3) vagrant plugin list: vagrant -share (1.1.5, system) vagrant -winnfsd (1.3.0)

suryatp avatar Aug 15 '16 17:08 suryatp

I'm closing #695 and moving that conversation into this thread. For anyone having this problem, please post the following:

  1. Exact OS version you're using (e.g. Windows 7, 8, 10).
  2. Which terminal/CLI you're using (e.g. cmder, cygwin, git bash, powershell).
  3. The step where the build fails.
  4. Any config.yml customizations (especially which vagrant_box you're using).
  5. Versions of Vagrant, VirtualBox and Drupal VM being used.

geerlingguy avatar Aug 16 '16 19:08 geerlingguy

Brock, just FYI. I shall post it as a new ticket.

Best regards, Surya Paruchuri

On Aug 16, 2016 3:44 PM, "Jeff Geerling" [email protected] wrote:

I'm closing #695 https://github.com/geerlingguy/drupal-vm/issues/695 and moving that conversation into this thread. For anyone having this problem, please post the following:

  1. Exact OS version you're using (e.g. Windows 7, 8, 10)
  2. The step where the build fails.
  3. Any config.yml customizations (especially which vagrant_box you're using).
  4. Versions of Vagrant, VirtualBox and Drupal VM being used.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/geerlingguy/drupal-vm/issues/829#issuecomment-240215453, or mute the thread https://github.com/notifications/unsubscribe-auth/AT6XOob6ifV6bUL27ZSLeFPpptPKLul6ks5qghMxgaJpZM4JVYO- .

suryatp avatar Aug 16 '16 20:08 suryatp

So, using the following environment, all fresh/brand new installs, I can't replicate the issue:

  1. Windows 10
  2. Cygwin
  3. N/A - success with all defaults
  4. No config.yml customizations (using all defaults)
  5. Vagrant 1.8.5, VirtualBox 5.1.2, Drupal VM 3.2.0

geerlingguy avatar Aug 16 '16 20:08 geerlingguy

So do I have to move-on to windows 10 to install drupalvm? Cannot I run it on windows 7 and yes I think I am using a custom config.yml file.

Best regards, Surya Paruchuri

On Aug 16, 2016 4:17 PM, "Jeff Geerling" [email protected] wrote:

So, using the following environment, all fresh/brand new installs, I can't replicate the issue:

  1. Windows 10
  2. Cygwin
  3. N/A - success with all defaults
  4. No config.yml customizations (using all defaults)
  5. Vagrant 1.8.5, VirtualBox 5.1.2, Drupal VM 3.2.0

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/geerlingguy/drupal-vm/issues/829#issuecomment-240224295, or mute the thread https://github.com/notifications/unsubscribe-auth/AT6XOkznezKgyhESTCrmUIYjmCRnkIiZks5qghrEgaJpZM4JVYO- .

suryatp avatar Aug 16 '16 20:08 suryatp

OK so seems I hadn't done a 'sudo apt-get upgrade' & 'sudo apt-get dist-upgrade' on my linux laptop for a while - just done that now and it's running through fine.

So perhaps that's the issue on yours, can't remember how cygwin works, seem to remember it runs linux within windows so perhaps the version of linux it's running needs some updates.

stephenpurkiss avatar Aug 16 '16 20:08 stephenpurkiss

@suryatp - Drupal VM should work on Windows 7... but I don't have access to any computers with that old a version of Windows, and I only know one person with quick access to a Windows 8 laptop, so I can only reliably test things in a Windows 10 environment.

geerlingguy avatar Aug 16 '16 20:08 geerlingguy

I'm happy to help test Windows 7. However, I can't recreate the problem. Here are my stats:

  1. OS: Windows 7 Professional, service pack 1
  2. Shell: Babun (wrapper around Cygwin, I believe)
  3. NA (doesn't fail)
  4. No significant config.yml changes from the default (interestingly, I happen to be using the exact same config.yml as suryatp, who posted above and is experiencing the problem)
  5. Vagrant 1.8.4, Virtual Box 5.0.24, DrupalVM cloned from Github on July 31

Like I said, it's working for me. But if anyone wants me to try anything to recreate it, just let me know and I'll give it a shot.

brockfanning avatar Aug 16 '16 21:08 brockfanning

I have solved this issue by adding: sudo: yes

behind task

  • name: Ensure the firewall is enabled and will start on boot of file povisioning/roles/geerlingguy.firewall/tasks/main.yml

stephanebelazouz avatar Aug 17 '16 17:08 stephanebelazouz

@stephanebelazouz - That's really strange, because the entire playbook should be run under the sudo user, because of the line become: yes at the top of the main playbook: https://github.com/geerlingguy/drupal-vm/blob/master/provisioning/playbook.yml#L3

When you add the sudo: yes do you get any warnings? Also, if you take it out and run vagrant provision again does it still succeed?

geerlingguy avatar Aug 17 '16 18:08 geerlingguy

You right, it does not make sense because of the become: yes... So after another test with fresh install it seems to work perfectly.

Thx for your job and your time.

stephanebelazouz avatar Aug 17 '16 18:08 stephanebelazouz

Exact OS version you're using: Windows 7 Pro SP1 Which terminal/CLI you're using: Cmder 160724 stable The step where the build fails: "TASK [geerlingguy.firewall : Ensure the firewall is enabled and will start on boot.]" Any config.yml customizations (especially which vagrant_box you're using): Drupal core version 7, hostname , and machine_name updates. Versions of Vagrant, VirtualBox and Drupal VM being used:

  • Vagrant 1.8.5
  • VirtualBox Version 5.0.26 r108824
  • Drupal VM up to commit 84e0ed145817ee7acfe7f0bd04af917bca8dedb9 (git cloned from the main GitHub page)

The error I run into specifically is

fatal: [drupalvm]: FAILED! => {"changed": false, "failed": true, "msg": "Job for firewall.service failed because the control process exited with error code. See "systemctl status firewall.service" and "journalctl -xe" for details.\n"}

jpmc avatar Aug 17 '16 19:08 jpmc