Skip to content
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

RDA support: Make MATE panel aware of being run inside a remote deskt… #824

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

sunweaver
Copy link
Member

…op technology.

@vkareh vkareh requested a review from a team June 27, 2018 13:25
@lukefromdc
Copy link
Member

I do not have any remote desktop setups or experience for testing this. Someone who does needs to test this

@vkareh
Copy link
Member

vkareh commented Jun 28, 2018

I have x2go set up, I'll give this a try tomorrow at the office

@sunweaver
Copy link
Member Author

What is the benefit of this PR?

This PR is the first PR of a series of PRs I plan to submit in the next days/weeks. For now, I have another PR planned against mate-screensaver and already actively work on it.

The PR series will make MATE more aware of its execution context. Meaning: MATE will become able to behave differently when run inside a remote desktop session compared to when run on local hardware. Different remote technology support different feature sets. These feature sets will also be queriable from within MATE components. All the remote desktop gnosis, I plan to pack into librda (Remote Desktop Awareness shared lib) [1]. MATE code does not need to be knowing about the different remote desktop frameworks/technologies. This will all be outsourced into librda.

These first PRs will port features provided by an X2Go Server add-on package named x2gomatebindings [2] to MATE natively. The x2gomatebindings uses some hacky-whacky approaches to implant some features / functionalities into the MATE desktop env when run on top of X2Go:

  • offer a system menu item "Suspend X2Go session..." (this PR)
  • support X2Go folder sharing in Caja natively (not yet in prep)
  • MIME type bindings for SSHFS shares mounted via X2Go (not yet in prep)
  • allow X2Go session suspension as a button in mate-screensaver-dialog (w-i-p, not in
    x2gomatebindings)

Unfortunately, these x2gomatebindings features are--when package is installed--always present in the desktop environment, even when run locally.

NEW: The approach I'll take with my current effort (customer driven, luckily) will be generic and portable to other remote desktop frameworks than X2Go. It will also possible to mimick my patches against MATE by other desktop envs, so that also LXDE, KDE, etc. will long-term-wise benefit from this approach, I guess.

(But I'll start with X2Go for now).

About RDA shared lib: This new shared lib will provide a technology agnostic API to remote desktop environment components like mate-panel, mate-screensaver, caja, etc. and handle the technology based stuff (how to suspend a running session in X2Go, is xRDP able to suspend sessions?, how to unmount a client-side folder in native RDP from inside the session?, etc.). All the internals of the several remote technologies will be hidden from the desktop environment itself.

E.g.: (what this PR does...)

X2Go sessions are suspendible (user can disconnect from the session and reconnect/resume later on). During suspension, an X2Go session idles on the X2Go Server in throttled mode (if not configured otherwise). When resuming, you return to the same screen arrangement (open applications, open documents, etc.) like when you left it (suspended it).

The (MATE) desktop environment programmers need to check:

  rda_session_can_be_suspended()

first and if it results as true, offer some menu item that will trigger suspension by calling

  rda_session_suspend()

For X2Go, the RDA lib will then--under the bonnet--call "x2gosuspend-session" as external command.

For a non-X2Go remote desktop environment (e.g. OgonRDP, xRDP, tigervnc, etc.) it may be that suspending of a session is not supported and surely, if supported, the internal suspension trigger will be completely different.

Steps to test?

  • Create a test machine (one machine is enough)
  • Install X2Go Server and X2Go Client on it
  • install (build from source) librda
  • build mate-panel against it with the patch of this PR
  • launch a local MATE session
  • compare to launching an X2Go session (see below)

For launching an X2Go Session, start X2Go Client.

Configure a session profile:

  Host: localhost
  Port: 22 (X2Go works over SSH)
  Username: <some-user-or-same-user-on-this-test-machine>

Yes, you can X2Go into localhost as the same user as the one that runs the local session. You don't need two machines for testing(!!!).

What should happen?

In the System menu of the MATE desktop, you should see no difference if the MATE session runs on local / virtual hardware directly.

If run inside an X2Go Session, there should be a "Suspend X2Go Session..." menu item under the System menu.

I will shortly add another commit to this PR, that enforces hiding the "Shutdown" menu item when run in an X2Go session (as shutting down a machine from remote via System menu makes not much sense and has sometimes caused some annoyance if it really worked -> in most cases policykit jumps in and prohibits immediate shutdown).

What should not happen?

In X2Go Sessions, you should always have the "Suspend X2Go Session..." menu item. It should never appear, when the MATE session is running on local hardware.

Better description please....

Yes. Thanks for demanding it. I hope things have become clearer now.

Sorry, my crystal ball is broken :)

Yep. Sorry.

And::: if you guys have not started playing with MATE in remote desktop sessions, you should surely try it out (apt-get install x2goserver x2goclient on Debian-like systems). It is very easy and highly comfortable to have remote desktop'ing available, even on local machines.

light+love,
Mike

[1] https://github.com/ArcticaProject/librda
[2] https://code.x2go.org/gitweb?p=x2gomatebindings.git;a=summary

@raveit65 raveit65 requested review from raveit65 and monsta and removed request for raveit65 July 3, 2018 08:43
@vkareh vkareh self-requested a review July 3, 2018 17:49
@sunweaver
Copy link
Member Author

sunweaver commented Oct 3, 2018 via email

@sunweaver
Copy link
Member Author

sunweaver commented Oct 22, 2018 via email

@sunweaver
Copy link
Member Author

sunweaver commented Oct 22, 2018 via email

@sunweaver
Copy link
Member Author

sunweaver commented Nov 2, 2018 via email

@sunweaver
Copy link
Member Author

sunweaver commented Nov 2, 2018 via email

@sunweaver
Copy link
Member Author

sunweaver commented Nov 3, 2018 via email

@sunweaver
Copy link
Member Author

sunweaver commented Nov 4, 2018 via email

@sunweaver
Copy link
Member Author

sunweaver commented Nov 5, 2018 via email

@sunweaver
Copy link
Member Author

sunweaver commented Nov 9, 2018 via email

@raveit65
Copy link
Member

raveit65 commented Nov 9, 2018

Good news, mate-panel builds without new build warnings now.
I will start to test function with related mate-screensaver PR over the weekend.

@sunweaver
Copy link
Member Author

sunweaver commented Nov 9, 2018 via email

@sunweaver
Copy link
Member Author

sunweaver commented Jan 19, 2019 via email

@lukefromdc
Copy link
Member

I do not like the idea of making remote desktop support (which many NEVER use) mandatory to build mate-panel. Please make this an optional dependency or one which autochecks for remote desktop support and simply disables it if not present

@sunweaver
Copy link
Member Author

sunweaver commented Jan 20, 2019 via email

@lukefromdc
Copy link
Member

OK, no problem. I only looked at the change and not the whole block around it. Sorry for the noise

@sunweaver
Copy link
Member Author

This PR has been included in mate-panel 1.20.4-1 in Debian testing/unstable and Ubuntu disco. Please test.

@lukefromdc
Copy link
Member

I cannot easily test this as I have no remote desktop experience, programs etc. Leaving this for the rest of the team

@sunweaver
Copy link
Member Author

sunweaver commented Jan 22, 2019 via email

@lukefromdc
Copy link
Member

I have no virtual machine experience either, plus no landline so no bandwidth for large downloads. Sorry about it, but I am not in a position to work on remote desktop and virtual machine stuff. Fortunately, we are a team and there are others here who can work on this. I

Copy link
Member

@lukefromdc lukefromdc left a comment

Choose a reason for hiding this comment

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

I tested a rebase of this on mate-panel 1.21.4 this on a local bare metal machine (not testing a remote connection) and ran into a problem: a build with librda not installed built fine, started up fine, but segfaulted on trying to open the "add to panel" dialog. If librda0 and associated packages were installed the resulting build worked just fine on a local session but of course could not open if librda was then uninstalled.

There are two acceptable fixes for this: Since in Debian Unstable this is already included and the package therefore depends on librda (and these packages are tiny, all four of them are just 39.5kB download) we could in fact just go ahead and depend on those packages outright. If distros are including librda by default there is no real reason not to do this, though it is an added hard dependency.

On the other hand, if distros are not including librda in their default images, we really should fix the non-rda enabled build not to segfault on opening the add to panel dialog.

@lukefromdc
Copy link
Member

Got this backtrace on the non-librda build segfault on opening the add to panel dialog. To duplicate, uninstall librda0 and librda-dev, then reconfigure, rebuild, and reinstall. Start the panel, and try to open the add to panel dialog. This is the backtrace from the resulting segfault (in "??"):


(gdb) thread apply all bt full

Thread 5 (Thread 0x7ffff1def700 (LWP 19260)):
#0  0x00007ffff60ba269 in syscall ()
    at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007ffff6900904 in g_cond_wait_until ()
    at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007ffff688cfd1 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007ffff688d571 in g_async_queue_timeout_pop ()
    at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007ffff68e2ce1 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007ffff68e22a5 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#6  0x00007ffff761dfa3 in start_thread (arg=<optimized out>)
    at pthread_create.c:486
        ret = <optimized out>
        pd = <optimized out>
        now = <optimized out>
        unwind_buf = 
              {cancel_jmp_buf = {{jmp_buf = {140737251309312, -7886936750938171689, 140737488347374, 140737488347375, 140737251309312, 0, 7886959023971063511, 7886953090053134039}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#7  0x00007ffff60bf7ef in clone ()

    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 4 (Thread 0x7ffff2d2c700 (LWP 19239)):
#0  0x00007ffff60b4b39 in __GI___poll (fds=0x5555556a3b60, nfds=1, timeout=-1)
    at ../sysdeps/unix/sysv/linux/poll.c:29
        resultvar = 18446744073709551100
        sc_cancel_oldtype = 0
#1  0x00007ffff68ba6fe in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007ffff68ba80c in g_main_context_iteration ()
    at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007ffff7fc6ffd in  ()
    at /usr/lib/x86_64-linux-gnu/gio/modules/libdconfsettings.so
#4  0x00007ffff68e22a5 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007ffff761dfa3 in start_thread (arg=<optimized out>)
    at pthread_create.c:486
        ret = <optimized out>
        pd = <optimized out>
        now = <optimized out>
        unwind_buf = 
              {cancel_jmp_buf = {{jmp_buf = {140737267287808, -7886936750938171689, 140737488347342, 140737488347343, 140737267287808, 0, 7886961191318935255, 7886953090053134039}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}

        not_first_call = <optimized out>
#6  0x00007ffff60bf7ef in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 3 (Thread 0x7ffff35b5700 (LWP 19238)):
#0  0x00007ffff60b4b39 in __GI___poll (fds=0x7fffe4019320, nfds=3, timeout=-1)
    at ../sysdeps/unix/sysv/linux/poll.c:29
        resultvar = 18446744073709551100
        sc_cancel_oldtype = 0
#1  0x00007ffff68ba6fe in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007ffff68baa72 in g_main_loop_run ()
    at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007ffff6ab7186 in  () at /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#4  0x00007ffff68e22a5 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007ffff761dfa3 in start_thread (arg=<optimized out>)
    at pthread_create.c:486
        ret = <optimized out>
        pd = <optimized out>
        now = <optimized out>
        unwind_buf = 
              {cancel_jmp_buf = {{jmp_buf = {140737276237568, -7886936750938171689, 140737488348254, 140737488348255, 140737276237568, 0, 7886962353644459735, 7886953090053134039}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, d
ata = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#6  0x00007ffff60bf7ef in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 2 (Thread 0x7ffff3db6700 (LWP 19237)):
#0  0x00007ffff60b4b39 in __GI___poll (fds=0x5555556047c0, nfds=2, timeout=-1)
    at ../sysdeps/unix/sysv/linux/poll.c:29
        resultvar = 18446744073709551100
        sc_cancel_oldtype = 0
#1  0x00007ffff68ba6fe in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007ffff68ba80c in g_main_context_iteration ()
    at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007ffff68ba851 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007ffff68e22a5 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007ffff761dfa3 in start_thread (arg=<optimized out>)
    at pthread_create.c:486
        ret = <optimized out>
        pd = <optimized out>
        now = <optimized out>
        unwind_buf = 
              {cancel_jmp_buf = {{jmp_buf = {140737284630272, -7886936750938171689, 140737488347886, 140737488347887, 140737284630272, 0, 7886963453692958423, 7
886953090053134039}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#6  0x00007ffff60bf7ef in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7ffff409ca80 (LWP 19233)):
#0  0x00000000000001b8 in  ()
#1  0x00005555555b3d07 in panel_addto_prepend_internal_applets
    (list=0x55555595cc50 = {...}) at panel-addto.c:234
        info = <optimized out>
        i = 8
        translated = 1
        model = <optimized out>
        l = <optimized out>
#2  0x00005555555b3d07 in panel_addto_make_applet_model (dialog=0x555555c8d000)
    at panel-addto.c:481
        model = <optimized out>
        l = <optimized out>
#3  0x00005555555b3d07 in panel_addto_present_applets
    (dialog=dialog@entry=0x555555c8d000) at panel-addto.c:861
#4  0x00005555555b4b75 in panel_addto_present
    (item=<optimized out>, panel_widget=0x5555558982d0) at panel-addto.c:1397

        dialog = 0x555555c8d000
        toplevel = <optimized out>
        pd = 0x5555556508e0
        screen = 0x555555628020
        screen_height = <optimized out>
        height = 490
#5  0x00007ffff699bbbd in g_closure_invoke ()
    at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#6  0x00007ffff69aebd3 in  () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#7  0x00007ffff69b7cae in g_signal_emit_valist ()
    at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#8  0x00007ffff69b8352 in g_signal_emit ()
    at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#9  0x00007ffff720573a in gtk_widget_activate ()
    at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#10 0x00007ffff70e1116 in gtk_menu_shell_activate_item ()
    at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#11 0x00007ffff70e1393 in  () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#12 0x00007ffff7253354 in  () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#13 0x00007ffff699bdf6 in  () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#14 0x00007ffff69b7747 in g_signal_emit_valist ()
    at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#15 0x00007ffff69b8352 in g_signal_emit ()

    at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#16 0x00007ffff72032b4 in  () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#17 0x00007ffff70cc6c6 in  () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#18 0x00007ffff70ce70b in gtk_main_do_event ()
    at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#19 0x00007ffff6ddc105 in  () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#20 0x00007ffff6e0bbc2 in  () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#21 0x00007ffff68ba51e in g_main_context_dispatch ()
    at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#22 0x00007ffff68ba788 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#23 0x00007ffff68baa72 in g_main_loop_run ()
    at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#24 0x00007ffff70cd825 in gtk_main ()
    at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#25 0x00005555555798d9 in main (argc=<optimized out>, argv=<optimized out>)
    at main.c:199
        desktopfile = <optimized out>
        context = <optimized out>
        error = 0x0
        display = <optimized out>
        screen = 0x555555628020
        css = 0x555555863a80
        provider = 0x555555863a80

        resource = 0x5555555c55a8 "/org/mate/panel/theme/mate-panel.css"
        priority = 1

@lukefromdc
Copy link
Member

Any updates on this? Should it be closed for lack of activity, is it still being worked on, or something else?

@sunweaver
Copy link
Member Author

@lukefromdc I have updated the update branch of this PR now. Please revisit. Thanks.

@sunweaver sunweaver force-pushed the pr/rda branch 4 times, most recently from c8ad40a to d3dde14 Compare June 21, 2023 06:50
@lukefromdc
Copy link
Member

Thanks. Checking a build without RDA support (which I do not have installed nor know how to use). Will check wayland for any surprises there

@lukefromdc lukefromdc self-requested a review June 21, 2023 19:07
Copy link
Member

@lukefromdc lukefromdc left a comment

Choose a reason for hiding this comment

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

A second build with librda0/librda-dev etc installed worked fine, though I could only test it running locally. Worked fine in both x11 and in wayland however.

Note that there are remote wayland setups being worked on, though unlike x11 this is not supported by default so at some future time extending this to remote wayland sessions may come up.

I also tested running a librda build with librda removed, naturally this brought up
error while loading shared libraries: librda.so.0: cannot open shared object file: No such file or directory
in terminal. Distros shipping librda builds will have to include librda as a panel dependency as a result. Local builders can built to suit of course.

Approving, it's about time we get this done since there are folks who can use it and the code has been written and updated

@lukefromdc lukefromdc requested review from raveit65, cwendling and zhuyaliang and removed request for monsta July 27, 2023 04:51
@lukefromdc
Copy link
Member

lukefromdc commented Jul 27, 2023

I have had successful LOCAL tests of this, but we need a successful test w a remote desktop (which I am not set up for) to merge this. It's been open for years. Alternately we could close it, and reopen it if interest reappears

@sunweaver
Copy link
Member Author

I have had successful LOCAL tests of this, but we need a successful test w a remote desktop (which I am not set up for) to merge this. It's been open for years. Alternately we could close it, and reopen it if interest reappears

If you are on Debian or Ubuntu, the test is pretty easy:

sudo apt-get install x2goserver
sudo apt-get install pyhoca-cli
pyhoca-cli --server localhost --command MATE

Just tested on a Debian 12 system.

Note: You don't need a remote server to test RDA (via X2Go). You can test it all on localhost.

@lukefromdc
Copy link
Member

lukefromdc commented Aug 7, 2023

Got these results (a fail in starting an X2go session, not in mate-panel) with that test on my system, which is based on Debian Sid:

luke@ubuntu:~$ pyhoca-cli --server localhost --command MATE
pyhoca-cli[176252] NOTICE: preparing requested X2Go session
pyhoca-cli[176252] (PyHocaCLI) NOTICE: preparing requested X2Go session
pyhoca-cli[176252] (x2gosessregistry-pylib) NOTICE: registering X2Go session Pyhoca-Client_Session...
pyhoca-cli[176252] (x2goclient-pylib) NOTICE: initializing X2Go session...
pyhoca-cli[176252] (x2gocontrolsession-pylib) NOTICE: connecting to [localhost]:22
pyhoca-cli: error: a socket error occured while establishing the connection: [Errno None] Unable to connect to port 22 on 127.0.0.1
luke@ubuntu:~$ 

I will clean the packages out of my install but save them in a directory for any future tests if this is fixed

@lukefromdc
Copy link
Member

Any updates on this?

@sunweaver
Copy link
Member Author

Got these results (a fail in starting an X2go session, not in mate-panel) with that test on my system, which is based on Debian Sid:

luke@ubuntu:~$ pyhoca-cli --server localhost --command MATE
pyhoca-cli[176252] NOTICE: preparing requested X2Go session
pyhoca-cli[176252] (PyHocaCLI) NOTICE: preparing requested X2Go session
pyhoca-cli[176252] (x2gosessregistry-pylib) NOTICE: registering X2Go session Pyhoca-Client_Session...
pyhoca-cli[176252] (x2goclient-pylib) NOTICE: initializing X2Go session...
pyhoca-cli[176252] (x2gocontrolsession-pylib) NOTICE: connecting to [localhost]:22
pyhoca-cli: error: a socket error occured while establishing the connection: [Errno None] Unable to connect to port 22 on 127.0.0.1
luke@ubuntu:~$ 

I will clean the packages out of my install but save them in a directory for any future tests if this is fixed

Sorry for the delay in response. I did not see this message any earlier. The error above looks like the test host is not running SSH on port 22 of 127.0.0.1? X2Go communicates everything via SSH.

Mike

@lukefromdc
Copy link
Member

I simply don't know enough about remote work to proceed any further with testing X2go at this point, all of it is outside my experience. Someone who is more familiar with this will need to run a remote test

@lukefromdc
Copy link
Member

Meanwhile, we know this doesn't seem to break anything running locally

@lukefromdc
Copy link
Member

No response on this for almost a year. Should we close it?

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.

4 participants