nmap icon indicating copy to clipboard operation
nmap copied to clipboard

Zenmap run time error as root

Open youngunix opened this issue 1 year ago • 6 comments

Describe the bug Running zenmap as root using the commands doas zenmap, sudo zenmap, or pkexec zenmap produces the error below.


/usr/lib/python3.11/site-packages/zenmapCore/I18N.py:76: DeprecationWarning: Use setlocale(), getencoding() and getlocale() instead loc, enc = locale.getdefaultlocale() /usr/lib/python3.11/site-packages/zenmapGUI/Icons.py:116: PyGTKDeprecationWarning: Gtk.IconSet(pixbuf) has been deprecated. Please use: Gtk.IconSet.new_from_pixbuf(pixbuf) iconset = Gtk.IconSet(pixbuf=pixbuf) /usr/lib/python3.11/site-packages/gi/overrides/Gtk.py:1613: DeprecationWarning: Gtk.IconSet.new_from_pixbuf is deprecated iconset = Gtk.IconSet.new_from_pixbuf(pixbuf) /usr/lib/python3.11/site-packages/zenmapGUI/Icons.py:117: DeprecationWarning: Gtk.IconFactory.add is deprecated iconfactory.add(key, iconset) /usr/lib/python3.11/site-packages/zenmapGUI/Icons.py:119: DeprecationWarning: Gtk.IconFactory.add_default is deprecated iconfactory.add_default() :673: ImportWarning: DynamicImporter.exec_module() not found; falling back to load_module() Traceback (most recent call last): File "/usr/bin/zenmap", line 124, in zenmapGUI.App.run() File "/usr/lib/python3.11/site-packages/zenmapGUI/App.py", line 281, in run window = new_window() ^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/zenmapGUI/App.py", line 125, in new_window w = ScanWindow() ^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/zenmapGUI/MainWindow.py", line 131, in init UmitScanWindow.init(self) File "/usr/lib/python3.11/site-packages/zenmapGUI/MainWindow.py", line 114, in init HIGMainWindow.init(self) File "/usr/lib/python3.11/site-packages/gi/overrides/Gtk.py", line 519, in init raise RuntimeError( RuntimeError: Gtk couldn't be initialized. Use Gtk.init_check() if you want to handle this case. /usr/lib/python3.11/site-packages/zenmapGUI/App.py:160: DeprecationWarning: Gdk.threads_enter is deprecated Gdk.threads_enter() /usr/lib/python3.11/site-packages/gi/overrides/Gtk.py:577: PyGTKDeprecationWarning: The keyword(s) "parent" have been deprecated in favor of "transient_for" respectively. See: https://wiki.gnome.org/PyGObject/InitializerDeprecations self._init(*args, **new_kwargs) Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python3.11/site-packages/zenmapGUI/App.py", line 173, in excepthook c = CrashReport(type, value, tb) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/zenmapGUI/CrashReport.py", line 84, in init HIGDialog.init(self) File "/usr/lib/python3.11/site-packages/zenmapGUI/higwidgets/higdialogs.py", line 77, in init Gtk.Dialog.init(self, title=title, parent=parent, flags=flags) File "/usr/lib/python3.11/site-packages/gi/overrides/Gtk.py", line 577, in init self._init(*args, **new_kwargs) File "/usr/lib/python3.11/site-packages/gi/overrides/init.py", line 319, in new_init return super_init_func(self, **new_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/gi/overrides/Gtk.py", line 519, in init raise RuntimeError( RuntimeError: Gtk couldn't be initialized. Use Gtk.init_check() if you want to handle this case.

Original exception was: Traceback (most recent call last): File "/usr/bin/zenmap", line 124, in zenmapGUI.App.run() File "/usr/lib/python3.11/site-packages/zenmapGUI/App.py", line 281, in run window = new_window() ^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/zenmapGUI/App.py", line 125, in new_window w = ScanWindow() ^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/zenmapGUI/MainWindow.py", line 131, in init UmitScanWindow.init(self) File "/usr/lib/python3.11/site-packages/zenmapGUI/MainWindow.py", line 114, in init HIGMainWindow.init(self) File "/usr/lib/python3.11/site-packages/gi/overrides/Gtk.py", line 519, in init raise RuntimeError( RuntimeError: Gtk couldn't be initialized. Use Gtk.init_check() if you want to handle this case.


To Reproduce

  1. Open a terminal
  2. Run doas zenmap, sudo zenmap, or pkexec zenmap

Expected behavior Zenmap to launch without errors.

Version info (please complete the following information):

  • OS: kernel: 6.1.53-gentoo-r1, Gentoo 2.14

  • Zenmap version from Help -> About 7.94

  • Output of nmap --version:

    • Nmap version 7.94 ( https://nmap.org )
    • Platform: x86_64-pc-linux-gnu
    • Compiled with: liblua-5.4.6 openssl-3.0.10 libz-1.2.13 libpcre-8.45 libpcap-1.10.4 nmap-libdnet-1.12
    • Compiled without: libssh2 ipv6
    • Available nsock engines: epoll poll select

Additional context N/A

youngunix avatar Sep 24 '23 04:09 youngunix

Any updates on this issue or anyone experiencing this problem?

youngunix avatar Dec 09 '23 06:12 youngunix

in zenmap.desktop :

Exec=pkexec env DISPLAY=:1 XAUTHORITY=/run/user/1000/gdm/Xauthority /home/bravo123/nmap/zenmap/zenmap %F

and :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
 "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
    <action id="org.freedesktop.policykit.pkexec.zenmap">
    <description>Run zenmap program</description>
    <message>Authentication is required to run the zenmap</message>
    <icon_name>nmap-logo.png</icon_name>
    <defaults>
        <allow_any>auth_admin</allow_any>
        <allow_inactive>auth_admin</allow_inactive>
        <allow_active>auth_admin</allow_active>
    </defaults>
    <annotate key="org.freedesktop.policykit.exec.path">/home/bravo123/nmap/zenmap/zenmap</annotate>
    <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
    </action>
</policyconfig>

in /usr/share/polkit-1/actions/org.freedesktop.policykit.zenmap.policy

bravo321 avatar Jan 12 '24 20:01 bravo321

After modifying zenmap-root.desktop, I successfully triggered the authentication dialog. However, upon entering the password, no popup windows or any other response occurred. To troubleshoot the issue, I attempted running it from the terminal and encountered the same outcome. I had to use Ctrl+C to exit the process, but I did receive the following errors in the terminal.:

File "/usr/bin/zenmap", line 110, in <module> import zenmapGUI.App File "/usr/lib/python3.11/site-packages/zenmapGUI/App.py", line 75, in <module> from gi.repository import Gtk, Gdk File "<frozen importlib._bootstrap>", line 1176, in _find_and_load File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 676, in _load_unlocked File "<frozen importlib._bootstrap>", line 573, in module_from_spec File "/usr/lib/python3.11/site-packages/gi/importer.py", line 146, in create_module importlib.import_module('gi.repository.' + dep.split("-")[0]) File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1204, in _gcd_import File "<frozen importlib._bootstrap>", line 1176, in _find_and_load File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 676, in _load_unlocked File "<frozen importlib._bootstrap>", line 573, in module_from_spec File "/usr/lib/python3.11/site-packages/gi/importer.py", line 147, in create_module dynamic_module = load_overrides(introspection_module) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/gi/overrides/__init__.py", line 118, in load_overrides override_mod = importlib.import_module(override_package_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/gi/overrides/Gdk.py", line 484, in <module> initialized, argv = Gdk.init_check(sys.argv) ^^^^^^^^^^^^^^^^^^^^^^^^ KeyboardInterrupt

youngunix avatar Jan 13 '24 04:01 youngunix

I can’t say anything about python errors, I have python 3.10.12. and Zenmap 7.94SVN Have you created a rule for polkit? In /usr/share/polkit-1/actions/

bravo321 avatar Jan 13 '24 08:01 bravo321

I can’t say anything about python errors, I have python 3.10.12. and Zenmap 7.94SVN Have you created a rule for polkit? In /usr/share/polkit-1/actions/

Yes, of course.

youngunix avatar Jan 25 '24 07:01 youngunix

i do have the same while trying to open zenmap after installation on Kali Linux throw error Git couldnt be initialized , try Gtk.init_check()

DCVglobalnetwork avatar Jun 06 '24 18:06 DCVglobalnetwork