Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in installer causes install.sh: line 1109: cd: /usr/local/src/pivpn: No such file or directory #1556

Closed
6 tasks done
megakoresh opened this issue Jun 25, 2022 · 2 comments · Fixed by #1557
Closed
6 tasks done

Comments

@megakoresh
Copy link
Contributor

In raising this issue, I confirm the following:

{please fill the checkboxes, e.g: [X]}

Has your install failed?

yes

Describe the issue

Auto install fails because of a bug on line 1109 - it should be && not single &. The single & puts the whole command on background and the following cd command fails.

Expected behavior
Pivpn is installed.

Screenshots
If applicable, add screenshots to help explain your problem.

Can you replicate the issue? Describe the steps below

Use the following cloud-init script to install the thing on any Ubuntu server (I used Hetzner Cloud):

#!/bin/bash

# configure these according to your cloud infra
vpn_user=vpn
public_if=eth0
private_if=enp7s0
dns1=9.9.9.9
dns2=149.112.112.112

# this will be the address clients connect to. Must be public ip address or DNS name mapped to it
host_dns=$public_addr_v4

adduser -q -gecos '' --disabled-password $vpn_user
usermod -G sudo $vpn_user
sed -i -E 's/^%sudo.+$/%sudo    ALL=(ALL:ALL) NOPASSWD:ALL/' /etc/sudoers

# some things we can get automatically
public_addr_v4=$(ip -4 -o addr | grep $public_if | grep global | awk '{print $4}' | cut -d '/' -f 1)
public_addr_v6=$(ip -6 -o addr | grep $public_if | grep global | awk '{print $4}' | cut -d '/' -f 1)
private_addr_v4=$(ip -4 -o addr | grep $private_if | grep global | awk '{print $4}' | cut -d '/' -f 1)
private_addr_v6=$(ip -6 -o addr | grep $private_if | grep global | awk '{print $4}' | cut -d '/' -f 1)
os=$(lsb_release -is)
os_codename=$(lsb_release -cs)

cat <<EOF > /home/vpn/wg-vpn.conf
PLAT=$os
OSCN=$os_codename
USING_UFW=0
IPv4dev=$public_if
IPv6dev=$public_if
install_user=$vpn_user
install_home=/home/$vpn_user
VPN=wireguard
pivpnPORT=51820
pivpnDNS1=$dns1
pivpnDNS2=$dns2
pivpnHOST=$host_dns
INPUT_CHAIN_EDITED=0
FORWARD_CHAIN_EDITED=0
INPUT_CHAIN_EDITEDv6=0
FORWARD_CHAIN_EDITEDv6=0
pivpnPROTO=udp
pivpnMTU=1420
pivpnDEV=wg0
pivpnNET=10.211.97.0
subnetClass=24
pivpnenableipv6=1
pivpnNETv6="fd11:5ee:bad:c0de::"
subnetClassv6=64
ALLOWED_IPS="0.0.0.0/0, ::0/0"
UNATTUPG=1
EOF

chown $vpn_user:$vpn_user /home/$vpn_user/wg-vpn.conf

apt-get update
apt-get upgrade -y

mkdir /home/$vpn_user/.ssh
cp ~/.ssh/authorized_keys /home/$vpn_user/.ssh/
chmod 0700 /home/$vpn_user/.ssh
chmod 0600 /home/$vpn_user/.ssh/authorized_keys
chown -R $vpn_user:$vpn_user /home/$vpn_user/.ssh

git clone https://github.com/pivpn/pivpn /home/vpn/pivpn
chown -R $vpn_user:$vpn_user /home/$vpn_user/pivpn

try=5
while [ $try -gt 0 ]; do
  try=$(($try - 1))
  su -l -c "/home/$vpn_user/pivpn/auto_install/install.sh  --unattended /home/$vpn_user/wg-vpn.conf" - $vpn_user
  if [ $? -eq 0 ]; then
    try=0
  else
    echo "error. trying again. $try tries left"
    sleep 2
  fi
done

if [ $try -ne 0 ]; then
  echo "install successful, rebooting in 5 seconds"
  sleep 5
  reboot
else
  echo "installation failed after 5 retries, plz see cloud-init logs for details"
fi

Have you searched for similar issues and solutions?

Yes. No solution because it is not related to octopi.

Additional context
N/A

Have you taken any steps towards solving your issue?

Yes, changing line 1109 from single & at then end to && solves the problem.

$SUDO git clone -q --depth 1 --no-single-branch "${2}" "${1}" > /dev/null && spinner $!

Please provide your system information

What type of hardware are you running PiVPN at?

Virtual machine
Ubuntu 20.04

Output of uname -a

Linux ubuntu-2gb-hel1-1 5.4.0-110-generic #124-Ubuntu SMP Thu Apr 14 19:46:19 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Output of cat /etc/os-release

NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

If install failed Please provide the console output of curl -L https://install.pivpn.io | bash

install.sh: line 1109: cd: /usr/local/src/pivpn: No such file or directory
@coolapso
Copy link
Member

🎉 This issue has been resolved in version 4.1.0-test.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@coolapso
Copy link
Member

🎉 This issue has been resolved in version 4.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants