Private Internet Access Setup in Gentoo Openrc Init Systems

This guide works flawlessly for my Gentoo setup with an openrc init system. First go to the private internet access page, and download the v3.6.0
. I tested the current version and it did not work as at the writing of this post.
Next is to run the downloaded .run
file with this command:
bash pia-linux-<version>-<revision>.run -- --skip-service
Create the OpenRC Init Script:
sudo nano /etc/init.d/pia-daemon
Now paste this script in the file:
#!/sbin/openrc-run
name="pia-daemon"
description="Private Internet Access Daemon"
command="/opt/piavpn/bin/pia-daemon"
command_background=true
pidfile="/run/${name}.pid"
directory="/opt/piavpn"
user="pia"
group="pia"
want net
depend() {
after firewall
after dns
after logger
need localmount
need sysfs
need devfs
}
start_pre() {
if [ ! -d "/run/pia-daemon" ]; then
mkdir -p /run/pia-daemon
chown pia:pia /run/pia-daemon
fi
return 0
}
Make it executable:
sudo chmod +x /etc/init.d/pia-daemon
Ensure Required Dependencies Are Installed:
sudo emerge --ask app-crypt/mit-krb5
Enable the Service at Boot:
sudo rc-update add pia-daemon default
Start the Daemon:
sudo rc-service pia-daemon start
sudo rc-service pia-daemon status
If you did encounter Exec Format Error
upon starting the service, just move #!/sbin/openrc-run
in the above script to the very top of the file, and that should do the trick!
