evilsocket / opensnitch

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

UI does not work in Ubuntu 22.04 (fixed on 23.04) / LinuxMint 21 (temp fix available) #647

Open ghost opened 2 years ago

ghost commented 2 years ago

Hi. It's UI bug.

UI app stuck and interface never appear. I see it load my CPU for about 15%. Tray icon of opensnitch appear as blank area and does not open even menu by click.

I tried to start it from source using cd ui/bin && mv opensnitch-ui opensnitch-ui.py && python3 opensnitch-ui.py and there was some errors with theme module.

I guess it may be somehow related to new libadwaita and that they dropped ability to use user themes.

I don't know how to get you more info. Please tell me how and I will do it.

gustavo-iniguez-goya commented 2 years ago

hey @ergsolo , thank you for reporting this.

What version are you running? gnome, kde?

ghost commented 2 years ago

@gustavo-iniguez-goya Gnome, Ubuntu 22.04 latest

ghost commented 2 years ago

Actually I told about ubuntu DE did you ask about version of ui? I thought its qt based only

gustavo-iniguez-goya commented 2 years ago

ok, reproduced. I'll try to find the problem.

gustavo-iniguez-goya commented 2 years ago

ok, the problem seems to be the python3-grpcio version that is shipped with ubuntu 22, 1.30.2-3build6

As a workaround install grpcio version from pip as your regular user: $ pip3 install --ignore-installed grpcio==1.44.0

Note: if it keeps failing (opensnitch-ui is using 100%CPU), be sure that you install it for your python version. for example:

$ python3 -V
Python 3.10.9
$ python3.10 -m pip install --ignore-installed grpcio
ghost commented 2 years ago

@gustavo-iniguez-goya Thank you, workaround works!

Ahmed-E-86 commented 2 years ago

I have the same issue.

convolutionbbs commented 2 years ago

I have the same issue since Pop_OS 22.04 (gnome 42) LTS. I tried the $ pip3 install --ignore-installed grpcio and it still does not work. When I launch the sopensnitch-ui pegs one of the CPUs.

gustavo-iniguez-goya commented 2 years ago

I'll take a look , thank you @convolutionbbs

gustavo-iniguez-goya commented 2 years ago

It seems to work fine for me:

image

Maybe you had it running in backgroud? try killing opensnitch-ui before launching it again.

convolutionbbs commented 2 years ago

Yes, I've tried that. I was launching from the gui icon via Pop_OS. I just tried from the shell:

$ opensnitch-ui Loading translations: /usr/lib/python3/dist-packages/opensnitch/i18n locale: en_US None setQuery() exception: int() argument must be a string, a bytes-like object or a real number, not 'QVariant'

and the opensnitch-ui process pegs cpu

gustavo-iniguez-goya commented 2 years ago

mmh, what version are you using? did you install the GUI from sources or using the deb packages?

convolutionbbs commented 2 years ago

Just for fun, I removed all references to opensnitch and opensnitch-ui via dpkg (even using --purge). I was using the x86_64 debian builds for both. I re-installed using Eddy (right click on the .deb file install) using the latest version 1.5.1-1.

python3-opensnitch-ui_1.5.1-1_all.deb opensnitch_1.5.1-1_amd64.deb

Still get no GUI - pegs CPU. Slightly different otuput - likely because I had an older opensnitch-ui installed when I ran the command before. It's likely not relevant, but I did install: pip install pyasn but it still doesn't find it (maybe there's another version I need).

$ opensnitch-ui Themes not available. Install qt-material if you want to change GUI's appearance: pip3 install qt-material. Loading translations: /usr/lib/python3/dist-packages/opensnitch/i18n locale: en_US exception loading ipasn db: No module named 'pyasn' Install python3-pyasn to display IP's network name.

gustavo-iniguez-goya commented 2 years ago

ok, the previous error exception: int() looked suspicious, that's why asked you for the version :)

Unfortunately I have no idea why it's not working on your system :/ Try uninstalling python3-grpcio, it'll also remove python3-opensnitch-ui. Then install this deb package without the python3-grpcio dependency: https://github.com/evilsocket/opensnitch/releases/download/v1.5.1/python3-opensnitch-ui_1.5.1-1_all.PIP.deb

Regarding the pyasn package: installing it from pip doesn't install the needed DB, no idea why. On Pop_OS the package is available from apt: apt install python3-pyasn

convolutionbbs commented 2 years ago

that did it - thanks!

gustavo-iniguez-goya commented 2 years ago

~After rebuilding our grpcio files with latest grpcio version, this problem is fixed for Ubuntu 22 and derivatives.~ ~I'll test it out on the rest of versions and distributions, and if everything works fine I'll rebuild the GUI packages.~

nah, false alarm.

convolutionbbs commented 2 years ago

Just wanted to say thank you for your support of this great project - the ease of use and capability is outstanding.

gustavo-iniguez-goya commented 2 years ago

I opened a bug report with Ubuntu detailing the steps to reproduce this problem . Hopefully they'll reproduce the same behaviour. A simple grpcio example fails as well:

https://bugs.launchpad.net/ubuntu/+source/grpc/+bug/1971114

impredicative commented 2 years ago

Requirements have always been a major thorn for this project, and seem like they will continue to plague this project, disallowing it from being too successful. Any modern project would be fully compiled or packaged without a single one of these unbundled requirements. These days standalone various packagers exist even for Python, so I don't know what the hangup is.


To summarize, here are the extras that I had to run to get the v1.5.1-1 UI running on Ubuntu 22.04:

sudo apt install python3-pip python3-pyasn
pip3 install --user qt-material
pip3 install --user --ignore-installed grpcio

I think python3-pyasn could be documented in the Installation page, or otherwise it could perhaps be installed automatically.

gustavo-iniguez-goya commented 2 years ago

Hi @impredicative , nor python3-pyasn, nor qt-material are mandatories. The GUI works just fine without them. Otherwise file a bug specifying what's wrong.

The problematic requirements have always been grpcio, unicode_slugify and protobuf, because they were not shipped with many distributions (min18/19, ubuntu <= 18, etc). And now, there's a bug with python3-grpcio.

The deb/rpm packages has worked flawlessly until now, just with apt -f install ./python3-opensnitch-ui**.deb ./opensnitch*.deb

On the other hand, the workaround to this specific problem was documented here https://github.com/evilsocket/opensnitch/issues/647#issuecomment-1090545284 more than 1 month ago.

I also filed a bug for the python3-grpcio problem here https://bugs.launchpad.net/ubuntu/+source/grpc/+bug/1971114 where you can drop a comment to let them know that this problem affects you. This bug also affects warpinator (mint 22.04): https://github.com/linuxmint/warpinator/issues/127

g3434343 commented 2 years ago

I can confirm it works for me in Pop-Os! 22.04.

BillDietrich commented 2 years ago

Recently the UI stopped working on openSUSE Tumbleweed KDE. Running opensnitch-ui on CLI gives "ModuleNotFoundError: No module named 'grpc'". "zypper search grpc" says the only grpc thing installed is "python38-grpcio".

Tried doing "pip3 install --user --ignore-installed grpcio", and now running opensnitch-ui on CLI gives "ModuleNotFoundError: No module named 'google'".

gustavo-iniguez-goya commented 2 years ago

@BillDietrich that's weird, maybe an upgrade uninstalled the package python3-grpcio? but it'd have also uninstalled the GUI.. so, no idea.

You also need protobuf to solve the error "No module named google": $ sudo zypper install python3-protobuf (or with pip: $ pip3 install protobuf

But anyway, try to install both python3-grpcio and python3-protobuf from SuSe's repositories.

temporarium commented 2 years ago

Just to inform, since I recently had issues with the UI on openSUSE Tumbleweed as well: it appears the system Python was changed from 3.8 to 3.10. As a result, I had to zypper install the corresponding (python310) modules of grpcio, protobuff and slugify.

Now it's working normally.

gustavo-iniguez-goya commented 2 years ago

Thank you very much @temporarium ! @BillDietrich , it looks like that's also the problem on your case.

temporarium commented 2 years ago

No, thank you @gustavo-iniguez-goya for an excellent application and all the hard work!!

gustavo-iniguez-goya commented 1 year ago

So python3-grpcio 1.30.2-3build6 is going to be shipped with LinuxMint21, now in Beta, causing the same problem than on Ubuntu 22.04 :( (reproduced).

0x77696c6c commented 1 year ago

ok, the problem seems to be the python3-grpcio version that is shipped with ubuntu 22, 1.30.2-3build6

As a workaround install grpcio version from pip as your regular user: $ pip3 install --ignore-installed grpcio

:/usr/bin$ ./opensnitch-ui Traceback (most recent call last): File "./opensnitch-ui", line 25, in from opensnitch.utils import Themes ImportError: cannot import name 'Themes' from 'opensnitch.utils' (/usr/local/lib/python3.8/dist-packages/opensnitch/utils.py)

:/usr/bin$ pip3 show grpcio Name: grpcio Version: 1.47.0 Summary: HTTP/2-based RPC framework Home-page: https://grpc.io Author: The gRPC Authors Author-email: grpc-io@googlegroups.com License: Apache License 2.0 Location: /home/veg/.local/lib/python3.8/site-packages Requires: six Required-by: grpcio-tools

:/usr/bin$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.4 LTS Release: 20.04 Codename: focal

MedeirosMayck commented 1 year ago

Ui does not work in POP OS 22.04 /usr/bin$ ./opensnitch-ui Themes not available. Install qt-material if you want to change GUI's appearance: pip3 install qt-material. Loading translations: /usr/lib/python3/dist-packages/opensnitch/i18n locale: en_US is new file, or IN MEMORY, setting initial schema version setting schema version to: 2 setting schema version to: 2 schema version: 2 db schema is up to date using IPASN DB: /usr/lib/python3/dist-packages/data/ipasn_20140513_v12.dat.gz

/usr/bin$ pip3 show grpcio Name: grpcio Version: 1.48.0 Summary: HTTP/2-based RPC framework Home-page: https://grpc.io Author: The gRPC Authors Author-email: grpc-io@googlegroups.com License: Apache License 2.0 Location: /home/mayck/anaconda3/lib/python3.9/site-packages Requires: six Required-by:

/usr/bin$ lsb_release -a No LSB modules are available. Distributor ID: Pop Description: Pop!_OS 22.04 LTS Release: 22.04 Codename: jammy

Ahmed-E-86 commented 1 year ago

Requirements have always been a major thorn for this project, and seem like they will continue to plague this project, disallowing it from being too successful. Any modern project would be fully compiled or packaged without a single one of these unbundled requirements. These days standalone various packagers exist even for Python, so I don't know what the hangup is.

To summarize, here are the extras that I had to run to get the v1.5.1-1 UI running on Ubuntu 22.04:

sudo apt install python3-pip python3-pyasn
pip3 install --user qt-material
pip3 install --user --ignore-installed grpcio

I think python3-pyasn could be documented in the Installation page, or otherwise it could perhaps be installed automatically.

That fixed this issue for me. python3-pyasn should be a mandatory dependency.

gustavo-iniguez-goya commented 1 year ago

thank you @Ahmed-E-86 . In latest releases I changed the requirement from Suggests: to Recommends:, which installs the package by default if it's available.

The problem is that python3-pyasn is not available in all distributions (specially old ones that many people still use), that's why it cannot be a mandatory dependency. But from now on it'll be installed if it's available.

On the other hand you all can leave a comment on this issue to let the devs know that this bug is affecting you as well: https://bugs.launchpad.net/ubuntu/+source/grpc/+bug/1971114

I haven't had a response in 4 months, so if any of you can reach them it would be very useful.

AlexMikhalev commented 1 year ago

To get UI working on Pop os 22.04 I had to downgrade:

pip3 install --user --ignore-installed protobuf==3.15.8
erdnaxeli commented 1 year ago

Just to let you know that this issue also impact Fedora 36. I had to install those python packages :

Flimm commented 1 year ago

The same issue exists in Ubuntu 22.10, and it seems like the same solution works.

sudo apt install python3-pip
pip3 install --ignore-installed --user grpcio==1.44.0
gustavo-iniguez-goya commented 1 year ago

Thank you @Flimm ,

The bug is still opened and without feedback: https://bugs.launchpad.net/ubuntu/+source/grpc/+bug/1971114 I don't know if the link "this bug affects me too" would make any difference: https://bugs.launchpad.net/ubuntu/+source/grpc/+bug/1971114/+affectsmetoo

Given that a basic example doesn't work either, this must be affecting all projects that use this package.

gustavo-iniguez-goya commented 1 year ago

I realized yesterday that the opensnitch-ui process was consuming 6% of the CPU doing nothing. It turns out that it's a bug in the grpc lib: https://github.com/grpc/grpc/issues/30428

Installing grpcio==1.44.0 solves this problem: $ pip3 install --user --ignore-installed grpcio==1.44.0

temporarium commented 1 year ago

Which are the buggy versions? Mine is v1.51.1 and CPU load is 0.

gustavo-iniguez-goya commented 1 year ago

it seems to be >= 1.45.0 and < 1.48

IrIougER commented 1 year ago

Solved the issue on Mint 21 thanks.

wp-coin commented 1 year ago

why is he using python for the gui, even electron will be better

MikeGrace commented 1 year ago

Thank you. The workaround resolved my issue running Ubuntu 22.04.1 LTS.

burritoOverflow commented 1 year ago

Carelessly installed a grpc related update on Ubuntu 22.04 and broke it--the following worked for me:

 pip3 install --ignore-installed grpcio==1.44.0

Note: I had to manually kill the opensnitch-ui process and re-launch for it to work again.

Thanks!

Ileca commented 1 year ago

I lost the interface when upgrading to Ubuntu 22.10 and got it back by doing pip3 install --ignore-installed grpcio==1.44.0 but now I have a version mismatch error about me running the 1.6.0rc5 version of the daemon while the UI is at version 1.5.0rc2. And it makes OpenSnitch bugs indeed as I installed that app spamming connections but it still ask me for permission for every new website even after I allowed the executable. I tried to look at the rules but the UI finally crashed.

gustavo-iniguez-goya commented 1 year ago

@Ileca , grpcio version should not affect installed opensnitch version. Open a new issue or Discussion question, but be sure your packages versions are correct (dpkg -l | grep opensnitch) . It looks like you upgraded the daemon, but no the GUI.

Ileca commented 1 year ago

Yeah, that's completely on me. Forget what I said, I will crawl into a hole now.

vibescartel1 commented 1 year ago

Daemon runs but attempting to run opensnitch-ui gives the following error on Ubuntu 22.04:

Traceback (most recent call last):
  File "/usr/bin/opensnitch-ui", line 40, in <module>
    from opensnitch.service import UIService
  File "/usr/lib/python3/dist-packages/opensnitch/service.py", line 13, in <module>
    from opensnitch import ui_pb2
  File "/usr/lib/python3/dist-packages/opensnitch/ui_pb2.py", line 32, in <module>
    _descriptor.EnumValueDescriptor(
  File "/home/vibescartel1/.local/lib/python3.10/site-packages/google/protobuf/descriptor.py", line 796, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

I seem to have all the required packages installed, but version might be causing issues?

python3.10 -m pip install grpcio protobuf slugify

Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: grpcio in ./.local/lib/python3.10/site-packages (1.53.0)
Requirement already satisfied: protobuf in ./.local/lib/python3.10/site-packages (4.22.1)
Requirement already satisfied: slugify in ./.local/lib/python3.10/site-packages (0.0.1)
nettybun commented 1 year ago

@vibescartel1 You need 3.20.x or lower, as said in the error message. I got the same error and fixed it like this:

python3.10 -m pip uninstall protobuf
Found existing installation: protobuf 4.21.5
Uninstalling protobuf-4.21.5:
  Would remove:
    /home/today/.local/lib/python3.10/site-packages/google/_upb/_message.abi3.so
    /home/today/.local/lib/python3.10/site-packages/google/protobuf/*
    /home/today/.local/lib/python3.10/site-packages/protobuf-4.21.5.dist-info/*
Proceed (Y/n)? 
  Successfully uninstalled protobuf-4.21.5
python3.10 -m pip install protobuf==3.20
Defaulting to user installation because normal site-packages is not writeable
Collecting protobuf==3.20
  Downloading protobuf-3.20.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 1.5 MB/s eta 0:00:00
Installing collected packages: protobuf
Successfully installed protobuf-3.20.0
hesoler commented 1 year ago

runnig on Ubuntu 22.04. Great job!! Thanks

Flimm commented 1 year ago

runnig on Ubuntu 22.04. Great job!! Thanks

Do you mean Ubuntu 23.04, the Ubuntu version that was just released?

snivlle commented 1 year ago

I realized yesterday that the opensnitch-ui process was consuming 6% of the CPU doing nothing. It turns out that it's a bug in the grpc lib: grpc/grpc#30428

Installing grpcio==1.44.0 solves this problem: $ pip3 install --user --ignore-installed grpcio==1.44.0

Thanks very much! This worked for me on Kubuntu 22.04.2. I had been really, really wanting an application-level firewall and "OpenSnitch" fits the bill perfectly. I sincerely hope that you can get it all sorted out so that it is regularly bundled into the official Ubuntu (and variants) releases. I'm very far removed from being a qualified, experienced Linux user - I'm still very much learning. I'm sure that there are many thousands upon thousands more like me. As such, it would be so HUGELY appreciated if the program could be a wee bit more easily installed -- without having to muddle about with CLI commands that I have absolutely no idea are actually doing to my system . . .LOL.

Thanks so much for all your hard work and efforts in maintaining this all-too-important Linux application! I am totally surprised that such a commonly used type of app (within both Windows and OSX) hasn't long since been 'built in' to most Linux distributions. Another sorely lacking net app is something similar to **NetLimiter", which I rely on a great deal within Windows to manage bandwidth (both globally and per application).