igo95862 / bubblejail

Bubblewrap based sandboxing for desktop applications
259 stars 17 forks source link

Void Linux: No windows in steam #40

Closed ghost closed 2 years ago

ghost commented 2 years ago

On Void Linux, I created a steam instance through bubblejail-config called "steam" and left all the options on their default options. After that, I run steam through: bubblejail run steam I am then able to log in without any issues, but once I have logged in and the steam window opens, steam doesn't display Library, Store, etc. 20220723-164803 png

igo95862 commented 2 years ago

Hello,

  1. Does it happens when running steam outside of bubblejail? (you can try separate linux user to test that)
  2. Can it always be replicated? Steam is pretty buggy and can sometimes fail to load.
  3. Have you tried running bubblejail steam through terminal to check if there are any relevant logs?
ghost commented 2 years ago

This problem is not present outside of bubblejail, and it consistently occurs when running steam under bubblejail.

Steam.log

igo95862 commented 2 years ago

Well the only thing I see that might fit is:

  65   │ steamwebhelper.sh[277]: Runtime for steamwebhelper: defaulting to /home/$USERNAME/.local/share/Steam/ubuntu12_64/steam-runtime-heavy
  66   │ steamwebhelper.sh[277]: Using CEF sandbox (try with -no-cef-sandbox if this fails)
  67   │ Aborted
ghost commented 2 years ago

Sadly, this issue persists.

Steam.log

igo95862 commented 2 years ago

Sadly I can't help you with debugging this issue. I don't run Void Linux.

If you want to debug it. Try using strace and --debug-bwrap-args to find out what exactly is missing.

Also:

process 126: D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open "/etc/machine-id": No such file or directory

Does that file exist outside sandbox? Are you running D-Bus?

ghost commented 2 years ago

Yes, D-Bus is running, both as root and normal user, and the error is not present outside of bubblejail. I will try and see if I can find what causes this issue later.

igo95862 commented 2 years ago

BTW is /etc/machine-id a symlink?

Also what version of bubblejail are you running? (run bubblejail --version)

ghost commented 2 years ago

I ran into this issue on Void Linux as well. To fix this, I passed /var/lib/dbus/machine-id as a readonly directory and Steam worked properly afterwards. /etc/machine-id doesn't exist on my install of Void Linux.

ghost commented 2 years ago

Thanks! This fixes the issue for me as well. /etc/machine-id does not exist for me either.

igo95862 commented 2 years ago

@NymanMatthias thank you for finding the solution!

igo95862 commented 2 years ago

@junkmanner BTW how did you install the bubblejail? Is it from source? Is there an AUR-like package?

Can whoever packaged it add a patch to bind /var/lib/dbus/machine-id inside sandbox? It feels like a Void specifc issue so I don't feel like altering the actual source code to just fix one particular distro.

ghost commented 2 years ago

@igo95862 Bubblejail is not officially packaged on void, however, void does allow you to create and package unofficial packages using xbps-src (like makepkg on arch).

I am unsure how @junkmanner installed bubblejail, but I have made a template, which can be used to install bubblejail through void's package manager.

For people using void who might stumble upon this in the future, here is the template I use, and a patch for steam.toml that fixes the steam dbus issue. Template:

# Template file for 'bubblejail'
pkgname=bubblejail
version=0.6.2
revision=2
build_style=meson
depends="bubblewrap python3 python3-xdg python3-tomli python3-tomli-w xdg-dbus-proxy python3-PyQt5 libseccomp libnotify"
makedepends="m4 python3-Sphinx"
short_desc="Bubblewrap based sandboxing utility"
maintainer="Matthias Nyman"
license="GPL-3.0-or-later"
homepage="https://github.com/igo95862/bubblejail"
distfiles="https://github.com/igo95862/bubblejail/archive/refs/tags/${version}.tar.gz"
checksum=72e6fb90090f41087423c7c46366aaa796a29d1e087276e3381402da2cedfa0e

Patch:

diff '--color=auto' -Naur bubblejail/data/bubblejail/profiles/steam.toml bubblejail-void/data/bubblejail/profiles/steam.toml
--- bubblejail/data/bubblejail/profiles/steam.toml  2022-06-15 20:23:23.000000000 +0200
+++ bubblejail-void/data/bubblejail/profiles/steam.toml 2022-07-25 16:17:59.027699258 +0200
@@ -23,5 +23,5 @@
 [services.direct_rendering]
 [services.joystick]
 [services.root_share]
-read_only_paths = ['/sys/devices/system/cpu']
+read_only_paths = ['/sys/devices/system/cpu', '/var/lib/dbus/machine-id']
igo95862 commented 2 years ago

I think that Steam is not the only application that will have issues with the missing machine id.

I would have a patch something like this:

diff --git a/src/bubblejail/services.py b/src/bubblejail/services.py
index 5ceed1f..ef6317a 100644
--- a/src/bubblejail/services.py
+++ b/src/bubblejail/services.py
@@ -312,6 +312,9 @@ class BubblejailDefaults(BubblejailService):
                     yield ReadOnlyBind(root_path)

         yield ReadOnlyBind('/etc')
+        # Void Linux fix
+        # The /etc/machine-id is missing
+        yield ReadOnlyBind('/var/lib/dbus/machine-id')

         # Temporary directories
         yield DirCreate('/tmp')

This way the machine id is always passed.

ghost commented 2 years ago

So far, I have only used bubblejail's profiles for steam, firefox, chromium, and the generic profile with discord, but so far, only steam had this machine-id problem, so I am unsure if programs other than steam need /var/lib/dbus/machine-id to be passed on void.

ghost commented 2 years ago

@igo95862 @NymanMatthias I just built it from source

igo95862 commented 2 years ago

I documented the missing machine-id file in the this file. There is also now a link to this file in README.

ghost commented 2 years ago

Looks good! AFAICT, /etc/machine-id is a systemd specific file, so this issue might be present on other distros without systemd.

igo95862 commented 2 years ago

Looks good! AFAICT, /etc/machine-id is a systemd specific file, so this issue might be present on other distros without systemd.

It is present on Alpine Linux but they maybe introduced it for compatibility.

ghost commented 2 years ago

I saw a bit of discussion about it for Alpine, but that is a bit old, and /etc/machine-id might have been added since then.