Hello all. I’m pretty new to linux but i’ve been enjoying learning my way around. I recently wanted to try sway just to see what tiling WM are all about and it’s been working pretty well for me. My issue is whenever I try to launch btrfs-assistant I get the following output:
Authorization required, but no authorization protocol specified
qt.qpa.xcb: could not connect to display :1
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.
/usr/bin/btrfs-assistant: line 42: 17224 Aborted (core dumped) btrfs-assistant-bin ${params}
I have tried reinstalling the package but i get the same error. Can anyone point me in the right direction?
Thanx
Darn… besides pointing out my “usual” advice on “terrible practices” @dalto, could you please be so kind (now and in the future) to point out what is right, instead? - Thank you from a poor penguin, just uttering “nonsense” in your eyes, not using any “butter-fs” themselves!? - Thank you again.
You need to research the actual issue. In this case “no authorization protocol specified” doesn’t mean “run it with sudo”.
There is no universal cause to the problem. I suspect the solution that @Brtza proposed will solve the issue. If not, we can keep working from there.
In general, it is true that “running things with sudo” when they fail is a terrible practice. However, the right thing to do will vary based on the specific situation.
Ah, ok. Thanks for your clarification. I’ve been missing this from you quite often in the past, while standing corrected without exactly knowing why, @dalto.
hmm, i think i tried that. please let me know if I did this wrong but in fish i type set QT_QPA_PLATFORM wayland
I am still getting the same message tho
I am not really a fish expert but I think that only sets it for the current terminal session.
If you don’t have QT_QPA_PLATFORM set in your environment, I don’t think this will work.
Neither of those should work. If you want to run it with sudo manually you can use sudo -E btrfs-assistant-bin but be aware that puts your entire environment in the root session.
This is the correct way. Did you have QT_QPA_PLATFORM properly set and available to that command when you ran it?
Meaning that where and when you set an environment variable matters. If you open a terminal and type QT_QPA_PLATFORM="wayland", it is only available to that terminal session so it may not be available to btrfs assistant depending on how you run it and where you run it from.
I see. Okay im trying to figure this out with google searches so please lmk if I’m on the right path. I need to edit the .bashrc file to include a line that reads export QT_QPA_PLATFORM=wayland Is that correct?
That is a surprising result. I would double-check for a mistake.
Alternatively, a simple and effective way for setting environment variables when launching Sway is to create a wrapper script as described in the greetd wiki:
How to set XDG_SESSION_TYPE=wayland/…?
While you could set this in your .profile, the recommended way to handle this is with a wrapper script. Doing it this way allows you to start multiple login environments without having weird env vars mess with things.
/usr/local/bin/sway-run (should be made executable)
#!/bin/sh
# Session
export XDG_SESSION_TYPE=wayland
export XDG_SESSION_DESKTOP=sway
export XDG_CURRENT_DESKTOP=sway
# Wayland stuff
export MOZ_ENABLE_WAYLAND=1
export QT_QPA_PLATFORM=wayland
export SDL_VIDEODRIVER=wayland
export _JAVA_AWT_WM_NONREPARENTING=1
exec sway $@
#
# If you use systemd and want sway output to go to the journal, use this
# instead of the `exec sway $@` above:
#
# exec systemd-cat --identifier=sway sway $@
#
Simply use sway-run instead of sway to log in.
You don’t need to be using greetd to use this method, the important thing is to launch Sway with the script (instead of just sway) with whatever method you use to start the session.
If someone has the same problem in Hyprland, first check whether from the command line this works:
QT_QPA_PLATFORM=wayland btrfs-assistant-launcher
It should. To make it permanent, it’s useless to put the environment variable in .zshenv for example. You have to make sure Hyprland starts with the environment variable, so you should put this in your .config/hypr/hyprland.conf:
env = QT_QPA_PLATFORM,wayland
Then, restart Hyprland and you can launch also from the desktop launcher.