netblue30 / firejail

Linux namespaces and seccomp-bpf sandbox
https://firejail.wordpress.com
GNU General Public License v2.0
5.72k stars 561 forks source link

lutris: cannot open preferences: ModuleNotFoundError: No module named 'lsb_release' #5320

Open mYnDstrEAm opened 2 years ago

mYnDstrEAm commented 2 years ago

Description

I can't open the preferences window in Lutris 0.5.10 with firejail & firejail-profiles 0.9.70-1 in Debian11/KDE.

Also see #4895

When I launch it in the console this is the ouput that shows after clicking on the burger menu in the top right -> Preferences:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lutris/util/http.py", line 92, in get
    request = urllib.request.urlopen(req, timeout=self.timeout)  # pylint: disable=consider-using-with
  File "/usr/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.9/urllib/request.py", line 523, in open
    response = meth(req, response)
  File "/usr/lib/python3.9/urllib/request.py", line 632, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.9/urllib/request.py", line 561, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 641, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lutris/gui/application.py", line 592, in do_command_line
    installers = get_installers(
  File "/usr/lib/python3/dist-packages/lutris/installer/__init__.py", line 28, in get_installers
    return get_game_installers(game_slug=game_slug, revision=revision)
  File "/usr/lib/python3/dist-packages/lutris/api.py", line 162, in get_game_installers
    request.get()
  File "/usr/lib/python3/dist-packages/lutris/util/http.py", line 96, in get
    raise HTTPError("%s" % error, code=error.code) from error
lutris.util.http.HTTPError: HTTP Error 400: Bad Request
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lutris/gui/lutriswindow.py", line 642, in on_preferences_activate
    self.application.show_window(PreferencesDialog)
  File "/usr/lib/python3/dist-packages/lutris/gui/application.py", line 326, in show_window
    window_inst = window_class(parent=self.window, **kwargs)
  File "/usr/lib/python3/dist-packages/lutris/gui/config/preferences_dialog.py", line 50, in __init__
    self.build_scrolled_window(SysInfoBox()),
  File "/usr/lib/python3/dist-packages/lutris/gui/config/sysinfo_box.py", line 31, in __init__
    sysinfo_str = gather_system_info_str()
  File "/usr/lib/python3/dist-packages/lutris/util/linux.py", line 442, in gather_system_info_str
    system_info = gather_system_info()
  File "/usr/lib/python3/dist-packages/lutris/util/linux.py", line 433, in gather_system_info
    system_info["dist"] = LINUX_SYSTEM.get_dist_info()
  File "/usr/lib/python3/dist-packages/lutris/util/linux.py", line 183, in get_dist_info
    return linux_distribution()
  File "/usr/lib/python3/dist-packages/distro.py", line 125, in linux_distribution
    return _distro.linux_distribution(full_distribution_name)
  File "/usr/lib/python3/dist-packages/distro.py", line 681, in linux_distribution
    self.version(),
  File "/usr/lib/python3/dist-packages/distro.py", line 741, in version
    self.lsb_release_attr('release'),
  File "/usr/lib/python3/dist-packages/distro.py", line 903, in lsb_release_attr
    return self._lsb_release_info.get(attribute, '')
  File "/usr/lib/python3/dist-packages/distro.py", line 556, in __get__
    ret = obj.__dict__[self._fname] = self._f(obj)
  File "/usr/lib/python3/dist-packages/distro.py", line 1014, in _lsb_release_info
    stdout = subprocess.check_output(cmd, stderr=devnull)
  File "/usr/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.

Steps to Reproduce

Steps to reproduce the behavior

  1. Open Lutris with firejail in the Environment
  2. Click on Preferences

Expected behavior

Should open Prefences window.

Actual behavior

Nothing (except the error in the console).

Behavior without a profile

It works when not using firejail.

Additional context

Environment

Checklist

Log

rusty-snake commented 2 years ago

What does firejail --profile=lutris /usr/bin/lsb_release -a show?

mYnDstrEAm commented 2 years ago

Only

noblacklist /path/Games/
whitelist /path/Games/
rusty-snake commented 2 years ago

And /usr/bin/lsb_release -a?

mYnDstrEAm commented 2 years ago
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye
mYnDstrEAm commented 2 years ago

Sorry, what I posted was the content of /home/username/.config/firejail/lutris.local, not the output of firejail --profile=lutris /usr/bin/lsb_release -a, which is:

Reading profile /etc/firejail/lutris.profile
Reading profile /home/username/.config/firejail/lutris.local
Reading profile /etc/firejail/allow-python2.inc
Reading profile /etc/firejail/allow-python3.inc
Reading profile /etc/firejail/disable-common.inc
Reading profile /etc/firejail/disable-common.local
Reading profile /etc/firejail/disable-devel.inc
Reading profile /etc/firejail/disable-exec.inc
Reading profile /etc/firejail/disable-interpreters.inc
Reading profile /etc/firejail/disable-programs.inc
Reading profile /etc/firejail/disable-xdg.inc
Reading profile /etc/firejail/whitelist-common.inc
Reading profile /etc/firejail/whitelist-usr-share-common.inc
Reading profile /etc/firejail/whitelist-runuser-common.inc
Reading profile /home/username/.config/firejail/whitelist-var-common.inc
Warning: networking feature is disabled in Firejail configuration file
Parent pid ..., child pid ...
Warning: An abstract unix socket for session D-BUS might still be available. Use --net or remove unix from --protocol set.
Child process initialized in ... ms
Traceback (most recent call last):
  File "/usr/bin/lsb_release", line 25, in <module>
    import lsb_release
ModuleNotFoundError: No module named 'lsb_release'

Parent is shutting down, bye...
mYnDstrEAm commented 1 year ago

Tried it with the latest lutris.profile and firejail v 0.9.70-2 and I still get this in the console:

Startup complete
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lutris/gui/lutriswindow.py", line 676, in on_preferences_activate
    self.application.show_window(PreferencesDialog)
  File "/usr/lib/python3/dist-packages/lutris/gui/application.py", line 320, in show_window
    window_inst = window_class(parent=self.window, **kwargs)
  File "/usr/lib/python3/dist-packages/lutris/gui/config/preferences_dialog.py", line 50, in __init__
    self.build_scrolled_window(SysInfoBox()),
  File "/usr/lib/python3/dist-packages/lutris/gui/config/sysinfo_box.py", line 31, in __init__
    sysinfo_str = gather_system_info_str()
  File "/usr/lib/python3/dist-packages/lutris/util/linux.py", line 458, in gather_system_info_str
    system_info = gather_system_info()
  File "/usr/lib/python3/dist-packages/lutris/util/linux.py", line 449, in gather_system_info
    system_info["dist"] = LINUX_SYSTEM.get_dist_info()
  File "/usr/lib/python3/dist-packages/lutris/util/linux.py", line 183, in get_dist_info
    return linux_distribution()
  File "/usr/lib/python3/dist-packages/distro.py", line 125, in linux_distribution
    return _distro.linux_distribution(full_distribution_name)
  File "/usr/lib/python3/dist-packages/distro.py", line 681, in linux_distribution
    self.version(),
  File "/usr/lib/python3/dist-packages/distro.py", line 741, in version
    self.lsb_release_attr('release'),
  File "/usr/lib/python3/dist-packages/distro.py", line 903, in lsb_release_attr
    return self._lsb_release_info.get(attribute, '')
  File "/usr/lib/python3/dist-packages/distro.py", line 556, in __get__
    ret = obj.__dict__[self._fname] = self._f(obj)
  File "/usr/lib/python3/dist-packages/distro.py", line 1014, in _lsb_release_info
    stdout = subprocess.check_output(cmd, stderr=devnull)
  File "/usr/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
Shutting down Lutris

I also get this before lutris is started: dbind-WARNING **: AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: org.freedesktop.DBus.Error.ServiceUnknown. In the profile there have been changes to seccomp shell none, it also doesn't work if I use these former commands.

kmk3 commented 1 year ago

@mYnDstrEAm on Aug 16:

Sorry, what I posted was the content of /home/username/.config/firejail/lutris.local, not the output of firejail --profile=lutris /usr/bin/lsb_release -a, which is:

Reading profile /etc/firejail/lutris.profile
Reading profile /home/username/.config/firejail/lutris.local
Reading profile /etc/firejail/allow-python2.inc
Reading profile /etc/firejail/allow-python3.inc
Reading profile /etc/firejail/disable-common.inc
Reading profile /etc/firejail/disable-common.local
Reading profile /etc/firejail/disable-devel.inc
Reading profile /etc/firejail/disable-exec.inc
Reading profile /etc/firejail/disable-interpreters.inc
Reading profile /etc/firejail/disable-programs.inc
Reading profile /etc/firejail/disable-xdg.inc
Reading profile /etc/firejail/whitelist-common.inc
Reading profile /etc/firejail/whitelist-usr-share-common.inc
Reading profile /etc/firejail/whitelist-runuser-common.inc
Reading profile /home/username/.config/firejail/whitelist-var-common.inc
Warning: networking feature is disabled in Firejail configuration file
Parent pid ..., child pid ...
Warning: An abstract unix socket for session D-BUS might still be available. Use --net or remove unix from --protocol set.
Child process initialized in ... ms
Traceback (most recent call last):
  File "/usr/bin/lsb_release", line 25, in <module>
    import lsb_release
ModuleNotFoundError: No module named 'lsb_release'

Parent is shutting down, bye...

It works for me:

$ firejail --quiet --profile=lutris lsb_release -a
-e LSB Version: n/a
-e Distributor ID:      Artix
-e Description: Artix Linux
-e Release:     rolling
-e Codename:    n/a

How about the following?

$ firejail --quiet \
  --ignore='include lutris.local' --ignore='include globals.local' \
  --profile=lutris lsb_release -a
-e LSB Version: n/a
-e Distributor ID:      Artix
-e Description: Artix Linux
-e Release:     rolling
-e Codename:    n/a
mYnDstrEAm commented 1 year ago

It's still (when not adding --quiet; output as above when added):

Traceback (most recent call last):
  File "/usr/bin/lsb_release", line 25, in <module>
    import lsb_release
ModuleNotFoundError: No module named 'lsb_release'

I don't think this is relevant or needed here though. Do I need to have something installed to use lsb_release?

kmk3 commented 1 year ago

@mYnDstrEAm on Dec 12:

It's still (when not adding --quiet; output as above when added):

Traceback (most recent call last):
  File "/usr/bin/lsb_release", line 25, in <module>
    import lsb_release
ModuleNotFoundError: No module named 'lsb_release'

I don't think this is relevant or needed here though. Do I need to have something installed to use lsb_release?

It seems that it expects a lsb_release Python module to exist (from a quick search here, I did not find any packages that provide that on Artix).

From the output it kind of looks like /usr/bin/lsb_release is a Python script, which would be strange.

What is the output of tail -n 10 /usr/bin/lsb_release?

How/where did you install Lutris from?

What is the version of lsb-release? Example on Artix:

$ pacman -Q lsb-release
lsb-release 2.0.r48.3cf5103-1.1

My best guess for narrowing it down would be to comment parts of lutris.profile until running lsb_release -a works with it.

glitsj16 commented 1 year ago

It seems that it expects a lsb_release Python module to exist. From the output it kind of looks like /usr/bin/lsb_release is a Python script, which would be strange.

Strange perhaps, but as far as I know, on Debian/Ubuntu /usr/bin/lsb_release is indeed a Python script.

Ubuntu:

$ file /usr/bin/lsb_release
/usr/bin/lsb_release: Python script, ASCII text executable

Arch Linux:

$ file /usr/bin/lsb_release
/usr/bin/lsb_release: POSIX shell script, ASCII text executable

That being said, our lutris.profile allows Python 2 and Python 3. So there's that.

mYnDstrEAm commented 1 year ago

tail -n 10 /usr/bin/lsb_release returns:

            print('Release:\t%s' % distinfo.get('RELEASE', 'n/a'))

    if options.codename or options.all:
        if short:
            print(distinfo.get('CODENAME', 'n/a'))
        else:
            print('Codename:\t%s' % distinfo.get('CODENAME', 'n/a'))

if __name__ == '__main__':
    main()

It would be easier to check how I installed lutris if my bash history wasn't constantly deleted by this bug of Wayland+KDE in Debian...pretty sure I installed it from the GitHub releases (0.5.11). lsb-release is v 11.1.0 Concerning python, see this question...should I set some environment variable (and what should echo $PATH contain if something should be there)? If I change the $PATH to actually load the paths from .bashrc via . ~/.bashrc, it still doesn't work.

glitsj16 commented 1 year ago

Concerning python, see this question...should I set some environment variable (and what should echo $PATH contain if something should be there)? If I change the $PATH to actually load the paths from .bashrc via . ~/.bashrc, it still doesn't work.

You shouldn't have to change any environment variables. Do you have $PYTHONPATH set?

Traceback (most recent call last): File "/usr/bin/lsb_release", line 25, in import lsb_release ModuleNotFoundError: No module named 'lsb_release'

I can only add that you could check if lsb_release is working correctly on your system. Reinstall it if necessary. See this file list for comparison.

mYnDstrEAm commented 1 year ago

No, I don't have that set. Doesn't this imply it works correctly? It's installed from the Debian repos, and I think there should be a warning when running debsums when some of its files are missing or altered.