gustavo-iniguez-goya / opensnitch

OpenSnitch is a GNU/Linux application firewall
GNU General Public License v3.0
395 stars 20 forks source link

Problems installing from source on Ubuntu 18.04 + pyqt issues #67

Closed themighty1 closed 4 years ago

themighty1 commented 4 years ago

Hi, thank you for your work on this project. I was installing it for the first time following the instructions here: https://github.com/gustavo-iniguez-goya/opensnitch/wiki/Compilation#installation-from-sources

When I ran make, I got this error log:

make[1]: Entering directory '/home/default2/go/src/github.com/gustavo-iniguez-goya/opensnitch/proto' python3 -m grpc_tools.protoc -I. --python_out=../ui/opensnitch/ --grpc_python_out=../ui/opensnitch/ ui.proto /usr/lib/python3.6/runpy.py:125: RuntimeWarning: 'grpc_tools.protoc' found in sys.modules after import of package 'grpc_tools', but prior to execution of 'grpc_tools.protoc'; this may result in unpredictable behaviour warn(RuntimeWarning(msg)) make[1]: Leaving directory '/home/default2/go/src/github.com/gustavo-iniguez-goya/opensnitch/proto' make[1]: Entering directory '/home/default2/go/src/github.com/gustavo-iniguez-goya/opensnitch/daemon' procmon/watcher.go:8:2: cannot find package "github.com/evilsocket/ftrace" in any of: /usr/lib/go-1.10/src/github.com/evilsocket/ftrace (from $GOROOT) /home/default2/go/src/github.com/evilsocket/ftrace (from $GOPATH) rule/loader.go:18:2: cannot find package "github.com/fsnotify/fsnotify" in any of: /usr/lib/go-1.10/src/github.com/fsnotify/fsnotify (from $GOROOT) /home/default2/go/src/github.com/fsnotify/fsnotify (from $GOPATH) dns/track.go:9:2: cannot find package "github.com/google/gopacket" in any of: /usr/lib/go-1.10/src/github.com/google/gopacket (from $GOROOT) /home/default2/go/src/github.com/google/gopacket (from $GOPATH) conman/connection.go:16:2: cannot find package "github.com/google/gopacket/layers" in any of: /usr/lib/go-1.10/src/github.com/google/gopacket/layers (from $GOROOT) /home/default2/go/src/github.com/google/gopacket/layers (from $GOPATH) netlink/socket_linux.go:11:2: cannot find package "github.com/vishvananda/netlink/nl" in any of: /usr/lib/go-1.10/src/github.com/vishvananda/netlink/nl (from $GOROOT) /home/default2/go/src/github.com/vishvananda/netlink/nl (from $GOPATH) ui/client.go:17:2: cannot find package "golang.org/x/net/context" in any of: /usr/lib/go-1.10/src/golang.org/x/net/context (from $GOROOT) /home/default2/go/src/golang.org/x/net/context (from $GOPATH) ui/protocol/ui.pb.go:10:2: cannot find package "google.golang.org/grpc" in any of: /usr/lib/go-1.10/src/google.golang.org/grpc (from $GOROOT) /home/default2/go/src/google.golang.org/grpc (from $GOPATH) ui/protocol/ui.pb.go:11:2: cannot find package "google.golang.org/grpc/codes" in any of: /usr/lib/go-1.10/src/google.golang.org/grpc/codes (from $GOROOT) /home/default2/go/src/google.golang.org/grpc/codes (from $GOPATH) ui/client.go:19:2: cannot find package "google.golang.org/grpc/connectivity" in any of: /usr/lib/go-1.10/src/google.golang.org/grpc/connectivity (from $GOROOT) /home/default2/go/src/google.golang.org/grpc/connectivity (from $GOPATH) ui/protocol/ui.pb.go:12:2: cannot find package "google.golang.org/grpc/status" in any of: /usr/lib/go-1.10/src/google.golang.org/grpc/status (from $GOROOT) /home/default2/go/src/google.golang.org/grpc/status (from $GOPATH) Makefile:11: recipe for target 'opensnitchd' failed make[1]: [opensnitchd] Error 1 make[1]: Leaving directory '/home/default2/go/src/github.com/gustavo-iniguez-goya/opensnitch/daemon' Makefile:11: recipe for target 'daemon/opensnitchd' failed make: [daemon/opensnitchd] Error 2

Which lists all packages that I lacked. I installed them all with go get

Next, running make produced this error: Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.6/tokenize.py", line 452, in open buffer = _builtin_open(filename, 'rb') FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-build-91fzmh3g/pyqt5/setup.py'

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-91fzmh3g/pyqt5/ Makefile:10: recipe for target 'deps' failed make[1]: [deps] Error 1 make[1]: Leaving directory '/home/default2/go/src/github.com/gustavo-iniguez-goya/opensnitch/ui' Makefile:14: recipe for target 'ui/resources_rc.py' failed make: [ui/resources_rc.py] Error 2

After some googling, I realized that pyqt5 version was at fault. I changed ui/requirements.txt to pyqt5==5.10

After that the install finished successfully. Im on Ubuntu 18.04

I think that the missing go packages should be reflected in the Installation from sources.

gustavo-iniguez-goya commented 4 years ago

Hi @themighty1 , thank you for reporting this problem. What distribution are you using?

themighty1 commented 4 years ago

Im using Ubuntu 18.04

gustavo-iniguez-goya commented 4 years ago

ok, let me reproduce it and I'll update the docs if needed. We've migrated recently to Go modules, so maybe there's some steps missing.

gustavo-iniguez-goya commented 4 years ago

ok, I see where the problem is. Ubuntu 18.04 is shipped with golang 1.10, and that version doesn't support Go modules. We recently migrated to Go modules, but I did not update the docs.

Just for testing it: add the focal repositories, install golang (sudo apt install golang), and type make again.

themighty1 commented 4 years ago

Not sure, Im following what you are asking. You want me to repeat the steps in https://github.com/gustavo-iniguez-goya/opensnitch/wiki/Compilation#installation-from-sources But what new step do I have to take? Install go version > 1.10?

gustavo-iniguez-goya commented 4 years ago

Yes, you need golang >= 1.13 (1.11 or 1.12 may also work but I haven't tested it).

That golang version is not available on Ubuntu 18.04 (only 1.10), so you'll have to install it from another source. For example you can add focal repository to apt, and install only golang.

themighty1 commented 4 years ago

Thanks, I tried the instructions in a clean chroot Ubuntu 18.04 environment. After I added the repo with:

sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ focal main"

golang 1.13 was installed and no errors were displayed

Just a suggestion. There are many who may want to build from source but who have no notion of GOPATH. They would have to google "how to set GOPATH" (just like I did) just to learn the obvious. Can we just add this line to the instructions?

GOPATH=~/go #you may want to change this is your GOPATH is different

Also I had to prepend sudo to

sudo python3 -m pip install --user grpcio-tools

otherwise it was failing with errors.

Lastly, the pyqt5 issue was manifesting when the version used was >= 5.14.1, When it was too low like 5.6, I got dependencies errors The version which worked for me this time was 5.11.2 (couple days ago the version which worked was 5.10, but not this time)

pyqt5==5.11.2

After running make, I saw this notice Cannot find file: icon-white.png But I guess that's OK

gustavo-iniguez-goya commented 4 years ago

Can we just add this line to the instructions? GOPATH=~/go #you may want to change this is your GOPATH is different

Sure! no problem. Added :heavy_check_mark:

I've also removed the steps to install the dep command, we don't use it anymore.

sudo python3 -m pip install --user grpcio-tools

On Ubuntu 20 without sudo: shit

The compilation instructions are generic. For me on Debian worked fine, but in any case, there has always been problems regarding the installation of the GUI from the sources (I didn't write it).

For now this is low priority.

themighty1 commented 4 years ago

Fair enough, I renamed this ticket to make it easier for other to find it and closing this issue. Thank you.

gustavo-iniguez-goya commented 4 years ago

In any case @themighty1 , I hope to have some time this week to review the UI installation process from sources, there's (always) some room for improvement. Thank you for repoting it, otherwise I wouldn't have noticed these problems.