evilsocket / opensnitch

OpenSnitch is a GNU/Linux interactive application firewall inspired by Little Snitch.
GNU General Public License v3.0
10.74k stars 498 forks source link

runtime crash Ubuntu 14 #46

Closed skramm closed 7 years ago

skramm commented 7 years ago

Just gave a try on Ubuntu 14.04, and not much Python knowledge. Promising project, but after install, didn't run. FWIW, this happened: (could be unrelated to opensnitch, but as a lambda user, I don't know what steps I should take).

$> sudo opensnitch
Traceback (most recent call last):
  File "/usr/local/bin/opensnitch", line 5, in <module>
    pkg_resources.run_script('opensnitch==0.0.2', 'opensnitch')
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 528, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1394, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/opensnitch-0.0.2-py2.7.egg/EGG-INFO/scripts/opensnitch", line 43, in <module>
    mpl.rcParams['backend'] = 'Qt5Agg'
  File "/usr/lib/pymodules/python2.7/matplotlib/__init__.py", line 808, in __setitem__
    cval = self.validate[key](val)
  File "/usr/lib/pymodules/python2.7/matplotlib/rcsetup.py", line 146, in validate_backend
    return _validate_standard_backends(s)
  File "/usr/lib/pymodules/python2.7/matplotlib/rcsetup.py", line 57, in __call__
    % (self.key, s, self.valid.values()))
ValueError: Unrecognized backend string "qt5agg": valid strings are ['pdf', 'pgf', 'Qt4Agg', 'GTK', 'GTKAgg', 'ps', 'agg', 'cairo', 'MacOSX', 'GTKCairo', 'WXAgg', 'template', 'TkAgg', 'GTK3Cairo', 'GTK3Agg', 'svg', 'WebAgg', 'CocoaAgg', 'emf', 'gdk', 'WX']
MartinIngesen commented 7 years ago

Can you do a pip show matplotlib? If that doesn't work, try running import matplotlib; matplotlib.__version__ on your system.

It seems like you are using a matplotlib that doesn't support QT5 and you have to update that to get opensnitch working.

skramm commented 7 years ago

Can you do a pip show matplotlib?

Sure:

$ pip show matplotlib
---
Name: matplotlib
Version: 1.3.1
Location: /usr/lib/pymodules/python2.7
Requires: numpy, python-dateutil, tornado, pyparsing, nose

you have to update that to get opensnitch working

Thanks, if I understand correctly what is happening, its my package manager that only provides the 1.3.1 version, and I need another (more recent?) version. So, yeah, not directly related to opensnitch, but more a dependency problem. But what is the minimal version required ?

adisbladis commented 7 years ago

You are actually having a few different problems

Ubuntu 14.04 is not packaging PyQt5. Ubuntu 14.04 is ancient by now.

We haven't made any official decision about this but me personally would like to be able to use fairly new libraries and such. I would say that our baseline should be the latest Ubuntu LTS which is 16.04.

Also you are trying to run on Python 2, as you can see in https://github.com/evilsocket/opensnitch/blob/master/bin/opensnitch#L1 Opensnitch is Python 3. I just created a PR that makes install.py crap out on this https://github.com/evilsocket/opensnitch/pull/47

skramm commented 7 years ago

Ubuntu 14.04 is ancient by now.

Well, Ubuntu 14.04 is an LTS and is supposed to "last" 5 years...

I would say that our baseline should be the latest Ubuntu LTS which is 16.04.

I understand that choice, of course. Given limited resources, you can't support all OSes.

Also you are trying to run on Python 2

No. I am trying to run opensnitch, period ;-) What it does under the hood, I don't (want to) know. But I see you changed some stuff in the install process in #47, I'll check that out and get back here in a day or 2, please don't close. Also changed my python alias, but for some reason it seems to stay on 2.7 (at least matplotlib, I have to investigate...)

And thanks anyway, keep on the good job.

adisbladis commented 7 years ago

That Ubuntu 14.04 is "supported" (as in by Ubuntu, not by us) only means that it's receiving security and bug fixes, not that it's guaranteed to run new software. I'm sorry if I sound a bit dismissive but I really think that one of the advantages of working on a new project is that you can depend on stuff that is a bit bleeding edge.

@evilsocket Can we close this one?

skramm commented 7 years ago

That Ubuntu 14.04 is "supported" [...] only means that it's receiving security and bug fixes, not that it's guaranteed to run new software.

Sure, got that. But as a standard Linux box and given the required packages, it "should" be able to make new stuff work. Seems this isn't so obvious, unfortunately...

Conclusion: I'm almost sure this is indeed not related to opensnitch but to Python and its infamous 2 vs. 3 problem. What I did:

adisbladis commented 7 years ago

@skramm You might get it to work by actually using python3: http://packages.ubuntu.com/trusty/python3 and http://packages.ubuntu.com/trusty/python3-pip and then invoking python3 and pip3 respectively. With that said the packages in 14.04 are ancient and I would not be surprised if there are some things that are not there.

If I was you I would just get with the times and upgrade ;)

skramm commented 7 years ago

I do have both python2 and python3. The problem is more related to the fact that with my distro, the default is python2. I'll try to manually change the symlinks, but this is probably going to break lots of other stuff.

If I was you I would just get with the times and upgrade ;)

Yeah, makes sense. But stability and long-term support is crucial to me, so I'm kinda reluctant.

MarkoShiva commented 7 years ago

You need to install python3-pip python3-setup tools and python3-pyqt5 and also python3-dev

And as you see from updated Readme file you need to run command as python3 setup.py install if you do not have python3 as default one.

I forgot to add the python3-pip as dependency but yeah its dependent to python3-pip the command you later use for listing or showing packages is pip3 not just pip which is symlink to pip2 on your system.

On 05/11/2017 08:25 AM, skramm wrote:

Conclusion: I'm almost sure this is indeed not related to opensnitch but to Python and its infamous 2 vs. 3 problem. What I did:

  • removed with OS package manager my matplotlib package
  • got latest matplotlib (|git clone|) and installed (|python setup.py install|) but still, always stuck with python 2.7:

|$ pip show matplotlib --- Name: matplotlib Version: 2.0.2-4065.gde2755c Location: /usr/local/lib/python2.7/dist-packages/matplotlib-2.0.2_4065.gde2755c-py2.7-linux-x86_64.egg Requires: numpy, six, python-dateutil, backports.functools-lru-cache, subprocess32, pytz, cycler, pyparsing |

So you can close this issue if you feel it should be, I'll post here if I find any solution.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/evilsocket/opensnitch/issues/46#issuecomment-300694766, or mute the thread https://github.com/notifications/unsubscribe-auth/AA8qg0ICmyvIaQJmwQjITgTrBuA-YfgCks5r4qnwgaJpZM4NUHne.

skramm commented 7 years ago

Fixed ! Here are my steps:

  1. get latest matplotlib (2.0.2 at present)
  2. install it using python3 instead of python (see http://matplotlib.org/users/installing.html ),
  3. do the opensnitch install process as described
  4. done, sudo opensnitch runs

Thanks for support !

arielf commented 7 years ago

There's no reason why not to have python3 and python2 side-by-side on the same system. No need to mess with symlinks. I have both versions and everything works great (granted I run 16.04, not 14.04 which may be a bit harder due to other dependencies).

Using 2.7.12 as the default python and using explicit python3 (or pip3 etc.) for programs that require it.

opensnitch just needs to ensure python3 is used wherever it is required.

There's still at least one reference to python in the README.md Install section (sudo python setup.py install). This needs to be changed to sudo python3 setup.py install - trivial to fix.

Thanks!

skramm commented 7 years ago

No need to mess with symlinks

Yes, I confirm. I did it, and a lot of stuff started acting weird and/or crashing on my machine! Quickly reverted to original...