I am using the vpnserver.service supplied from github. The paths are for debian som I changed them to suit xubuntu.
The vpnserver starts if I call it manually but when systemd tries to start it it fails. vpnserver complains about hamcore.se2
That file is in the same directory as vpnserver.
How do I make it find the file when starting as systemd?
Problem starting vpnserver with systemd on xubuntu
-
- Posts: 102
- Joined: Sat Jun 20, 2015 9:40 am
-
- Posts: 336
- Joined: Sat Aug 15, 2015 7:41 pm
Re: Problem starting vpnserver with systemd on xubuntu
Are you using the same init script as on this page?
https://www.softether.org/4-docs/1-manu ... igurations
Also instead of:
./vpnserver start
try:
./vpnserver execsvc
https://www.softether.org/4-docs/1-manu ... igurations
Also instead of:
./vpnserver start
try:
./vpnserver execsvc
-
- Posts: 102
- Joined: Sat Jun 20, 2015 9:40 am
Re: Problem starting vpnserver with systemd on xubuntu
No, that is for systemV/upstart. I thought, since a systemd script is now provided, it would be better to use systemd for a newer Ubuntu distro. This is the scrip:
[Unit]
Description=SoftEther VPN Server
After=network.target auditd.service
ConditionPathExists=!/opt/vpnserver/do_not_run
[Service]
Type=forking
EnvironmentFile=-/opt/vpnserver
ExecStart=/opt/vpnserver/vpnserver start
ExecStop=/opt/vpnserver/vpnserver stop
KillMode=process
Restart=on-failure
# Hardening
PrivateTmp=yes
ProtectHome=yes
ProtectSystem=full
ReadOnlyDirectories=/
ReadWriteDirectories=-/opt/vpnserver
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYS_ADMIN CAP_SETUID
[Install]
WantedBy=multi-user.target
I have changed the path to /usr/local instead of /opt.
I am planing to add a WorkingDirectory= to se if that helps.
[Unit]
Description=SoftEther VPN Server
After=network.target auditd.service
ConditionPathExists=!/opt/vpnserver/do_not_run
[Service]
Type=forking
EnvironmentFile=-/opt/vpnserver
ExecStart=/opt/vpnserver/vpnserver start
ExecStop=/opt/vpnserver/vpnserver stop
KillMode=process
Restart=on-failure
# Hardening
PrivateTmp=yes
ProtectHome=yes
ProtectSystem=full
ReadOnlyDirectories=/
ReadWriteDirectories=-/opt/vpnserver
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYS_ADMIN CAP_SETUID
[Install]
WantedBy=multi-user.target
I have changed the path to /usr/local instead of /opt.
I am planing to add a WorkingDirectory= to se if that helps.
-
- Posts: 336
- Joined: Sat Aug 15, 2015 7:41 pm
Re: Problem starting vpnserver with systemd on xubuntu
Your script looks fine.
How did you obtain SoftEther. Did you compile the source yourself or downloaded the binaries?
How did you obtain SoftEther. Did you compile the source yourself or downloaded the binaries?
-
- Posts: 102
- Joined: Sat Jun 20, 2015 9:40 am
Solved: Problem starting vpnserver with systemd on xubuntu
I was unable to compile the source downloaded from softether.com. And I don think there is binarys to download? ppa:s are old. Instead i used git clone and compiled from there. Thats where I got the sytemd script.
This was the error log:
jan 04 22:17:32 berto vpnserver[1982]: -- Alert: SoftEther VPN Kernel --
jan 04 22:17:32 berto vpnserver[1982]: Fatal Error: The file "hamcore.se2" is missing or broken.
jan 04 22:17:32 berto vpnserver[1982]: Please check hamcore.se2.
jan 04 22:17:32 berto vpnserver[1982]: [1B blob data]
jan 04 22:17:32 berto vpnserver[1982]: (First, reboot the computer. If this problem occurs again, please reinstall VPN software files.)
jan 04 22:17:32 berto systemd[1]: softether-vpnserver.service: Control process exited, code=exited status=255
jan 04 22:17:32 berto systemd[1]: Failed to start SoftEther VPN Server.
This is my script:
[Unit]
Description=SoftEther VPN Server
After=network.target auditd.service
ConditionPathExists=!/usr/vpnserver/do_not_run
[Service]
Type=forking
EnvironmentFile=-/usr/vpnserver
ExecStart=/usr/vpnserver/vpnserver start
ExecStop=/usr/vpnserver/vpnserver stop
KillMode=process
Restart=on-failure
WorkingDirectory=/usr/vpnserver
# Hardening
PrivateTmp=yes
ProtectHome=yes
ProtectSystem=full
ReadOnlyDirectories=/
ReadWriteDirectories=-/usr/vpnserver
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYS_ADMIN CAP_SETUID
[Install]
WantedBy=multi-user.target
-- Unit softether-vpnserver.service has begun starting up.
jan 04 22:29:54 berto vpnserver[2097]: The SoftEther VPN Server service has been started.
jan 04 22:29:54 berto systemd[1]: Started SoftEther VPN Server.
-- Subject: Unit softether-vpnserver.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit softether-vpnserver.service has finished starting up.
--
-- The start-up result is done.
This was the error log:
jan 04 22:17:32 berto vpnserver[1982]: -- Alert: SoftEther VPN Kernel --
jan 04 22:17:32 berto vpnserver[1982]: Fatal Error: The file "hamcore.se2" is missing or broken.
jan 04 22:17:32 berto vpnserver[1982]: Please check hamcore.se2.
jan 04 22:17:32 berto vpnserver[1982]: [1B blob data]
jan 04 22:17:32 berto vpnserver[1982]: (First, reboot the computer. If this problem occurs again, please reinstall VPN software files.)
jan 04 22:17:32 berto systemd[1]: softether-vpnserver.service: Control process exited, code=exited status=255
jan 04 22:17:32 berto systemd[1]: Failed to start SoftEther VPN Server.
This is my script:
[Unit]
Description=SoftEther VPN Server
After=network.target auditd.service
ConditionPathExists=!/usr/vpnserver/do_not_run
[Service]
Type=forking
EnvironmentFile=-/usr/vpnserver
ExecStart=/usr/vpnserver/vpnserver start
ExecStop=/usr/vpnserver/vpnserver stop
KillMode=process
Restart=on-failure
WorkingDirectory=/usr/vpnserver
# Hardening
PrivateTmp=yes
ProtectHome=yes
ProtectSystem=full
ReadOnlyDirectories=/
ReadWriteDirectories=-/usr/vpnserver
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYS_ADMIN CAP_SETUID
[Install]
WantedBy=multi-user.target
-- Unit softether-vpnserver.service has begun starting up.
jan 04 22:29:54 berto vpnserver[2097]: The SoftEther VPN Server service has been started.
jan 04 22:29:54 berto systemd[1]: Started SoftEther VPN Server.
-- Subject: Unit softether-vpnserver.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit softether-vpnserver.service has finished starting up.
--
-- The start-up result is done.
-
- Posts: 336
- Joined: Sat Aug 15, 2015 7:41 pm
Re: Problem starting vpnserver with systemd on xubuntu
It might be that the script is not able to find the .so libraries of SoftEther for some reason.
Maybe you can try preloading them in the script using:
LD_PRELOAD="/path/to/each/so /anotherpath"
Maybe you can try preloading them in the script using:
LD_PRELOAD="/path/to/each/so /anotherpath"
-
- Posts: 102
- Joined: Sat Jun 20, 2015 9:40 am
Re: Problem starting vpnserver with systemd on xubuntu
Thanks,
adding the WorkingDirectory=/usr/vpnserver seems to do the trick. Now working.
adding the WorkingDirectory=/usr/vpnserver seems to do the trick. Now working.