Fedora Linux Support Community & Resources Center
  #16  
Old 28th May 2012, 07:58 AM
au_squirrel Offline
Registered User
 
Join Date: Nov 2005
Location: Brisbane
Posts: 26
windows_7firefox
Re: F16 - how to get openvpn running as a daemon/service

If you have named your config file for the server "server.conf" then "systemctl start openvpn@server.service" works.

If you then enable it the correct syntax would be "systemctl enable openvpn@server.service"

Check your /etc/systemd/system/multi-user.target.wants directory for the sym link "openvpn@server.service" and let me know the results.
__________________
ASUS Sabertooth Z170
Intel i7
16G Ram
F 25 - Windows 10
Thermaltake Core P5 Open Case watercooled on the wall.
Reply With Quote
  #17  
Old 28th May 2012, 06:16 PM
Proxin Offline
Registered User
 
Join Date: May 2012
Location: United States
Posts: 23
linuxfirefox
Re: F16 - how to get openvpn running as a daemon/service

Quote:
Originally Posted by au_squirrel View Post
If you have named your config file for the server "server.conf" then "systemctl start openvpn@server.service" works.

If you then enable it the correct syntax would be "systemctl enable openvpn@server.service"

Check your /etc/systemd/system/multi-user.target.wants directory for the sym link "openvpn@server.service" and let me know the results.
When I do "systemctl enable openvpn@server.service" I get: "Failed to issue method call: No such file or directory"
Someone mentioned to me that this is because I am linking to a template instead of a target, or something similar...

What I have to do in order to not get an error is "systemctl enable openvpn@.service"... but then it does not start up automatically still. :/
Reply With Quote
  #18  
Old 28th May 2012, 08:57 PM
au_squirrel Offline
Registered User
 
Join Date: Nov 2005
Location: Brisbane
Posts: 26
windows_7firefox
Re: F16 - how to get openvpn running as a daemon/service

Did you check your /etc/systemd/system directory for the sym link "openvpn@server.service"? If that link is not there create it with the following command:

# ln -s /lib/systemd/system/openvpn\@.service /etc/systemd/system/openvpn\@server.service

When the link is present try "systemctl enable openvpn@server.service" and let me know how it goes.
__________________
ASUS Sabertooth Z170
Intel i7
16G Ram
F 25 - Windows 10
Thermaltake Core P5 Open Case watercooled on the wall.
Reply With Quote
  #19  
Old 29th May 2012, 06:48 AM
Proxin Offline
Registered User
 
Join Date: May 2012
Location: United States
Posts: 23
linuxfirefox
Re: F16 - how to get openvpn running as a daemon/service

I tried your command to link openvpn@.service to /etc/systemd/system/openvpn@server.service, as well as to /etc/systemd/system/multi-user.target.wants/openvpn@server.service, but I still get:
'Failed to issue method call: No such file or directory'

What directory is systemctl looking in? I thought it was surely /etc/systemd/system/multi-user.target.wants/
Reply With Quote
  #20  
Old 29th May 2012, 08:38 AM
au_squirrel Offline
Registered User
 
Join Date: Nov 2005
Location: Brisbane
Posts: 26
windows_7firefox
Re: F16 - how to get openvpn running as a daemon/service

From your last post I take it that you have the service running and as root or by sudo you can use the commands

#systemctl start openvpn@server.service
and
#systemctl stop openvpn@service.service

to control the openvpn server. When you try to enable the service:
#systemctl enable openvpn@server.service
you get the error ''Failed to issue method call: No such file or directory"

Please check the following:

Your /lib/systemd/system/ has the files

/lib/systemd/system/openvpn@server.service
/lib/systemd/system/openvpn@.service

Next #cat /lib/systemd/system/openvpn@server.service

It should look like this:

[Unit]
Description=OpenVPN Robust And Highly Flexible Tunneling Application On %I
After=syslog.target network.target

[Service]
Type=forking
PIDFile=/var/run/openvpn/%i.pid
ExecStart=/usr/sbin/openvpn --daemon --writepid /var/run/openvpn/%i.pid --cd /etc/openvpn/ --config %i.conf

[Install]
WantedBy=multi-user.target

If all is good then list your /etc/systemd/system/multi-user.target.wants directory
#ls /etc/systemd/system/multi-user.target.wants/open*

You should have the sym links
/etc/systemd/system/multi-user.target.wants/openvpn@server.service
/etc/systemd/system/multi-user.target.wants/openvpn@.service

Next check the /etc/systemd/system directory
#ls /etc/systemd/system/open*
You should have a sym link
/etc/systemd/system/openvpn@server.service

When you enable a service in systemctl, a link is created from the /etc/systemd/system/<releant service type> directory to the service definition in /lib/systemd/system/. I suspect that you are missing a file that the enable command is trying to link to.
__________________
ASUS Sabertooth Z170
Intel i7
16G Ram
F 25 - Windows 10
Thermaltake Core P5 Open Case watercooled on the wall.

Last edited by au_squirrel; 29th May 2012 at 08:45 AM. Reason: added an additional file check
Reply With Quote
  #21  
Old 30th May 2012, 07:55 AM
Proxin Offline
Registered User
 
Join Date: May 2012
Location: United States
Posts: 23
linuxfirefox
Re: F16 - how to get openvpn running as a daemon/service

Quote:
Originally Posted by au_squirrel View Post
From your last post I take it that you have the service running and as root or by sudo you can use the commands

#systemctl start openvpn@server.service
and
#systemctl stop openvpn@service.service

to control the openvpn server. When you try to enable the service:
#systemctl enable openvpn@server.service
you get the error ''Failed to issue method call: No such file or directory"

Please check the following:

Your /lib/systemd/system/ has the files

/lib/systemd/system/openvpn@server.service
/lib/systemd/system/openvpn@.service

Next #cat /lib/systemd/system/openvpn@server.service

It should look like this:

[Unit]
Description=OpenVPN Robust And Highly Flexible Tunneling Application On %I
After=syslog.target network.target

[Service]
Type=forking
PIDFile=/var/run/openvpn/%i.pid
ExecStart=/usr/sbin/openvpn --daemon --writepid /var/run/openvpn/%i.pid --cd /etc/openvpn/ --config %i.conf

[Install]
WantedBy=multi-user.target

If all is good then list your /etc/systemd/system/multi-user.target.wants directory
#ls /etc/systemd/system/multi-user.target.wants/open*

You should have the sym links
/etc/systemd/system/multi-user.target.wants/openvpn@server.service
/etc/systemd/system/multi-user.target.wants/openvpn@.service

Next check the /etc/systemd/system directory
#ls /etc/systemd/system/open*
You should have a sym link
/etc/systemd/system/openvpn@server.service

When you enable a service in systemctl, a link is created from the /etc/systemd/system/<releant service type> directory to the service definition in /lib/systemd/system/. I suspect that you are missing a file that the enable command is trying to link to.
I was missing /etc/systemd/system/multi-user.target.wants/openvpn@server.service; I had openvpn@.service, so I used ln -s with this file to make openvpn@server.service. However I still don't have it running on startup.
Upon a 'systemctl status openvpn@server.service', I see:
Code:
openvpn@server.service - OpenVPN Robust And Highly Flexible Tunneling Application On server
	  Loaded: loaded (/lib/systemd/system/openvpn@server.service; enabled)
	  Active: failed since Tue, 29 May 2012 23:49:01 -0700; 2min 2s ago
	 Process: 1141 ExecStart=/usr/sbin/openvpn --daemon --writepid /var/run/openvpn/%i.pid --cd /etc/openvpn/ --config %i.conf (code=exited, status=1/FAILURE)
	  CGroup: name=systemd:/system/openvpn@.service/server
I looked through your last post carefully but I had all the files in the right place already. Upon using the cat command like you mentioned, everything was the same as in your post.
I'm not sure what to make of this error..? It seems like everything should be in its right place.
Reply With Quote
  #22  
Old 31st May 2012, 08:16 AM
au_squirrel Offline
Registered User
 
Join Date: Nov 2005
Location: Brisbane
Posts: 26
windows_7firefox
Re: F16 - how to get openvpn running as a daemon/service

As I am not sure of your level of knowledge on FC16 and linux, this is a bit of a long post with some basic fault finding stuff you may already know. If so, my apologies.

Looking through your last post:

#systemctl status openvpn@server.service
openvpn@server.service - OpenVPN Robust And Highly Flexible Tunneling Application On server
Loaded: loaded (/lib/systemd/system/openvpn@server.service; enabled) <this tells me that systemctl believes the service in enabled and should be starting on startup>
Active: failed since Tue, 29 May 2012 23:49:01 -0700; 2min 2s ago <this is telling me it failed to load>
Process: 1141 ExecStart=/usr/sbin/openvpn --daemon --writepid /var/run/openvpn/%i.pid --cd /etc/openvpn/ --config %i.conf (code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/openvpn@.service/server

Looking at the command that ran and error message, the process has failed to initialise. Hence the error on the status. Had you manually started the openvpn server? If so run

#ps -e | grep openvpn

You should get a response like:
5694 ? 00:00:00 openvpn

This will confirm that the process is running before we run the systemctl status command. If it is not, you have a startup problem and the process is failing to start, hence your status error. You may wish to run the process in your command line to see what the error is. See the openvpn doco for that process.

The command response should have looked like

#systemctl status openvpn@server.service
openvpn@server.service - OpenVPN Robust And Highly Flexible Tunneling Application On server
Loaded: loaded (/lib/systemd/system/openvpn@.service; enabled)
Active: active (running) since Thu, 31 May 2012 16:54:52 +1000; 20s ago
Process: 5688 ExecStart=/usr/sbin/openvpn --daemon --writepid /var/run/openvpn/%i.pid --cd /etc/openvpn/ --config %i.conf (code=exited, status=0/SUCCESS)
Main PID: 5694 (openvpn)
CGroup: name=systemd:/system/openvpn@.service/server
â 5694 /usr/sbin/openvpn --daemon --writepid /var/run/openvpn/server.pid --cd /etc/openvpn/ --config server.conf

Check you have your server.conf file in the /etc/openvpn directory. Can you also post your /var/log/message file openvpn messages after having set your log verbosity to 6 in your server.conf after manually starting and stopping openvpn.

Just to check, you are running the systemctl command as sudo or root and openvpn is the owner and group for your server.conf file?
__________________
ASUS Sabertooth Z170
Intel i7
16G Ram
F 25 - Windows 10
Thermaltake Core P5 Open Case watercooled on the wall.

Last edited by au_squirrel; 31st May 2012 at 08:25 AM.
Reply With Quote
  #23  
Old 31st May 2012, 04:59 PM
Proxin Offline
Registered User
 
Join Date: May 2012
Location: United States
Posts: 23
linuxfirefox
Re: F16 - how to get openvpn running as a daemon/service

Quote:
Originally Posted by au_squirrel View Post
As I am not sure of your level of knowledge on FC16 and linux, this is a bit of a long post with some basic fault finding stuff you may already know. If so, my apologies.

Looking through your last post:

#systemctl status openvpn@server.service
openvpn@server.service - OpenVPN Robust And Highly Flexible Tunneling Application On server
Loaded: loaded (/lib/systemd/system/openvpn@server.service; enabled) <this tells me that systemctl believes the service in enabled and should be starting on startup>
Active: failed since Tue, 29 May 2012 23:49:01 -0700; 2min 2s ago <this is telling me it failed to load>
Process: 1141 ExecStart=/usr/sbin/openvpn --daemon --writepid /var/run/openvpn/%i.pid --cd /etc/openvpn/ --config %i.conf (code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/openvpn@.service/server

Looking at the command that ran and error message, the process has failed to initialise. Hence the error on the status. Had you manually started the openvpn server? If so run

#ps -e | grep openvpn

You should get a response like:
5694 ? 00:00:00 openvpn

This will confirm that the process is running before we run the systemctl status command. If it is not, you have a startup problem and the process is failing to start, hence your status error. You may wish to run the process in your command line to see what the error is. See the openvpn doco for that process.

The command response should have looked like

#systemctl status openvpn@server.service
openvpn@server.service - OpenVPN Robust And Highly Flexible Tunneling Application On server
Loaded: loaded (/lib/systemd/system/openvpn@.service; enabled)
Active: active (running) since Thu, 31 May 2012 16:54:52 +1000; 20s ago
Process: 5688 ExecStart=/usr/sbin/openvpn --daemon --writepid /var/run/openvpn/%i.pid --cd /etc/openvpn/ --config %i.conf (code=exited, status=0/SUCCESS)
Main PID: 5694 (openvpn)
CGroup: name=systemd:/system/openvpn@.service/server
â 5694 /usr/sbin/openvpn --daemon --writepid /var/run/openvpn/server.pid --cd /etc/openvpn/ --config server.conf

Check you have your server.conf file in the /etc/openvpn directory. Can you also post your /var/log/message file openvpn messages after having set your log verbosity to 6 in your server.conf after manually starting and stopping openvpn.

Just to check, you are running the systemctl command as sudo or root and openvpn is the owner and group for your server.conf file?
I tried "ps -e | grep openvpn" and didn't get any response actually... Terminal just went to an open prompt again. (Edit- the service was not started when I did this, now that it's started I see the output "2812 ? 00:00:13 openvpn")
In my /var/log/messages I found these at last boot:
Code:
May 31 08:51:11 Corellian dbus[1035]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.88" (uid=1000 pid=2272 comm="systemctl start openvpn@server.service ") interface="org.freedesktop.systemd1.Manager" member="StartUnit" error name="(unset)" requested_reply="0" destination="org.freedesktop.systemd1" (uid=0 pid=1 comm="/sbin/init ")
May 31 08:51:11 Corellian dbus-daemon[1035]: dbus[1035]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.88" (uid=1000 pid=2272 comm="systemctl start openvpn@server.service ") interface="org.freedesktop.systemd1.Manager" member="StartUnit" error name="(unset)" requested_reply="0" destination="org.freedesktop.systemd1" (uid=0 pid=1 comm="/sbin/init ")
And I am running systemctl as su. I'm not sure if openvpn is the owner and group for my server.conf file, upod looking at properties of it, it appears root is (but I have no option to change this; it's greyed out). Server.conf is located in /etc/openvpn/ as well...

Last edited by Proxin; 31st May 2012 at 06:53 PM.
Reply With Quote
  #24  
Old 1st June 2012, 08:37 AM
au_squirrel Offline
Registered User
 
Join Date: Nov 2005
Location: Brisbane
Posts: 26
windows_7firefox
Re: F16 - how to get openvpn running as a daemon/service

Ok, as you have seen, those messages are the startup of openvpn failing. This was also confirmed by the lack of response on the start of openvpn. Openvpn of FC16 runs as the user openvpn.

If you do a ls -l on /etc/openvpn it should look like:

]# ls -l /etc/openvpn/
total 28
drwxr-xr-x. 2 openvpn openvpn 4096 Dec 12 15:39 ccd
-rw-------. 1 openvpn openvpn 32 Jun 1 17:26 ipp.txt
drwxr-xr-x. 2 openvpn openvpn 4096 Dec 12 15:26 keys
-rw-------. 1 openvpn openvpn 232 Jun 1 17:31 openvpn-status.log
-rw-r--r--. 1 openvpn openvpn 10050 Dec 12 21:51 server.conf

To change the ownership of the files in the directory do

#chown openvpn.openvpn /etc/openvpn/*

If your server.conf was
-rw-------. 1 root root 10050 Dec 12 21:51 server.conf

the openvpn daemon could not read the server.conf file and would fail. Change the persmissions and then do

#systemctl start openvpn@server.service
#systemctl status openvpn@server.service

and post the results
__________________
ASUS Sabertooth Z170
Intel i7
16G Ram
F 25 - Windows 10
Thermaltake Core P5 Open Case watercooled on the wall.
Reply With Quote
  #25  
Old 1st June 2012, 09:30 AM
Proxin Offline
Registered User
 
Join Date: May 2012
Location: United States
Posts: 23
windows_7firefox
Re: F16 - how to get openvpn running as a daemon/service

Quote:
Originally Posted by au_squirrel View Post
Ok, as you have seen, those messages are the startup of openvpn failing. This was also confirmed by the lack of response on the start of openvpn. Openvpn of FC16 runs as the user openvpn.

If you do a ls -l on /etc/openvpn it should look like:

]# ls -l /etc/openvpn/
total 28
drwxr-xr-x. 2 openvpn openvpn 4096 Dec 12 15:39 ccd
-rw-------. 1 openvpn openvpn 32 Jun 1 17:26 ipp.txt
drwxr-xr-x. 2 openvpn openvpn 4096 Dec 12 15:26 keys
-rw-------. 1 openvpn openvpn 232 Jun 1 17:31 openvpn-status.log
-rw-r--r--. 1 openvpn openvpn 10050 Dec 12 21:51 server.conf

To change the ownership of the files in the directory do

#chown openvpn.openvpn /etc/openvpn/*

If your server.conf was
-rw-------. 1 root root 10050 Dec 12 21:51 server.conf

the openvpn daemon could not read the server.conf file and would fail. Change the persmissions and then do

#systemctl start openvpn@server.service
#systemctl status openvpn@server.service

and post the results
That makes perfect sense... I changed the ownership of all of the files in there to be owned by openvpn like you said. However the status is still failed after a reboot :/
"Rejected send messages, 2 matched rules" found in /var/log/messages, but I'm assuming it's the same problem as I had before...
Reply With Quote
  #26  
Old 1st June 2012, 09:38 AM
au_squirrel Offline
Registered User
 
Join Date: Nov 2005
Location: Brisbane
Posts: 26
windows_7firefox
Re: F16 - how to get openvpn running as a daemon/service

Have you set verb 6 in the server.conf?

If so do

#grep openvpn /var/log/messages and post the result

Another thought. Are you using NetworkManager?
__________________
ASUS Sabertooth Z170
Intel i7
16G Ram
F 25 - Windows 10
Thermaltake Core P5 Open Case watercooled on the wall.

Last edited by au_squirrel; 1st June 2012 at 12:15 PM.
Reply With Quote
  #27  
Old 4th June 2012, 05:13 AM
Proxin Offline
Registered User
 
Join Date: May 2012
Location: United States
Posts: 23
linuxfirefox
Re: F16 - how to get openvpn running as a daemon/service

Sorry for the delayed response-- I've been upgrading to F17 and had some issues I was fixing all day today.
Here is the /var/log/messages as you requested:

Code:
Jun  3 19:05:46 Corellian systemd[1]: openvpn@multi-user.service: control process exited, code=exited status=1
Jun  3 19:05:46 Corellian systemd[1]: Unit openvpn@multi-user.service entered failed state.
Jun  3 19:05:46 Corellian openvpn[745]: Socket Buffers: R=[212992->131072] S=[212992->131072]
Jun  3 19:05:46 Corellian openvpn[745]: TCP/UDP: Socket bind failed on local address 10.10.1.162:1194: Cannot assign requested address
Jun  3 19:05:46 Corellian openvpn[745]: Exiting
Jun  3 19:05:46 Corellian systemd[1]: openvpn@server.service: control process exited, code=exited status=1
Jun  3 19:05:46 Corellian systemd[1]: Unit openvpn@server.service entered failed state.
Jun  3 20:59:41 Corellian dbus-daemon[681]: dbus[681]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.40" (uid=1000 pid=1510 comm="systemctl start openvpn@server.service ") interface="org.freedesktop.systemd1.Manager" member="StartUnit" error name="(unset)" requested_reply="0" destination="org.freedesktop.systemd1" (uid=0 pid=1 comm="/usr/lib/systemd/systemd ")
Jun  3 20:59:41 Corellian dbus[681]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.40" (uid=1000 pid=1510 comm="systemctl start openvpn@server.service ") interface="org.freedesktop.systemd1.Manager" member="StartUnit" error name="(unset)" requested_reply="0" destination="org.freedesktop.systemd1" (uid=0 pid=1 comm="/usr/lib/systemd/systemd ")
It still works by using systemctl start openvpn@server.service though.
And yes, I am using NetworkManager I think. Whatever came bundled with Fedora 16 by default
Reply With Quote
  #28  
Old 4th June 2012, 08:02 AM
au_squirrel Offline
Registered User
 
Join Date: Nov 2005
Location: Brisbane
Posts: 26
windows_7firefox
Re: F16 - how to get openvpn running as a daemon/service

Ah ha. NetworkManager's default action is not to enable the network services until a user has logged in. Unless this has changed recently, you will not have a network stack for openvpn to connect to. Some processes do handle this, some don't. Openvpn doesn't hence the error messages at 19:05 (assumption is that is when you booted the box) and 20:59 after you had logged in and NetworkManager has started the network services.

If this box is a server, try disabling NetworkManager and using Network to start the interfaces. If you google "NetworkManager and services not starting on boot" you will find a few. To quote the opensuse doco:

21.1. Use Cases for NetworkManager¶

NetworkManager provides a sophisticated and intuitive user interface, which enables users to easily switch their network environment. However, NetworkManager is not a suitable solution in the following cases:

Your computer provides network services for other computers in your network, for example, it is a DHCP or DNS server.

Your computer is a Xen server or your system is a virtual system inside Xen.

Try disabling NetworkManager and enable Network. Then see if your openvpn server starts at reboot.
__________________
ASUS Sabertooth Z170
Intel i7
16G Ram
F 25 - Windows 10
Thermaltake Core P5 Open Case watercooled on the wall.
Reply With Quote
  #29  
Old 4th June 2012, 08:28 AM
Proxin Offline
Registered User
 
Join Date: May 2012
Location: United States
Posts: 23
windows_7firefox
Re: F16 - how to get openvpn running as a daemon/service

Quote:
Originally Posted by au_squirrel View Post
Try disabling NetworkManager and enable Network. Then see if your openvpn server starts at reboot.
I can see why they'd do that.. but it puts extra frustration on my end

To disable NetworkManager I do
Code:
systemctl stop NetworkManager.service
But to enable Network, what should I do? Can you recommend to me some commands to run to disable NetworkManager and instead use Network?
Reply With Quote
  #30  
Old 4th June 2012, 08:46 AM
au_squirrel Offline
Registered User
 
Join Date: Nov 2005
Location: Brisbane
Posts: 26
windows_7firefox
Re: F16 - how to get openvpn running as a daemon/service

See http://arstechnica.com/civis/viewtop...f=16&t=1163023 for the basics of how to disable NetworkManager. Just remember you will need to install the "old" system-config-network.
__________________
ASUS Sabertooth Z170
Intel i7
16G Ram
F 25 - Windows 10
Thermaltake Core P5 Open Case watercooled on the wall.
Reply With Quote
Reply

Tags
daemon or service , f16 , openvpn , running

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenVPN service is dead FSLLL Fedora 13 Development Branch 7 21st May 2010 10:13 AM
[SOLVED] openvpn service is dead vofka Servers & Networking 1 17th April 2010 02:08 PM
OpenVPN service is dead litikiti Servers & Networking 5 18th January 2010 02:10 PM
Why my OpenVPN service can't start up ? yu xintian Using Fedora 1 24th November 2009 11:16 AM
OpenVPN service failure madplague Servers & Networking 0 31st July 2004 03:11 AM


Current GMT-time: 20:42 (Sunday, 22-10-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat