Run openvpn server at boot

This forum is for topics dealing with problems with software specifically in the ARMv6h repo.

Re: Run openvpn server at boot

Postby WarheadsSE » Mon Mar 09, 2015 5:46 pm

Dude, we're talking about running/enabling the systemd service.

Yes, when you manually call openvpn you need to specify the whole path.

"restorecon" seems to an item from SElinux. (http://fedoraproject.org/wiki/SELinux/restorecon)
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: Run openvpn server at boot

Postby Socaltom » Mon Mar 09, 2015 5:49 pm

$this->bbcode_second_pass_quote('gcp900', '
')
$this->bbcode_second_pass_code('', '[root@alarmpi ~]# openvpn server.conf
Options error: In [CMD-LINE]:1: Error opening configuration file: server.conf
Use --help for more information.')

So I don't know what's wrong. Anyway, it happens the same in all computers I have installed openvpn as a client. I have to specify the route of the conf files even being in the default route (/etc/openvpn).
[/code]


This is normal behaviour if you call openvpn from the command line. The proper command is

$this->bbcode_second_pass_code('', 'systemctl start openvpn@server.service')

This tells systemd to start openvpn and the location is set in the service file to /etc/openvpn
used to be owned by me
Pink Pogo V2, Black Pogo V3, Zyxel NAS 325 v1,
used to be Adminstrator for
Goflex net, Black V3, Black V2
Now I have a couple of raspberry pi ( 3+ and 4)
Socaltom
 
Posts: 571
Joined: Thu Apr 07, 2011 2:21 pm
Location: The left side

Re: Run openvpn server at boot

Postby gcp900 » Mon Mar 09, 2015 6:30 pm

$this->bbcode_second_pass_quote('', 'T')his is normal behaviour if you call openvpn from the command line. The proper command is

Code: Select all
systemctl start openvpn@server.service



This tells systemd to start openvpn and the location is set in the service file to /etc/openvpn


I cannot reboot the raspberry right now because I am not at home and I am accesing it through ssh, but when I type "systemctl start openvpn@server.service" I get this:

$this->bbcode_second_pass_code('', '[root@alarmpi ~]# systemctl status openvpn@server.service
* openvpn@server.service - OpenVPN connection to server
Loaded: loaded (/usr/lib/systemd/system/openvpn@.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2015-03-07 19:31:51 UTC; 1 day 22h ago
Process: 142 ExecStart=/usr/bin/openvpn --cd /etc/openvpn --config /etc/openvpn/%i.conf --daemon openvpn@%i --writepid /run/openvpn@%i.pid (code=exited, status=1/FAILURE)

Mar 07 19:31:51 alarmpi systemd[1]: openvpn@server.service: control process...=1
Mar 07 19:31:51 alarmpi systemd[1]: Failed to start OpenVPN connection to s...r.
Mar 07 19:31:51 alarmpi systemd[1]: Unit openvpn@server.service entered fai...e.
Mar 07 19:31:51 alarmpi systemd[1]: openvpn@server.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
')

It seems that the order for starting at boot is saved correctly but something fails. Can you see anything in the code??

$this->bbcode_second_pass_quote('', 'D')ude, we're talking about running/enabling the systemd service.

Yes, when you manually call openvpn you need to specify the whole path.

"restorecon" seems to an item from SElinux. (http://fedoraproject.org/wiki/SELinux/restorecon)


I followed the Fedora's guide and all the commands seemed to work except restorecon but it didn't work. I don't know how many important is that command.
gcp900
 
Posts: 9
Joined: Tue Mar 03, 2015 10:51 pm
Top

Re: Run openvpn server at boot

Postby Socaltom » Mon Mar 09, 2015 6:58 pm

The reason it probably didn'tt start is because when it starts it wants to write a pid file ( I think this is so it can tell if its already running). In your case, the PID file was already there, so it refused to try and start.

go to /run and delete any openvpn*.pid files and try again.

Tom
used to be owned by me
Pink Pogo V2, Black Pogo V3, Zyxel NAS 325 v1,
used to be Adminstrator for
Goflex net, Black V3, Black V2
Now I have a couple of raspberry pi ( 3+ and 4)
Socaltom
 
Posts: 571
Joined: Thu Apr 07, 2011 2:21 pm
Location: The left side

Re: Run openvpn server at boot

Postby gcp900 » Tue Mar 10, 2015 12:25 am

$this->bbcode_second_pass_code('', '[root@alarmpi ~]# cd /run
[root@alarmpi run]# ls
dbus dmeventd-server log mount sshd.pid tmpfiles.d user uuidd
dmeventd-client lock lvm nscd systemd udev utmp
')

That's what I have inside /run. I don't see any openvpn.pid file.

But now you've said that I remember that the first time I used systemctl with openvpn it worked in the following reboot, after that it didn't.
gcp900
 
Posts: 9
Joined: Tue Mar 03, 2015 10:51 pm

Re: Run openvpn server at boot

Postby Socaltom » Tue Mar 10, 2015 3:12 am

the only other thing I can think of is that for some reason it doesn't have rights to write the pid file.
do ls -l, in /run
It's "enabled" so it will try and start openvpn on a reboot.

Tom
used to be owned by me
Pink Pogo V2, Black Pogo V3, Zyxel NAS 325 v1,
used to be Adminstrator for
Goflex net, Black V3, Black V2
Now I have a couple of raspberry pi ( 3+ and 4)
Socaltom
 
Posts: 571
Joined: Thu Apr 07, 2011 2:21 pm
Location: The left side

Re: Run openvpn server at boot

Postby gcp900 » Tue Mar 17, 2015 12:18 pm

$this->bbcode_second_pass_code('', 'drwxr-xr-x 2 root root 60 Mar 7 19:31 dbus
prw------- 1 root root 0 Jan 1 1970 dmeventd-client
prw------- 1 root root 0 Jan 1 1970 dmeventd-server
drwxr-xr-x 5 root root 100 Jan 1 1970 lock
drwxr-xr-x 2 root root 40 Jan 1 1970 log
drwxr-xr-x 2 root root 60 Jan 1 1970 lvm
drwxr-xr-x 2 root root 40 Jan 1 1970 mount
drwxr-xr-x 2 root root 40 Jan 1 1970 nscd
-rw-r--r-- 1 root root 4 Mar 7 19:31 sshd.pid
drwxr-xr-x 15 root root 380 Mar 7 19:31 systemd
drwxr-xr-x 2 root root 60 Jan 1 1970 tmpfiles.d
drwxr-xr-x 7 root root 160 Mar 8 21:19 udev
drwxr-xr-x 3 root root 60 Mar 8 21:19 user
-rw-rw-r-- 1 root utmp 1920 Mar 17 12:15 utmp
drwxr-xr-x 2 uuidd uuidd 40 Jan 1 1970 uuidd')

That's what I've got. Do you see anything?
gcp900
 
Posts: 9
Joined: Tue Mar 03, 2015 10:51 pm

Re: Run openvpn server at boot

Postby gcp900 » Thu Mar 19, 2015 2:09 pm

Misteriously It is working right now...

Thank for the support!!
gcp900
 
Posts: 9
Joined: Tue Mar 03, 2015 10:51 pm

Previous

Return to ARMv6h

Who is online

Users browsing this forum: No registered users and 14 guests