Score:1

Running Synaptic under WSL

cn flag

I'm running Ubuntu 20.04 LTS on WSL on Windows 11. I installed the synaptic package manager and tried to run it through sudo synaptic, but it gives me this as a result:

Unable to init server: Could not connect: Connection refused
Failed to initialize GTK.

Probably you're running Synaptic on Wayland with root permission.
Please restart your session without Wayland, or run Synaptic without root permission

How can I run Synaptic with sudo in Ubuntu under WSL?

Score:0
cn flag

if xhost +si:localuser:root synaptic not working, you probably should login using the Xorg session because Wayland does not allow gui applications to run in superuser mode. take a look at this Unix & Linux answer

Score:0
vn flag

I initially had almost the same message when attempting to reproduce, and in my case it was due to some experimentation I was doing with Systemd under WSL. The funny thing was, that Systemd work was in a completely different WSL instance, but it had corrupted the WSLg X11 socket.

As a result, Synaptic was attempting to run using the Wayland socket instead.

Are you using any Systemd script, such as Genie or WSL2Hacks, by any chance? if so, try without it. Remove the Systemd script, exit Ubuntu, issue wsl --shutdown, and restart.

Also check:

  • Can you run other X11 apps? Try:

    sudo apt install xterm
    xterm
    

    Does that work?

  • echo $DISPLAY -- WSL2 with WSLg should automatically set this to :0.

  • ls -lah /tmp -- Does .X11-unix -> /mnt/wslg/.X11-unix exist there? If it doesn't point to /mnt/wslg/.X11-unix, then your X11 socket is still not fixed. systemd-tmpfiles does overwrite this, but there could be other reasons.

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.