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

Missing binaries and hanging setup on HypriotOS #1

Open
steampixel opened this issue Sep 5, 2017 · 17 comments
Open

Missing binaries and hanging setup on HypriotOS #1

steampixel opened this issue Sep 5, 2017 · 17 comments
Assignees

Comments

@steampixel
Copy link

steampixel commented Sep 5, 2017

Hi!

First of all: Great work!

I was using pivpn for a while. Now i want to move my complete rpi infrastructure to docker. Iam a big fan of HypriotOS for rpi. (https://blog.hypriot.com/downloads/) This os allows me to run docker out of the box on my rpi. Currently iam using HypriotOS (Debian GNU/Linux 8)

Unfornatelly it does not work with your install script (curl -s -L https://bit.ly/2vpfRx9 | sudo bash).

The first thing is: hypriot is very minimalistic. For example i have to install lsof befor using your script by using "apt-get install lsof". It would be nice if your script could check if the binary exists.

The second thing is: the script seems to be hanging after i have typed in the port number.

If i have the time i will provide you more informations about the issue. But i have no idea where and how to start the debugging. Iam not so experienced in writing complex sh-scripts.

@InnovativeInventor
Copy link
Owner

InnovativeInventor commented Sep 6, 2017

Well, right now there is no built-in way to debug, but could you tell me the results when you run
lsof -i : 1194 into terminal. As soon as I get some free time I will try to reproduce your issue and figure out what is wrong (in addition to getting the script to check if lsof is installed).

I will try to add support for HypriotOS, but no guarantees.

@steampixel
Copy link
Author

Thank you. Hm. It seems i have the wrong lsof version installed or something is wrong with lsof itself on my HypriotOS.

When i run lsof -i : 1194 I get this error:

HypriotOS/armv7: pirate@black-pearl in ~
$ lsof -i : 1194
lsof: unacceptable port specification in: -i :
lsof 4.86
 latest revision: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
 latest FAQ: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
 latest man page: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_man
 usage: [-?abhKlnNoOPRtUvVX] [+|-c c] [+|-d s] [+D D] [+|-f[gG]] [+|-e s]
 [-F [f]] [-g [s]] [-i [i]] [+|-L [l]] [+m [m]] [+|-M] [-o [o]] [-p s]
[+|-r [t]] [-s [p:s]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [--] [names]
Use the ``-h'' option to get more help information.

I have lsof 4.86 installed. Is this correct?

@steampixel
Copy link
Author

steampixel commented Sep 7, 2017

Ok. I have searched for lsof using google. I think i dont have to use the space after the : in the command.
When I run lsof -i :1194 without the space lsof just prints nothing.

Also if I run lsof -i:22 lsof prints nothing. But I am connected to the ssh deamon on port 22. This is realy strange.

Maybe this topic should be asked to the hypriot team.

@InnovativeInventor
Copy link
Owner

InnovativeInventor commented Sep 7, 2017

Whoops! I meant lsof -i :1194 Sorry about that! It does seem weird that lsof -i:22 doesn't print anything. Maybe type it with a space like this:
lsof -i :22

If it doesn't print anything, maybe you should talk to the hypriot team about this issue. I'm running revision 4.89 on my mac, and the command works perfectly. I'll do some more research, but I suspect this might be a Hypriot problem. Try updating hypriot/lsof.

@steampixel
Copy link
Author

Sorry. my mistake :-) I meant lsof -i :22 (with space) I tried this already. And it prints nothing. I will contact the hypriot team. If i have new insights about this issue i will write back here.
Thank you

@steampixel
Copy link
Author

Hm :-) Ok. On my Rapberry pi at the office (running raspbian) it works. But I had to install lsof too. It seems it is not installed by default on raspbian.

running lsof -i :22 prints nothing. But when I run sudo lsof -i :22 i will get the expected results.

I will double check the root privileges on HypriotOs later. Maybe its a sudo problem.

@InnovativeInventor
Copy link
Owner

Okay. I added sudo to all the lsof commands, which should now allow it to work. Also, I made it install lsof, if it isn't detected on the system. I didn't get a chance to test it, but it should work.

@steampixel
Copy link
Author

Thank you. I will check it later.

@steampixel
Copy link
Author

Puh :-) Ok. First of all sorry for the hassle :-) The problem was not lsof. The problem was me. If i run sudo lsof -i :22 on my HypriotOS i will get the expected results (facepalm). I am not sure if the sudo statements in your script is necessary because the entire script gets executed as sudo.

lsof is not the problem anymore. The problem occurs now at the ufw statement. Ufw isnt installed at raspbian and Hypriot by default. That means there should be no need to set up a firewall rule.

That line is the reason the script will hang because the ufw command will fail. But if you try to run the script the secont time the docker container is already created. This will then throw a new error. Because the name cannot be reused. Then it will hang up again at this point. I had to delete the pivpn container and uncomment the ufw line in my copy of your script.

So far :-) Now it hangs up on "Writing random data". I will check it too.

@InnovativeInventor
Copy link
Owner

Do you have openssl on Hypriot?

@steampixel
Copy link
Author

Jup. Its installed by default:

HypriotOS/armv7: pirate@black-pearl in ~
$ openssl version
OpenSSL 1.0.1t  3 May 2016

@steampixel
Copy link
Author

There ist something strange with the cat /dev/random command and the pipe to head -c 512. If i reduce the bytes to 16 or 32 it will work. But with 512 bytes the command will never end. Maybe the Pi3 is not powerfull enough for this operation. However. After i have solved this I will get a new starange error. I think this will eat to much debugging time at the moment for me to get this working on a pi. Have you ever tested it on a rpi?

@InnovativeInventor
Copy link
Owner

Well, I haven't tested it on a Raspberry Pi, but it does work on ubuntu. You do need to interact with your computer to generate entropy for the system. /dev/random will block if there isn't enough entropy.

@InnovativeInventor
Copy link
Owner

I will probably change it to /dev/urandom because that will not block.

@InnovativeInventor
Copy link
Owner

@steampixel I've redid the scripts, so see if it works now on Hypriot.

@InnovativeInventor InnovativeInventor self-assigned this Dec 20, 2017
@steampixel
Copy link
Author

Hey. Sorry for my late response. I'am very busy at the moment :-) I followed your new little setup guide but got some error messages:

`
HypriotOS/armv7: pirate@black-pearl in ~/pivpn-docker
$ sudo bash setup.sh --build
Dockerfile does not exist, will not build. Defaulting to pull
Error response from daemon: manifest for innovativeinventor/docker-pivpn:armhf not found
Unable to find image 'innovativeinventor/docker-pivpn:armhf' locally
docker: Error response from daemon: manifest for innovativeinventor/docker-pivpn:armhf not found.
See 'docker run --help'.

Already up-to-date.
must specify at least one container source
Error response from daemon: No such container: bash
Error response from daemon: No such container: bash
Error response from daemon: No such container: dpkg
Error response from daemon: No such container: bash
Restarting container . . .
"docker restart" requires at least 1 argument(s).
See 'docker restart --help'.

Usage: docker restart [OPTIONS] CONTAINER [CONTAINER...]

Restart one or more containers
json: cannot unmarshal array into Go value of type types.ContainerJSON
Your port is
Error response from daemon: No such container: sed
Generating configs . . . Please answer the prompts
Error response from daemon: No such container: pivpn
must specify at least one container source
Done! To execute commands, type docker exec -it /bin/bash
All currently generated configs are in the ovpns directory
To generate more configs, just type docker exec -it pivpn -a
Your openvpn port should be , open it up if you are using a firewall
`

@steampixel
Copy link
Author

I also tried checking out the repo and running the seup from there. But the error is almost the same:

`
$ sudo bash setup.sh --build
Dockerfile does not exist, will not build. Defaulting to pull
Error response from daemon: manifest for innovativeinventor/docker-pivpn:armhf not found
Unable to find image 'innovativeinventor/docker-pivpn:armhf' locally
docker: Error response from daemon: manifest for innovativeinventor/docker-pivpn:armhf not found.
See 'docker run --help'.

must specify at least one container source
Error response from daemon: No such container: bash
Error response from daemon: No such container: bash
Error response from daemon: No such container: dpkg
Error response from daemon: No such container: bash
Restarting container . . .
"docker restart" requires at least 1 argument(s).
See 'docker restart --help'.

Usage: docker restart [OPTIONS] CONTAINER [CONTAINER...]

Restart one or more containers
json: cannot unmarshal array into Go value of type types.ContainerJSON
Your port is
Error response from daemon: No such container: sed
Generating configs . . . Please answer the prompts
Error response from daemon: No such container: pivpn
must specify at least one container source
Done! To execute commands, type docker exec -it /bin/bash
All currently generated configs are in the ovpns directory
To generate more configs, just type docker exec -it pivpn -a
Your openvpn port should be , open it up if you are using a firewall
`

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

No branches or pull requests

2 participants