LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-09-2015, 12:25 PM   #1
joshuambenhase
LQ Newbie
 
Registered: Nov 2015
Posts: 11

Rep: Reputation: Disabled
OpenVPN on Raspbian


Hi All,

I am somewhat new to Linux and had a question on an issue that was resolved in another thread, could someone help?

Quote:
Originally Posted by akashi View Post
ferrari, I was finally able to solve this annoying problem with your guidance.

I investigated the boot log with 'journalctl -b' and noticed after the eth0 was up, the NTP service was started.

I simply edit my openvpn@.service and added 'After=ntp.service' and now OpenVPN is loading on every boot.

You can also add 'After=multi-user.target' instead as it works too.

Many thanks for your help.
I cannot figure out how to add this to the file and for it to work.
 
Old 11-09-2015, 01:50 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Different distribution.

Raspbian is still not using systemd (at least, not by default). What you read was a solution to make it work for systemd.
 
Old 11-09-2015, 01:53 PM   #3
joshuambenhase
LQ Newbie
 
Registered: Nov 2015
Posts: 11

Original Poster
Rep: Reputation: Disabled
Okay, do you happen to know a solution to my issue? It seems like the same issue I was having but apparently I cannot use this solution. When I reboot my Pi, OpenVPN is started but I cannot connect to it. I reload the service and it works perfect fine. It looks like it has something with the boot sequence of how the services are loaded. Could you help me? Thanks.
 
Old 11-09-2015, 01:56 PM   #4
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
What init system do you have on Raspian?
I would bet it's not systemd (assuming you are using a Raspberry Pi).

This is a good thing.
 
Old 11-09-2015, 02:00 PM   #5
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by JeremyBoden View Post
What init system do you have on Raspian?
I would bet it's not systemd (assuming you are using a Raspberry Pi).

This is a good thing.
I just reinstalled my Pi, it now uses systemd.
 
Old 11-09-2015, 02:06 PM   #6
joshuambenhase
LQ Newbie
 
Registered: Nov 2015
Posts: 11

Original Poster
Rep: Reputation: Disabled
Here's a newbie question like I am, but I am bad with terminology. How can I tell what init system I use?
 
Old 11-09-2015, 02:07 PM   #7
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by joshuambenhase View Post
I simply edit my openvpn@.service and added 'After=ntp.service' and now OpenVPN is loading on every boot.
These are indeed instructions for the systemd way of system initialization. First, check if your Pi uses this - it's sufficient to just type "systemctl" with no parameters. If the systemctl program exists and dumps out a list of services, you are in business. If not, you need different instructions.

Assuming systemd, you will have to find a file named openvps@.service, probably under /etc/systemd/system or elsewhere under /etc/systemd. Use a text editor to open this file and add the line After=ntp.service, probably in the [Unit] section (I am not so good at systemd yet).

This line simply means that the openvps service will be started when the network time service is running.

Last edited by berndbausch; 11-09-2015 at 02:10 PM.
 
Old 11-09-2015, 02:08 PM   #8
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by joshuambenhase View Post
Here's a newbie question like I am, but I am bad with terminology. How can I tell what init system I use?
Most people are newbies when it comes to systemd
Some are even allergic.
 
Old 11-09-2015, 02:16 PM   #9
joshuambenhase
LQ Newbie
 
Registered: Nov 2015
Posts: 11

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
These are indeed instructions for the systemd way of system initialization. First, check if your Pi uses this - it's sufficient to just type "systemctl" with no parameters. If the systemctl program exists and dumps out a list of services, you are in business. If not, you need different instructions.

Assuming systemd, you will have to find a file named openvps@.service, probably under /etc/systemd/system or elsewhere under /etc/systemd. Use a text editor to open this file and add the line After=ntp.service, probably in the [Unit] section (I am not so good at systemd yet).

This line simply means that the openvps service will be started when the network time service is running.
Is it openvps@.service OR openvpn@.service?

Last edited by joshuambenhase; 11-09-2015 at 02:17 PM.
 
Old 11-09-2015, 02:19 PM   #10
joshuambenhase
LQ Newbie
 
Registered: Nov 2015
Posts: 11

Original Poster
Rep: Reputation: Disabled
joshuambenhase@super-mario-bros [/etc/systemd] locate openvpn | grep service
/etc/systemd/system/multi-user.target.wants/openvpn.service
/lib/systemd/system/openvpn.service
/lib/systemd/system/openvpn@.service
/var/lib/systemd/deb-systemd-helper-enabled/openvpn.service.dsh-also
/var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/openvpn.service
 
Old 11-09-2015, 02:22 PM   #11
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by joshuambenhase View Post
Is it openvps@.service OR openvpn@.service?
Typo, sorry.
 
Old 11-09-2015, 02:24 PM   #12
joshuambenhase
LQ Newbie
 
Registered: Nov 2015
Posts: 11

Original Poster
Rep: Reputation: Disabled
So, in this file:

/lib/systemd/system/openvpn@.service

I just add this line? If so, is there a specific area to add it to? Do I have to comment anything else out?

Thanks.
 
Old 11-09-2015, 02:25 PM   #13
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
I think you copy /lib/systemd/system/openvpn@.service to /etc/systemd/system, then apply the above changes.
The files under /etc/systemd are for sysadmin modification, the ones under /lib should be left alone. /etc files override /lib files.
Don't listen to me but get a systemd tutorial or howto. I am sure Ubuntu or Debian have one, or the Arch Linux wiki, or the official Red Hat documentation.
 
Old 11-09-2015, 02:26 PM   #14
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by joshuambenhase View Post
is there a specific area to add it to?
The [Unit] section I would think.
 
Old 11-09-2015, 02:36 PM   #15
joshuambenhase
LQ Newbie
 
Registered: Nov 2015
Posts: 11

Original Poster
Rep: Reputation: Disabled
Thanks very much but this still did not work. I copied file from /lib to /etc and added the necessary in the Unit section. I rebooted the Pi and the OpenVPN is running but I cannot connect. I reload the service and it connects almost simultaneously.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Raspbian GNU/Linux upgrade from Wheezy to Raspbian Jessie 8 LXer Syndicated Linux News 1 06-09-2016 12:12 PM
OpenVPN assigning public & static IPs to pcs/devices behind an OpenVPN client dgonzalezh Linux - Networking 6 07-18-2010 09:50 AM
OpenVPN client has not default gateway when connect to OpenVPN server sailershen Linux - Security 3 03-04-2010 02:20 AM
How does OpenVPN Linux server issues IP and netmask to OpenVPN clients on Windows XP pssompura Linux - Networking 0 12-24-2009 02:42 AM
Error When converting Routing OpenVPN to bridge mode openvpn danmartinj Linux - Software 0 11-06-2009 09:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration