-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Problems running GNOME on Ubuntu 24.04 LTS #3053
Comments
See https://github.com/matt335672/xrdp/wiki/Running-GNOME-on-Ubuntu-24.04-LTS for a draft solution. @akarl10 - I'd particularly appreciate your comments on this. When this is a bit more official I'll tidy this up a bit. |
I currently dont have a ubuntu 24.04 handy, but I'm sure the solution you proposed works. in short this block if DESKTOP_SESSION=ubuntu-xorg
export DESKTOP_SESSION
if [ -d /usr/share/xsessions ] \
&& [ -f "/usr/share/xsessions/$DESKTOP_SESSION.desktop" ]; then
STARTUP=$(grep ^Exec= "/usr/share/xsessions/$DESKTOP_SESSION.desktop")
STARTUP=${STARTUP#Exec=*}
XDG_CURRENT_DESKTOP=$(grep ^DesktopNames= "/usr/share/xsessions/$DESKTOP_SESSION.desktop")
XDG_CURRENT_DESKTOP=${XDG_CURRENT_DESKTOP#DesktopNames=*}
export XDG_CURRENT_DESKTOP
exec /etc/X11/Xsession "$STARTUP"
fi the other variables should be set by scripts in /etc/X11/Xsession.d by the way: what is currently the Exec= in ubuntu-xorg.desktop? |
Contents of [Desktop Entry]
Name=Ubuntu on Xorg
Comment=This session logs you into Ubuntu
Exec=env GNOME_SHELL_SESSION_MODE=ubuntu /usr/bin/gnome-session --session=ubuntu
TryExec=/usr/bin/gnome-shell
Type=Application
DesktopNames=ubuntu;GNOME;
X-GDM-SessionRegisters=true
X-Ubuntu-Gettext-Domain=gnome-session-46 Running the changes you suggest above results in the following:-
The last one of these above is explained by the value of Variables for exec $SESSIONALTUSERXSESSION='/home/testuser/.Xsession' BASESTARTUP='env' CJKV_DEFAULT_DESKTOP='*' CJKV_LOCALES='zh_TW:zh_HK:zh_SG:zh_CN:ja_JP:ko_KR:vi_VN' CLUTTER_IM_MODULE='ibus' DBUS_SESSION_BUS_ADDRESS='unix:path=/run/user/1001/bus' DEBUGINFOD_URLS='https://debuginfod.ubuntu.com ' DEFAULT_XDG_CONFIG_DIRS='/etc/xdg' DEFAULT_XDG_DATA_DIRS='/usr/local/share/:/usr/share/' DESKTOP_SESSION='ubuntu-xorg' DESKTOP_SETUP_IBUS='GNOME' DISPLAY=':11.0' ERRFILE='/home/testuser/.xsession-errors' GPG_AGENT_INFO='/run/user/1001/gnupg/S.gpg-agent:0:1' GTK_IM_MODULE='ibus' GTK_MODULES='gail:atk-bridge' HOME='/home/testuser' IFS=' ' IMLAUNCH='/usr/bin/im-launch' IM_CONFIG_CODE='run_im' IM_CONFIG_CURRENT_DESKTOP='ubuntu;GNOME;' IM_CONFIG_DATA='/usr/share/im-config/data' IM_CONFIG_DEFAULT='/etc/default/im-config' IM_CONFIG_DEFAULT_MODE='auto' IM_CONFIG_LC_CTYPE='en_US' IM_CONFIG_NAME='default' IM_CONFIG_PHASE='1' IM_CONFIG_PREFERRED='' IM_CONFIG_PREFERRED_RULE='zh_CN,fcitx5:zh_TW,fcitx5:zh_HK,fcitx5:zh_SG,fcitx5' IM_CONFIG_VERBOSE='false' IM_CONFIG_VERSION='0.57-2' IM_CONFIG_XINPUTRC_SYS='/etc/X11/xinit/xinputrc' IM_CONFIG_XINPUTRC_USR='/home/testuser/.xinputrc' LANG='en_US.UTF-8' LOGNAME='testuser' OPTIND='1' OPTIONFILE='/etc/X11/Xsession.options' OPTIONS='# $Id: Xsession.options 189 2005-06-11 00:04:27Z branden $ # # configuration options for /etc/X11/Xsession # See Xsession.options(5) for an explanation of the available options. allow-failsafe allow-user-resources allow-user-xsession use-ssh-agent use-session-dbus' PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin' PPID='7530' PROGNAME='Xsession' PS1='$ ' PS2='> ' PS4='+ ' PULSE_SCRIPT='/etc/xrdp/pulse/default.pa' PWD='/home/testuser' QT_ACCESSIBILITY='1' QT_IM_MODULE='ibus' RESOURCEFILE='/etc/X11/Xresources/x11-common' RESOURCEFILES='/etc/X11/Xresources/x11-common' SESSIONFILE='/etc/X11/Xsession.d/99x11-common_start' SESSIONFILES='/etc/X11/Xsession.d/20dbus_xdg-runtime /etc/X11/Xsession.d/20x11-common_process-args /etc/X11/Xsession.d/30x11-common_xresources /etc/X11/Xsession.d/35x11-common_xhost-local /etc/X11/Xsession.d/40x11-common_xsessionrc /etc/X11/Xsession.d/50x11-common_determine-startup /etc/X11/Xsession.d/55gnome-session_gnomerc /etc/X11/Xsession.d/60x11-common_xdg_path /etc/X11/Xsession.d/70im-config_launch /etc/X11/Xsession.d/90atk-adaptor /etc/X11/Xsession.d/90gpg-agent /etc/X11/Xsession.d/90qt-a11y /etc/X11/Xsession.d/90x11-common_ssh-agent /etc/X11/Xsession.d/90xbrlapi /etc/X11/Xsession.d/99x11-common_start' SHELL='/bin/bash' SSHAGENT='/usr/bin/ssh-agent' SSHAGENTARGS='' STARTSSH='' STARTUP='/usr/bin/ssh-agent /usr/bin/im-launch env GNOME_SHELL_SESSION_MODE=ubuntu /usr/bin/gnome-session --session=ubuntu' STARTUP_FULL_PATH='/usr/bin/env' SYSRESOURCES='/etc/X11/Xresources' SYSSESSIONDIR='/etc/X11/Xsession.d' UID='1001' USER='testuser' USERXSESSION='/home/testuser/.xsession' USERXSESSIONRC='/home/testuser/.xsessionrc' USRRESOURCES='/home/testuser/.Xresources' WRITE_TEST='/tmp/tmp.9XHqym4TKk' XDG_CONFIG_DIRS='/etc/xdg/xdg-ubuntu-xorg:/etc/xdg' XDG_CURRENT_DESKTOP='ubuntu;GNOME;' XDG_DATA_DIRS='/usr/share/ubuntu-xorg:/usr/share/gnome:/usr/local/share:/usr/share:/var/lib/snapd/desktop' XDG_RUNTIME_DIR='/run/user/1001' XDG_SESSION_CLASS='user' XDG_SESSION_ID='c5' XDG_SESSION_TYPE='x11' XMODIFIERS='@im=ibus' XRDP_PULSE_SINK_SOCKET='xrdp_chansrv_audio_out_socket_11' XRDP_PULSE_SOURCE_SOCKET='xrdp_chansrv_audio_in_socket_11' XRDP_SESSION='1' XRDP_SOCKET_PATH='/run/xrdp/sockdir' agent_sock='/run/user/1001/gnupg/S.gpg-agent' brltty='/bin/brltty' drivers_directory='/lib/brltty' echo='printf %s\n' exec_prefix='' prefix='' program_directory='/bin' xbrlapi='/bin/xbrlapi' Having a look through the files in
So I believe it's fair to say that at the moment the X11 session scripts aren't really compatible with GNOME for this OS. |
I'm currently looking through the deb source file of gdm: I'm not a bash guru, but I think this will also run /etc/X11/Xsession.d/ # run /etc/X11/Xsession.d/
OPTIONFILE=/etc/X11/Xsession.options
USERXSESSION=$HOME/.xsession
USERXSESSIONRC=$HOME/.xsessionrc
ALTUSERXSESSION=$HOME/.Xsession
if [ -d /etc/X11/Xsession.d ]; then
for i in `ls /etc/X11/Xsession.d/` ; do
if [ -r "/etc/X11/Xsession.d/$i" -a -f "/etc/X11/Xsession.d/$i" ] && expr "$i" : '^[[:alnum:]_-]\+$' > /dev/null; then
. "/etc/X11/Xsession.d/$i"
fi
done
fi the command passed to this is also the The only other thing is that gdm registers back the session to gdm. but I don't think that has something to do with im-launch issues and blue backgrounds. what could explain the blue background though is that in the Desktop file the separator is maybe something like this makes the background appear? (I'm sure if it does you can come up with a fancier way to do this in bash) XDG_CURRENT_DESKTOP=${XDG_CURRENT_DESKTOP#DesktopNames=*}
XDG_CURRENT_DESKTOP=$( echo $XDG_CURRENT_DESKTOP | tr \; : ) |
I can see that
Then when I log in on the console the session exist immediately and I get an If I do a similar thing in
I get this log:- By manual comparison, the following potentially important variables are present when launched via gdm3 which aren't from xrdp:-
So with that I've put together this #!/bin/sh
export DESKTOP_SESSION=ubuntu-xorg
export GDMSESSION=ubuntu-xorg
export GSM_SKIP_SSH_AGENT_WORKAROUND=true
export GTK_MODULES=gail:atk-bridge
export QT_ACCESSIBILITY=1
export SSH_AUTH_SOCK=/run/user/1001/gnupg/S.gpg-agent.ssh
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
export XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
export XDG_SESSION_DESKTOP=ubuntu-xorg
STARTUP="env GNOME_SHELL_SESSION_MODE=ubuntu /usr/bin/gnome-session --session=ubuntu"
exec /etc/gdm3/Xsession "$STARTUP"
I'll see what can be derived from the desktop file and post back. |
I think easiest way is to use startwm.sh in devel. For test, copy startwm.sh in devel to home directory. Exec following four steps at home directory: If this works, move startwm.sh to /etc/xrdp I tried this, it works. |
that's actually interresting. the only difference I see in ubuntu.desktop and ubuntu-xorg.desktop is the trailing |
Yes. Confirm Description of Key:"OnlyShowIn, NotShowIn" in the following document. The value of XDG_CURRENT_DESKTOP shall be a colon-separated list of strings. startwm.sh in devel is basically follow what @matt335672 wrote in this thread and Dec 16, 2020 post in Confirm line 58 through 73 and line 83 through 187 in By the way, I changed a bit the step. This get the value of DESKTOP_SESSION from local desktop's environment variable DESKTOP_SESSION. This way should work for most Ubuntu based distributions. |
Thanks @Hiero32 - that's a great observation. I was looking into a different way to do this, but sticking with what's in I've reproduced your findings. The session seems to work both with and without a trailing ':' on I've got a couple of minor comments on your process above:-
That gives me a full process of something like this:- cd /tmp
# Set variable for default desktop (if required)
DESKTOP_SESSION=ubuntu
# Replace startwm.sh with development version
wget -q -r -O startwm.sh https://github.com/neutrinolabs/xrdp/raw/devel/sesman/startwm.sh
sudo chmod 755 ./startwm.sh
sudo chown root: ./startwm.sh
sudo mv ./startwm.sh /etc/xrdp
# Create file to set default desktop
echo "[ -n \"\$XRDP_SESSION\" -a -z \"\$DESKTOP_SESSION\" ] && export DESKTOP_SESSION=$DESKTOP_SESSION" > 90-xrdp-default-desktop.sh
sudo chmod 644 ./90-xrdp-default-desktop.sh
sudo chown root: ./90-xrdp-default-desktop.sh
sudo mv ./90-xrdp-default-desktop.sh /etc/profile.d/ And to reverse it:- cd /tmp
wget -q -r -O startwm.sh https://salsa.debian.org/debian-remote-team/xrdp/-/raw/debian/0.9.24-3/debian/startwm.sh
sudo chmod 755 ./startwm.sh
sudo chown root: ./startwm.sh
sudo mv ./startwm.sh /etc/xrdp
sudo rm -f /etc/profile.d/90-xrdp-default-desktop.sh These can be copied directly from Github using the copy button and pasted into a terminal. |
Thank you for the correction. When login is done from GDM and go into desktop environment (e.g. ubuntu desktop), DESKTOP_SESSION is set. When login is done from ssh connected console, DESKTOP_SESSION is empty. There is an important thing regarding XDG_DATA_DIRS. |
Thanks for the clarification @Hiero32 At some point I'd like to change the way that startwm.sh is run from sesman so that a login shell is always invoked first. That will save us needing to explicitly call /etc/profile and ~/.bashrc - not everyone uses these. That's however a change for another day I think. |
Just a drive by comment: I'm having similar issues with using the Gnome session on Ubuntu 24.04 locally (no xrdp, I just installed the Would patching |
startwm.sh is executed only in the xrdp session. |
I'm not sure if this functionality is useful for may users... GDM and LightDM save current setting of selected desktop environment (DE) per user using AccountsService of freedesktop.org. Following "90-xrdp-default-desktop.sh" works in Ubuntu 24.04 and 22.04.
if [ -n "$XRDP_SESSION" -a -z "$DESKTOP_SESSION" ]; then
SAVEDSESSION=$(busctl get-property org.freedesktop.Accounts /org/freedesktop/Accounts/User$(id -u) org.freedesktop.Accounts.User Session | cut -d\" -f2)
if [ -f /usr/share/xsessions/${SAVEDSESSION}.desktop ]; then
export DESKTOP_SESSION=$SAVEDSESSION
else
export DESKTOP_SESSION=ubuntu
fi
fi
It is possible to switch DE per user, using above 90-xrdp-default-desktop.sh.
With this way, I use gnome-flashback DE and other users use ubuntu DE on the same server. Following "90-xrdp-default-desktop.sh" works in many derivatives base on Ubuntu 24.04/22.04/20.04 and Debian 12/11 which use GDM or LigthDM as display manager.
if [ -n "$XRDP_SESSION" -a -z "$DESKTOP_SESSION" ]; then
DESKTOPS=$(ls -1 /usr/share/xsessions | sed -n -e "s/\.desktop$//p")
DESKTOP_SESSION=$(echo "$DESKTOPS" | head -n1)
if [ "$(echo "$DESKTOPS" | wc -l)" != "1" ]; then
SESSIONPROP=XSession
if cat /etc/X11/default-display-manager | grep -sq gdm3; then
if [ $(/usr/sbin/gdm3 --version | cut -d" " -f2 | cut -d. -f1) -ge 40 ]; then SESSIONPROP=Session; fi
fi
SAVEDSESSION=$(busctl get-property org.freedesktop.Accounts /org/freedesktop/Accounts/User$(id -u) org.freedesktop.Accounts.User $SESSIONPROP | cut -d\" -f2)
if [ -f /usr/share/xsessions/${SAVEDSESSION}.desktop ]; then
DESKTOP_SESSION=$SAVEDSESSION
else
for DESKTOP in $DESKTOPS; do
if [ x$DESKTOP = xubuntu ]; then DESKTOP_SESSION=ubuntu; break
elif [ x$DESKTOP = xgnome ]; then DESKTOP_SESSION=gnome; fi
done
fi
fi
export DESKTOP_SESSION
fi
It is possible to set DE from command line, even in xrdp session. Following commands are examples. |
I've been having random issues when logging into a 24.04 Hyper-V VM. I compiled everything, everything works well once the session is logged in, but there's a random chance it'll just hang after authentication. Just a black screen and a X cursor. xrdp logs show a successful connection. |
I faced the same issue. When this issue occurs, try to login via ssh, and issue following command.
If this works, issue following command as workaround. This works good in my environment.
This issue occurs only in Ubuntu 24.04 ubuntu/gnome desktop, even in local login. |
@Hiero32 Thank you very much for taking the time to respond to me with so much detail. That solved my issues. |
@Hiero32 Any more detail on this issue? Or on any possible permanent fix for this issue? Thanks again for your workaround it's been very helpful. :-) |
@Kizan |
@Kizan - did you try the link in this comment? |
xrdp version
0.9.24
Detailed xrdp version, build options
Operating system & version
Ubuntu 24.04 LTS
Installation method
dnf / apt / zypper / pkg / etc
Which backend do you use?
Either
What desktop environment do you use?
No response
Environment xrdp running on
All
What's your client?
All
Area(s) with issue?
Other
Steps to reproduce
Install xrdp + xorgxrdp on a clean installation of Ubuntu 24.04
✔️ Expected Behavior
Desktop works
❌ Actual Behavior
The following problems are encountered:-
gnome-terminal
) take 30 seconds or so to startsystemctl --user status --state=failed
in a terminal window shows the following problems:-Anything else?
No response
The text was updated successfully, but these errors were encountered: