New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wayland issues: Green lines on scaled screen + no input (SELinux, Fedora) #6116
Comments
Please run the |
I will remove "sudo rustdesk --service" in README |
@sahilyeole please confirm on Fedora GNOME Wayland |
I have been playing around with this the last hour and these are my obervations:
I hope my experice helps figuring out this issues! Let me know if I can do any useful test for you. |
I forgot to mention input issue on fedora wayland is caused by SELinux. @fufesou is preparing a doc for this. |
True! I extracted a SELinux module with audit2allow and now it works perfecly! I guess the document is to guide users to create and install the SELinux module. Did you consider including this in the installation process so it is transparent for users? |
If this requires modify anything on your system regarding security, we will not do it. We can not afford the risk. |
What exactly have you done? can you paste full commands here? We will evaluate if we can add in rpm postinstall. |
You can include an open source SELinux module that only grants access to the input device. That is transparent enough, I think, and it is the way SELinux is meant to be used: granular, explicit and loggeable permissions.
First, I looked into /var/log/audit logs and I saw these denials related to rustdesk:
As you can see, it gets denied a sudo command to access a file, and an open command to to /dev/uinput. Maybe with granting access to the later one is enough, since I dont care, I just used the audit2allow utility to turn denial logs into SELinux modules that allow those commands:
That is all I did. The pp file I think is the compiled module and source is in the .te file, that you should customize for the installer. For me, it created the following .te file:
For comparison, if we want to only allow the open command, this is what I get:
Looking in the documentation for .te files you should be able to manually craft a tailor made selinux module for the app needs, I think. |
@manueldeprada Thanks for your kind feedback. But maybe it's not a good way to allow
By adding the rules, the other services (default |
Not an issue on default scaling options (100,200,300,400). But after doing
It unlocked the experimental feature of fractional scaling, now all the scale options (125,150,175,200,etc) except for 100 is causing this issue. Conclusion: This is not an issue with default scaling options but only an issue after enabling the fractional scaling feature (which is experimental in gnome mutter).
|
@sahilyeole Good job. |
True. I did some research and it is possible to create a selinux policy that specifically only allows the rustdesk process to access the /dev/uinput. That should be the way forward, but it requires crafting a full policy and it requires some time that I don't have this week. As a temporal hack, I have checked and the "exec sudo" permission is not needed. This is my minimal non-custom working policy right now:
It can be run with
|
True too! I forgot I had to enable that. However, GNOME is planning to enable fractional scaling by default, and I bet everyone with a HighDPI laptop has done it. I have not had any problem sharing my screen with firefox, that also uses pipewire, neither with TeamViewer, Zoom or other apps, so even if it is marked as an experimental feature, I would argue that it is widely used and quite stable. I don't have the experience to tweak into the capturing code, but I do hope to see a fix for this! it seems like the framebuffer dimensions are messed up, please let me know if I can help with any tests!! This might be helpful |
@manueldeprada Thanks |
@manueldeprada Hi, maybe your selinux policies is not enough for the rustdesk service. Here's my rustdesk.te:
You can apply it by running checkmodule -M -m -o rustdesk.mod rustdesk.te && semodule_package -o rustdesk.pp -m rustdesk.mod && sudo semodule -i rustdesk.pp Why your rules workYou can test with the very few rules is because you've start a RustDesk client interface. The manually started RustDesk client interface may have a inner server. So the To verify, you can try restart your PC, just login and do nothing more, and then try connect to the peer. WarningsAnd agian, the rules allow Try a new domain for RustDesk service if possible. |
@manueldeprada can you please try to run this snippet with fractional scaling of 125% on? Based on this. If any window doesn't open on running this script. Please modify this line (68) in the script: - pipeline = Gst.parse_launch('pipewiresrc fd=%d path=%u ! videoconvert ! xvimagesink'%(fd, node_id))
+ pipeline = Gst.parse_launch('pipewiresrc fd=%d path=%u ! videoconvert ! autovideosink'%(fd, node_id)) The opened window will show you a video stream of your display, if it is not distorted like in rustdesk then let me know. This script uses gstreamer like rustdesk for screencasting, I will try to update our code likewise if this script works for you. |
Same "no input" issue here, on Fedora/Fedora. |
Sorry for the late reply, it has been a busy week. I tested both alternatives for line 68 and both work fine. I can see a clear picture in the window, no green lines, with either versions of the script. Rustdesk continues to display green lines distortion. Thanks for your work! Hope it helps! |
You need to either follow the guide to add the SELinux policy or launch Rustdesk with sudo rustdesk --service |
Thanks, I've debugged the issue. Meanwhile, can you please confirm this part by executing
|
This is the output of xrandr whith fractional scaling OFF:
With fractional scaling at 125%:
If you come up with other method that I can test for getting the resolution, please say so. In GNOME settings, it is correct. |
@sahilyeole I did a quick check and reading directly on |
Thanks, but we need to ensure the correct resolution of the currently shared display. In the case of multi-monitors, it might not work. I tested kde's fractional calling on wayland, they support it officially. Rustdesk stream is working & I'm sorry but I don't think we should disturb our current working code as it is an issue on gnome's side that too on an experimental feature. Also, there's no good workaround to get the correct resolution. I'd suggest reporting it on gnome's git, they may get it fixed in their official support for fractional scaling. If you can't wait for gnome to fix it then let me know. I can provide a separate custom build that will include the hardcoded value of your display resolution (of the monitor you want to screencast), this build will fix the issue but only for your resolution. |
Thanks for your hard work @sahilyeole !! In seemed strange to me that this is a bug, since GNOME is really pushing forward the Wayland initiative, and they have also been lately working hard on the gaming-on-Linux resolution problems. I have dug deep into this issue and these are my latest findings: Turns out, this is not a mutter (GNOME) issue! They are doing the correct implementation. First, some context for everyone reading. The stream size that Rustdesk gets is returned by the pipewire screen sharing, DBus interface. We can see it in the Python script that you provided earlier:
This returns the following:
My true resolution is 2560x1600, so this is the wrong size. This is the same API call that the Rust implementation by @H-M-H does, and hence it is the source of all our problems. The answer can be found on the xdg-desktop-portal documentation, where it states what should be that size property, irrespective of GNOME or KDE backends:
Hence, we see that the API specification explicitly states that this is not the display resolution. A similar issue with Firefox's WebRTC implementation also ends with a strong argument about how this works and how it is not GNOME's bug. Finally, I think we should look for a solution for this. Postponing it will only mean a bigger problem in the future, since HiDPI screens are taking over and fractional scaling will not be experimental the next version of GNOME shell. Solutions to the problem:
Maybe @H-M-H can help with this, since he is the author of that code. |
Thanks for the work @manueldeprada. I will check out the dbus interface way.
But the pipewire stream doesn't provide display resolution. It only returns size, position, etc :( |
Thanks for answering!! That properties are from the freedesktop DBUS, not from the pipewire. I get lost in the Rust code, but I was able to do it in the python script! Check this: https://gist.github.com/manueldeprada/8dce4a0a02067190715e92a4d69ff75d. To me, it plots the correct resolution of the pipewire pipeline. |
Great! Even when fractional scaling is on? |
yep... Adapting that to the rust code to do the same would be the good-code way to solve it, I think. On a separate note: I have been 2h to understand all this pipewire/DBUS/Screencast... What a complicated and overengineered thing Linux has become... The API to get a stream of the screen from the OS should be much simpler. |
rustdesk/libs/scrap/src/wayland/pipewire.rs Lines 184 to 190 in c223d6a
I checked the code, we already have it and it is resulting in the correct display resolution on fractional scaling. Thanks for pointing it out, I missed it last time.
Haha true. X11 is much simpler but wayland makes things for the devs very complicated because of its secured design. |
Awesome!! Let me know when I can test something. Note that to get the python code to work, I had to add the state change listener. Caps are None until the state effectively changes to PLAYING :) |
Thanks @sahilyeole @manueldeprada |
Bug Description
This was tested on both 1.2.3 and October 19th nightly, on Fedora 38 GNOME with Intel graphics.
Xorg version works flawlessly.
On Wayland:
Thanks for the great product! I hope wayland support improves soon :)
How to Reproduce
Just download rustdesk on Fedora GNOME wayland session and try to log in.
Expected Behavior
Clear image and working mouse control.
Operating system(s) on local side and remote side
Fedora 38
RustDesk Version(s) on local side and remote side
1.2.3 tested, 19-10 nightly also tested
Screenshots
Additional Context
No response
The text was updated successfully, but these errors were encountered: