proxpn-bash-client icon indicating copy to clipboard operation
proxpn-bash-client copied to clipboard

Unable to run the proxpn command from PATH (anywhere), even after installation

Open Pysis868 opened this issue 8 years ago • 13 comments

username@localhost ~> which proxpn
/usr/local/bin/proxpn
username@localhost ~> sudo echo $PATH
/usr/local/bin /usr/local/sbin /usr/bin /usr/sbin
username@localhost ~> proxpn 

Welcome to the ProXPN OpenVPN Bash Client!
This script must be run as root in order to successfully apply network route configuration.
Elevated permissions not detected, falling back to dry-run mode...

What protocol would you like to connect with? 
Generally, TCP is the best choice on networks prone to packet loss.
Be advised if you don't have a paid account, you can only use the FREE UDP exit node.
1) tcp
2) udp
Select a protocol to use for this connection (1-2): ^C
ProXPN OpenVPN Bash Client has been force quit.  Goodbye.

username@localhost ~> sudo proxpn 
sudo: proxpn: command not found
username@localhost ~> sudo ~/src/proxpn-bash-client/proxpn

Welcome to the ProXPN OpenVPN Bash Client!

What protocol would you like to connect with? 
Generally, TCP is the best choice on networks prone to packet loss.
Be advised if you don't have a paid account, you can only use the FREE UDP exit node.
1) tcp
2) udp
Select a protocol to use for this connection (1-2): ^C
ProXPN OpenVPN Bash Client has been force quit.  Goodbye.

username@localhost ~/s/proxpn-bash-client> git log -1
commit b71dcf1a16ab3f1b0b4e61d8d7705835bf52e51d
Author: Matt Surabian <[email protected]>
Date:   Mon Oct 31 21:11:08 2016 -0400

    v4.0.3
username@localhost ~/s/proxpn-bash-client> ./install.sh 
This script must be run as root in order to copy the script to /usr/local/bin.
Falling back to configuration only mode. You must re-run this script with sudo or manually copy the proxpn script into your PATH before using the proxpn command.

System-wide configuration file already exists; continuing installation...
System-wide program link already exists; continuing installation...
System-wide credentials file already exists; continuing installation...

What's going on here? README describes it should work from the PATH, and I believe it did in long history ago, but it's not right now.. Might have to run it using the path temporarily??

Fedora 24 Workstation fish 2.3.1

Pysis868 avatar Nov 01 '16 03:11 Pysis868

One thing I'll note is that install.sh needs to run as root, though something else seems to be going on here.

I can't repro with a fresh install on Ubuntu, I'll setup a Fedora VM and give it a go.

MattSurabian avatar Nov 01 '16 12:11 MattSurabian

To hopefully make it any simpler, I am using Vagrant with config.vm.box = "Pysis/fedora24-workstation" and:

  config.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
    vb.gui = true

    # Customize the amount of memory on the VM:
    vb.memory = "1024"
  end

with some other commands run in a script, for example, installing git. I can post more of those specifically if they are needed at all.

Pysis868 avatar Nov 01 '16 12:11 Pysis868

Ah! Maybe this is a Fedora thing but I would expect your path DIRS to be separated with :, is that not done on that distro? /usr/local/bin /usr/local/sbin /usr/bin /usr/sbin > /usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin

MattSurabian avatar Nov 01 '16 12:11 MattSurabian

o no, I am using fish, and that is the way they separate the PATH entires :): Manipulating PATH variable in fish-shell

Pysis868 avatar Nov 01 '16 12:11 Pysis868

Ah, I've not used the fish shell, I saw the fish note in your issue but wasn't sure what it was. Vagrant up'ing now.

MattSurabian avatar Nov 01 '16 13:11 MattSurabian

Hmmm possibly related I broke the installer with this change https://github.com/MattSurabian/proxpn-bash-client/commit/5ea5501ec805e4bbc6491e3eeedc189d1e29f270

[vagrant@localhost vagrant]$ sudo ./install.sh
Attempting to install configuration file to: /root/.config/proxpn/proxpn.ovpn
Configuration file already exists; continuing installation...
Attempting to install executable to: /usr/local/bin/proxpn
System-wide program link already exists; continuing installation...
Attempting to install credentials file to: /root/.config/proxpn/login.conf
Do you want to enter and store your credentials? (y/n): n
Choosing to not permanently store credentials.  They will have to be entered upon successive executions of the main script.
[vagrant@localhost vagrant]$ sudo /usr/local/bin/proxpn 

Welcome to the ProXPN OpenVPN Bash Client!
ERROR: No OpenVPN configuration file found at /home/vagrant/.config/proxpn/proxpn.ovpn!

MattSurabian avatar Nov 01 '16 13:11 MattSurabian

This appears to be related to what root considers in its path on Fedora 24. It doesn't seem related to fish.

Ubuntu 16.04 Bash

$ which proxpn
/usr/local/bin/proxpn
$ sudo which proxpn
[sudo] password for matt: 
/usr/local/bin/proxpn

Fedora 24 Bash

$ which proxpn
/usr/local/bin/proxpn
$ sudo which proxpn
which: no proxpn in (/sbin:/bin:/usr/sbin:/usr/bin)
$ sudo echo $PATH
/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/vagrant/.local/bin:/home/vagrant/bin
$ sudo env
  ...
  PATH=/sbin:/bin:/usr/sbin:/usr/bin
  ...

MattSurabian avatar Nov 01 '16 13:11 MattSurabian

Ah ha

Fedora 24 Bash

$ su root proxpn
Password: 

Welcome to the ProXPN OpenVPN Bash Client!
No credentials file found at /root/.config/proxpn/login.conf, you will be prompted by OpenVPN to login to ProXPN

What protocol would you like to connect with? 
Generally, TCP is the best choice on networks prone to packet loss.
Be advised if you don't have a paid account, you can only use the FREE UDP exit node.
1) tcp
2) udp
Select a protocol to use for this connection (1-2): ^C
ProXPN OpenVPN Bash Client has been force quit.  Goodbye.

MattSurabian avatar Nov 01 '16 13:11 MattSurabian

Looks like this is Fedora specific... any ideas on how to handle it generally? We could move the default install location as it seems like sbin is available broadly... not sure if there are any guidelines about when it's "ok" to install there...

MattSurabian avatar Nov 01 '16 13:11 MattSurabian

That's an idea, assuming you meant /usr/sbin, and isn't just for system executables, but also any user sudo-required ones.

Getting this far, and potentially more, we might want to just turn this into a full OS package, since that covers lifecycle and system installation? I guess that doesn't cover single-user installation, and we would still have to support that though?

Pysis868 avatar Nov 01 '16 13:11 Pysis868

Aye I did mean /usr/sbin, I've just always put my own downloaded stuff in /usr/local/bin and never thought too much about it. Really, this probably has always belonged in /usr/sbin.

With regard to OS packaging and single user install that's what I'm referring to here https://github.com/MattSurabian/proxpn-bash-client/issues/16#issuecomment-236411125

I'm comfortable saying that the preferred way to install this is from an OS package but the repo structure would have to get a bit freaky to cleanly package this up for all the different distros. It may mean distinct repos and git submodules, where the core script and installer could still be leveraged by single-user folks that can't or don't want to get the official package.

MattSurabian avatar Nov 01 '16 14:11 MattSurabian

Ok, so for now... we change the executable path to /usr/sbin, and for single user installs, well, won't need to worry about, because this is a script that needs sudo access either way, so use the same place, right?

Pysis868 avatar Nov 01 '16 14:11 Pysis868

Yeah folks can stuff have help generating the configuration and credentials file through the installer but without sudo they're on their own getting stuff where it needs to be.

I'll make a PR for this later today.

MattSurabian avatar Nov 01 '16 15:11 MattSurabian