I am attempting to use openvpn with a raspberry Pi 4b (arm64) server using systemd to manage the tunnel. I have followed this documentation:
https://wiki.archlinux.org/title/Mullvad#Using_systemd[1].
I can successfully start the connection from the command line using:
sudo systemd start openvpn-client@mullvad.service
I am trying to daemonized the service so it runs automatically when the service starts it with this command:
sudo systemd enable openvpn-client@mullvad.service
When I reboot the server, I get this message:
`Feb 28 19:40:54 server openvpn[1353]: /sbin/resolvconf: 31: kill: Operation not permitted
Feb 28 19:40:54 server openvpn[872]: WARNING: Failed running command (--up/--down): external program exited with error status: 1
Feb 28 19:40:54 server openvpn[872]: Exiting due to fatal error
Feb 28 19:40:54 server systemd[1]:
openvpn-client@mullvad.service: Main process exited, code=exited, status=1/FAILURE
Feb 28 19:40:54 server systemd[1]:
openvpn-client@mullvad.service: Failed with result 'exit-code'.`
The key error looks to be this line:
openvpn[1353]: /sbin/resolvconf: 31: kill: Operation not permitted
So it looks like the systemd is having trouble running the
update-resolv-conf
script during boot. I have tried using the default script that came with my distribution (Raspberry PI OS x64 which is Debian buster) and also the Mullvad supplied script, both are almost identical and they both fail in the same way.
Any ideas on what the script is trying to kill where the operation is not permitted?
Why does it work when I run it from the command line but not when the system runs it during boot?
I checked the permissions. The script is owned by root and and is executable.
Here is the script that is failing:
[ "$dev" ] || exit 0
split_into_parts()
{
part1="$1"
part2="$2"
part3="$3"
}
case "$script_type" in
up)
NMSRVRS=""
SRCHS=""
for optionvarname in ${!foreign_option_*} ; do
option="${!optionvarname}"
echo "$option"
split_into_parts $option
if [ "$part1" = "dhcp-option" ] ; then
if [ "$part2" = "DNS" ] ; then
NMSRVRS="${NMSRVRS:+$NMSRVRS }$part3"
elif [ "$part2" = "DOMAIN" ] ; then
SRCHS="${SRCHS:+$SRCHS }$part3"
fi
fi
done
R=""
[ "$SRCHS" ] && R="search $SRCHS
"
for NS in $NMSRVRS ; do
R="${R}nameserver $NS
"
done
echo -n "$R" | /sbin/resolvconf -a "${dev}.openvpn"
;;
down)
/sbin/resolvconf -d "${dev}.openvpn"
;;
esac
System Information:
- OpenVPN 2.5.1 aarch64-unknown-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on May 14 2021