I have spent much of my professional life using and administering first UNIX and most recently Linux systems: but since my retirement almost 3 years ago I have been working mostly on Windows computers: Windows 10 and now Windows 11.
Due to illness I am currently bedridden and cannot work at my main Windows 11 notebook but installed Linux Mint 21 on a small notebook which fits on my bedside table. I also have a 10-inch Android tablet in an overhead holder. I end up working on the Linux notebook directly, perched on my right elbow (which quickly gets tiring) or lying on my back using remote desktop software on the Android tablet, in both cases using Rii i4 mini keyboard with touchpad, via a 2,4GHz dongle on the notebook and via Bluetooth on the tablet.
I tried a variety of different Android remote desktop apps (RDP with xrdp on the Linux machine, VNC, and finally Chrome Remote Desktop. None are ideal, mostly to do with the way they handle screen resolution differences between the notebook (1366×768) and the tablet (2560×1600), but I have finally settled on Chrome Remote Desktop.
The desktop environments on Linux Mint, both the default Cinnamon and my preferred Mate Desktop environments, by default balk at the attempt to run both a local and a remote session for the same user. This is a nuisance, because I may have some lengthy process running on the local session and want to log into a remote session on the tablet (for example, to relieve my elbow). The error message shown in a pop-up is, “Could not acquire name on session bus“.
Trusty Google to the rescue: the “official” fix is to add “unset DBUS_SESSION_BUS_ADDRESS” to either /etc/xrdp/startwm.sh (for RDP connections) or $HOME/.vnc/xstartup (for VNC connections) just before the command which starts the session (in my case, /usr/bin/mate-session), or to put a file with that command into /etc/X11/Xsession.d. The filename does not matter as long as it starts with “00” and thus sorts before all the other files in that directory.
But if you ever want to start a remote session with some other tool which uses neither of these startup files, there is another way around this problem:
Rename the original /usr/bin/mate-session file to /usr/bin/mate-session-bin, and using your favorite editor, create a new file /usr/bin/mate-session with this content:
#!/bin/sh
unset DBUS_SESSION_BUS_ADDRESS
exec /usr/bin/mate-session-bin $@
Make the file executable with chmod +x /usr/bin/mate-session and you are all set. The same method can be used with other desktop session startup files.
In one way the method of modifying the startup scripts or adding a snippett to /etc/X11/Xsession.d is probably the safer method, as your /usr/bin/mate-session file will sooner or later get overwritten by an updated version of the Mate system package.