Score:3

Cannot start gnome-session after enabling Systemd on latest WSL2

gh flag

I'm using Ubuntu 22.04.01 on WSL2 on Windows 11 22H2 with Systemd support. However, though I've followed all the instructions mentioned in this answer, I still can't start gnome-session properly. It only shows an "Oh no! something went wrong!" sign like this.

enter image description here

I checked the logs and saw the following messages, not sure if it is relevant:

misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -2
Score:1
gp flag

i) CONFIGURE WINDOWS

  • First, update Windows to the latest version.
  • Then Install 2022-11 Cumulative Update Preview for Windows 10 22H2 for x64-based Systems (KB5020030)
  • Check that your OS build is at least 19045.2311. If the second part after the period is < 2311, then you have not installed the preview and nothing will work properly. This step is crucial to get WSLg working properly.

https://support.microsoft.com/en-gb/topic/november-15-2022-kb5020030-os-builds-19042-2311-19043-2311-19044-2311-and-19045-2311-preview-237a9048-f853-4e29-a3a2-62efdbea95e2

  • Go to control panel->programs->turn windows features on or off. Make sure Virtual Machine Platform is checked on.
  • Go to your BIOS. Make sure virtualization is enabled in BIOS (on AMD it is called SVM)

ii) CONFIGURE UBUNTU ON WSL

  • add to /etc/wsl.conf
[boot]
systemd=true
  • Create the file /etc/pam.d/system/systemd-user
# This file is part of systemd.
#
# Used by systemd --user instances.

@include common-account

session  required pam_loginuid.so
session  required pam_limits.so
@include common-session-noninteractive
session optional pam_systemd.so
  • Stop WSL with "wsl --shutdown" and then restart with "wsl"

  • sudo apt install ubuntu-desktop acpi-support-

ubuntu-desktop tries to install acpi-support. This will literally brick your distro to an unrecoverable state, yielding a catastrophic error when you attempt to run WSL. Do not forget to add the "-" sign to tell apt to ignore this dependency otherwise you'll have to delete the distro and reinstall.

  • sudo systemctl stop gdm.service

Failure to prevent gdm running will cause all sorts of errors when you try to run a gnome-shell.

  • sudo systemctl disable gdm.service

  • Add the following to the system startup - it needs to be executed with elevated privileges. I enabled systemd's rc-local compatibility service and then added them to /etc/rc.local. Just be sure to chmod 700 /etc/rc.local

mount -o rw,remount /tmp/.X11-unix/
chmod +t /tmp/.X11-unix
chmod o+rw /dev/dri/renderD128
/usr/libexec/at-spi-bus-launcher --launch-immediately &
  • Stop WSL with "wsl --shutdown" and then restart with "wsl"

  • Add the following to your .bashrc

XDG_SESSION_TYPE=x11 gnome-session --disable-acceleration-check --session=ubuntu --systemd-service > /dev/null 2>&1
  • Now run gnome-shell with the following command. Adapt the resolution to your preference.
MUTTER_DEBUG_DUMMY_MODE_SPECS=2400x1300 gnome-shell --nested --no-x11 2> /dev/null &

Screenshot

Martin Rüegg avatar
ru flag
In my case, it did not work when running the boot script mentioned above. Additionally, when removing the `--disable-acceleration-check` argument from the XDG_SESSION_TYPE variable, the performance was smoother. Furthermore, the entire value of the XDG_SESSION_TYPE had to be enclosed in single quotes like so: `XDG_SESSION_TYPE='x11 gnome-session --disable-acceleration-check --session=ubuntu --systemd-service > /dev/null 2>&1'` as otherwise the output redirection would happen during the login script, not the start of the session.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.