Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenVPN won't start on CentOS 7 #73

Closed
poflynn opened this issue Jan 7, 2016 · 3 comments
Closed

OpenVPN won't start on CentOS 7 #73

poflynn opened this issue Jan 7, 2016 · 3 comments
Assignees
Milestone

Comments

@poflynn
Copy link

poflynn commented Jan 7, 2016

If I switch to CentOS 7 (by changing to "config.vm.box = 'centos-7.2'" in the Vagrantfile) the server machine builds fine but the client machine fails with the error below. It is failing to start the OpenVPN service as it is trying to start openvpn@server.service which in turn causes /etc/systemd/system/multi-user.target.wants/openvpn@server.service file to look for a 'server.conf' OpenVPN config file but none exists as instead the recipe created a 'client.conf' file on the client machine.

I changed the references to "openvpn@server.service" in service.rb file to "openvpn@client.service" and was able to vagrant up the client machine successfully but that in turn breaks the server machine as service.rb is shared across both machines and in the server we create a 'server.conf' file for OpenVPN.

So, definitely a minor thing but I thought it was very cool of you to provide a working Vagrantfile and as it includes a lot of code to work on RHEL platforms I figured I'd try it on CentOS. Also this is basically the last step so fix this and we have RHEL working which would be nice. I'm not entirely certain how best to fix this but am happy to help out if I can.

Thanks all for the awesome recipe,

Paul

==> client: Recipe: openvpn::install
==> client:   * yum_package[openvpn] action install
==> client: [2016-01-07T17:25:43+00:00] INFO: yum_package[openvpn] installing openvpn-2.3.9-1.el7 from epel repository
==> client: [2016-01-07T17:25:46+00:00] INFO: yum_package[openvpn] installed openvpn at 2.3.9-1.el7
==> client: 
==> client:     - install version 2.3.9-1.el7 of package openvpn
==> client: Recipe: openvpn::service
==> client:   * link[/etc/systemd/system/multi-user.target.wants/openvpn@server.service] action create[2016-01-07T17:25:46+00:00] INFO: link[/etc/systemd/system/multi-user.target.wants/openvpn@server.service] created
==> client: 
==> client:     - create symlink at /etc/systemd/system/multi-user.target.wants/openvpn@server.service to /usr/lib/systemd/system/openvpn@.service
==> client:   * service[openvpn] action enable
==> client:  (up to date)
==> client:   * service[openvpn] action start
==> client: 
==> client:     
==> client:     ================================================================================
==> client:     Error executing action `start` on resource 'service[openvpn]'
==> client:     ================================================================================
==> client:     
==> client:     Mixlib::ShellOut::ShellCommandFailed
==> client:     ------------------------------------
==> client:     Expected process to exit with [0], but received '1'
==> client:     ---- Begin output of /bin/systemctl start openvpn@server.service ----
==> client:     STDOUT: 
==> client:     STDERR: Job for openvpn@server.service failed because the control process exited with error code. See "systemctl status openvpn@server.service" and "journalctl -xe" for details.
==> client:     ---- End output of /bin/systemctl start openvpn@server.service ----
==> client:     Ran /bin/systemctl start openvpn@server.service returned 1
==> client:     
==> client:     Resource Declaration:
==> client:     ---------------------
==> client:     # In /var/chef/cache/cookbooks/openvpn/recipes/service.rb
==> client:     
==> client:      39: service 'openvpn' do
==> client:      40:   service_name service_name
==> client:      41:   action [:enable, :start]
==> client:      42: end
==> client:     
==> client:     Compiled Resource:
==> client:     ------------------
==> client:     # Declared in /var/chef/cache/cookbooks/openvpn/recipes/service.rb:39:in `from_file'
==> client:     
==> client:     service("openvpn") do
==> client:       action [:enable, :start]
==> client:       supports {:restart=>nil, :reload=>nil, :status=>nil}
==> client:       retries 0
==> client:       retry_delay 2
==> client:       default_guard_interpreter :default
==> client:       service_name "openvpn@server.service"
==> client:       enabled true
==> client:       pattern "openvpn"
==> client:       declared_type :service
==> client:       cookbook_name "openvpn"
==> client:       recipe_name "service"
==> client:     end
==> client:     
==> client: [2016-01-07T17:25:46+00:00] INFO: Running queued delayed notifications before re-raising exception
==> client: 
==> client: Running handlers:
==> client: [2016-01-07T17:25:46+00:00] ERROR: Running exception handlers
==> client: Running handlers complete
==> client: [2016-01-07T17:25:46+00:00] ERROR: Exception handlers complete
==> client: Chef Client failed. 7 resources updated in 23 seconds
==> client: [2016-01-07T17:25:46+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> client: [2016-01-07T17:25:46+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
==> client: [2016-01-07T17:25:46+00:00] ERROR: service[openvpn] (openvpn::service line 39) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
==> client: ---- Begin output of /bin/systemctl start openvpn@server.service ----
==> client: STDOUT: 
==> client: STDERR: Job for openvpn@server.service failed because the control process exited with error code. See "systemctl status openvpn@server.service" and "journalctl -xe" for details.
==> client: ---- End output of /bin/systemctl start openvpn@server.service ----
==> client: Ran /bin/systemctl start openvpn@server.service returned 1
==> client: [2016-01-07T17:25:47+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
@flaccid
Copy link
Contributor

flaccid commented Feb 21, 2016

Thanks @poflynn, I have raised #78 so we can get this covered with tk and am testing a fix now.

@flaccid
Copy link
Contributor

flaccid commented Feb 21, 2016

Solution tests ok however I am unsure why I have to vagrant up the server, then the client instead of just doing vagrant up. Not sure if this is a change in vagrant or a bug because the server VM appears to skip chef provisioning and then run provisioners from the client.

==> server: Thank you for installing Chef!
==> server: Running provisioner: shell...
    server: Running: /var/folders/sx/ht6gznq979v5r725sqt7_p617p38sz/T/vagrant-shell20160221-58577-hfqmrp.rb
==> server: Retrieving insecure key from GitHub...
==> server: Writing insecure key to /home/vagrant/.ssh/id_rsa
==> server: Running provisioner: shell...
    server: Running: /var/folders/sx/ht6gznq979v5r725sqt7_p617p38sz/T/vagrant-shell20160221-58577-2hsu47.sh
==> server: Copying ovpn profile to /home/vagrant/
==> server: Warning: Permanently added '172.19.18.8' (ECDSA) to the list of known hosts.
==> server: cp: cannot stat ‘/etc/openvpn/keys/test.tar.gz’: No such file or directory
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

I'll close for now but if this is happening for everyone we'll need to work it out in a new issue.

@flaccid flaccid closed this as completed Feb 21, 2016
@lock
Copy link

lock bot commented Jul 24, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants