Skip to content

Pass /sys/class/drm as part of DirectRendering - #240

Draft
Syntrait wants to merge 2 commits into
igo95862:masterfrom
Syntrait:passdrmdevice
Draft

Syntrait wants to merge 2 commits into
igo95862:masterfrom
Syntrait:passdrmdevice

Conversation

@Syntrait

Copy link
Copy Markdown
Contributor

Fixes Proton Wayland gaming on Steam

Games that are run through Proton-GE and PROTON_ENABLE_WAYLAND=1 crash on launch, if /sys/class/drm is not passed to the container.

Fixes Proton Wayland gaming on Steam
Comment thread src/bubblejail/services.py Outdated
yield DevBind(x_resolved.parents[1])

yield DevBind("/dev/dri")
yield DevBind("/sys/class/drm")

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would a ReadOnlyBind work here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. From my testing, if a read-only bind is made, it only partially works.

For example in Warframe, if it's not passed at all, the launcher does start, but clicking anywhere on the launcher causes it to crash, with Proton logs mentioning /sys/class/drm.
If it's a read-only mount, Warframe's launcher works and is interactible, but clicking on "Play" causes the game to crash, and not launch.
Only if it's a read-write or DevBind, that the game launches and works fine.

I didn't try out other games, but it should be more or less the same.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/sys/class/drm is a directory with a bunch of symlinks. I wonder why there is any difference. Maybe using strace can reveal more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some digging, I think I have a clue. When a program attempts to open /sys/class/drm/version with write permissions, EROFS (Read-only file system) gets triggered, instead of EACCES (Permission denied).

In the Wine-Wayland source code, EACCES has its own error logic (STATUS_ACCESS_DENIED), but EROFS falls back to a generic error (STATUS_UNSUCCESSFUL).
https://github.com/nanomatters/wine-salkim/blob/wineland_20260713-reorg/dlls/mountmgr.sys/unixlib.c#L59

Though, I'm not sure why this even happens in the first place.

Read-only bind:

syntrait@localhost ~ [1]> python3 -c "open('/sys/class/drm/version', 'w')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    open('/sys/class/drm/version', 'w')
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 30] Read-only file system: '/sys/class/drm/version'
syntrait@localhost ~ [1]> echo > /sys/class/drm/version
warning: An error occurred while redirecting file '/sys/class/drm/version'
open: Read-only file system

DevBind:

syntrait@localhost ~ [1]> python3 -c "open('/sys/class/drm/version', 'w')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    open('/sys/class/drm/version', 'w')
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/sys/class/drm/version'
syntrait@localhost ~ [1]> echo > /sys/class/drm/version
warning: An error occurred while redirecting file '/sys/class/drm/version'
open: Permission denied

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So a read-write Bind will work?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I will go with recreating /sys/class/drm/. The eventual plan for direct_rendering is to be able to select a particular GPU to pass to sandbox. This means the directory should only contain links to GPUs passed. Creating the directory from scratch gives control over that. I highly doubt version can change while sandbox is running.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds nice. In the meantime, I think it would be a good idea to fix the current direct_rendering first, since Steam Wayland gaming is getting more and more popular.

With how GloriousEggroll and CachyOS team made their own Steam Overlay compatibility layers that work with Wayland, people will start running their games with Wayland more often. I think GE's one even works for native Linux games like CS2, though I heard it requires you to compile it yourself.

It wouldn't be a good experience, if the out-of-the-box Steam profile didn't work for native Wayland games.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will rework the algorithm soon. It is a bit dated at this stage and inelegant.

@Syntrait
Syntrait marked this pull request as draft October 11, 2026 11:01
@Syntrait
Syntrait marked this pull request as ready for review October 11, 2026 13:14
@Syntrait
Syntrait marked this pull request as draft October 12, 2026 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants