Skip to content
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

can't run with root GUI Qt6 apps like Calamares #1418

Closed
AngryPenguinPL opened this issue Dec 30, 2024 · 4 comments
Closed

can't run with root GUI Qt6 apps like Calamares #1418

AngryPenguinPL opened this issue Dec 30, 2024 · 4 comments

Comments

@AngryPenguinPL
Copy link

Some GUI applications like Calamares require root to run.

Unfortunately, when trying to run Calamares compiled in Qt6 a crash occurs. When run calamates with pkexec it show root password prompt and after pressing enter it just crash with logs below. Worth to add Calamares is an important application because it is the system installer in my distribution

pkexec calamares
Failed to create wl_display (No such file or directory)
qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
Authorization required, but no authorization protocol specified

qt.qpa.xcb: could not connect to display :0
qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.
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, vkkhrdisplay, vnc, xcb, wayland-egl, wayland.
Aborted (core dump)

Here is dump:

kernel: tokio-runtime-w[33988]: segfault at 7fe277e00990 ip 00007fe2c4c2d13e sp 00007fe2bcdfcbf0 error 4 in libc.so.6[7fe2c4bc3000+160000] likely on CPU 4 (core 4, socket 0)
gru 30 16:08:40 openmandriva-cooker kernel: Code: 54 24 f8 c3 0f 1f 84 00 00 00 00 00 41 57 41 56 41 55 41 54 55 53 48 83 ec 48 64 48 8b 04 25 28 00 00 00 48 89 44 24 38 31 c0 <8b> 87 d0 02 00 00 85 c0 0f 88 44 01 00 00 49 89 ff 48 39 bf 20 06
gru 30 16:08:40 openmandriva-cooker systemd-coredump[33991]: Process 33988 (tokio-runtime-w) of user 1001 terminated abnormally with signal 11/SEGV, processing...
gru 30 16:08:40 openmandriva-cooker systemd[1]: Started [email protected] - Process Core Dump (PID 33991/UID 0).
gru 30 16:08:40 openmandriva-cooker systemd[1]: Started [email protected] - Pass systemd-coredump journal entries to relevant user for potential DrKonqi handling.
gru 30 16:08:41 openmandriva-cooker systemd-coredump[34002]: [🡕] Process 33988 (tokio-runtime-w) of user 1001 dumped core.

                                                             Stack trace of thread 33988:
                                                             #0  0x00007fe2c4c2d13e __pthread_clockjoin_ex (libc.so.6 + 0x9213e)
                                                             #1  0x00007fe29e5fa370 atexit_handler (libgallium-24.3.2.so + 0x15fa370)
                                                             #2  0x00007fe2c4bdc6f1 __run_exit_handlers (libc.so.6 + 0x416f1)
                                                             #3  0x00007fe2c4bdc7aa exit (libc.so.6 + 0x417aa)
                                                             #4  0x000055d2325bb715 _ZN3std3sys3pal4unix2os4exit17h2eaceba71739a001E.llvm.5041031789551759680 (/usr/bin/cosmic-app-library + 0x1436715)
                                                             #5  0x000055d2325b6154 _ZN3std7process4exit17h0f372b90c3e7b949E (/usr/bin/cosmic-app-library + 0x1431154)
                                                             #6  0x000055d231c3f632 _ZN86_$LT$cosmic_app_library..app..CosmicAppLibrary$u20$as$u20$cosmic..app..Application$GT$6update28_$u7b$$u7b$closure$u7d$$u7d$17hcd0f70b3e6829b4fE.llvm.4824241284892965949 (/usr/bin/cosmic-app-library + 0xaba632)
                                                             #7  0x000055d231c35f86 _ZN5tokio7runtime4task4core17Core$LT$T$C$S$GT$4poll17hb4ed8872450cab84E (/usr/bin/cosmic-app-library + 0xab0f86)
                                                             #8  0x000055d231e3c0c0 _ZN5tokio7runtime4task7harness20Harness$LT$T$C$S$GT$4poll17hd5546bd1bb1de2ccE (/usr/bin/cosmic-app-library + 0xcb70c0)
                                                             #9  0x000055d232695fcb _ZN5tokio7runtime9scheduler12multi_thread6worker7Context8run_task17hdfac0667a50e74f1E (/usr/bin/cosmic-app-library + 0x1510fcb)
                                                             #10 0x000055d232694d27 _ZN5tokio7runtime9scheduler12multi_thread6worker7Context3run17h0a022f011d7cbc5aE (/usr/bin/cosmic-app-library + 0x150fd27)
                                                             #11 0x000055d2326ad5c6 _ZN5tokio7runtime7context6scoped15Scoped$LT$T$GT$3set17h1a3ca599a91f4166E (/usr/bin/cosmic-app-library + 0x15285c6)
                                                             #12 0x000055d2326b0cd9 _ZN5tokio7runtime7context7runtime13enter_runtime17he0cb9356ee1192f5E (/usr/bin/cosmic-app-library + 0x152bcd9)
                                                             #13 0x000055d232694ba0 _ZN5tokio7runtime9scheduler12multi_thread6worker3run17h19b0b045016b549aE (/usr/bin/cosmic-app-library + 0x150fba0)
                                                             #14 0x000055d23268b4f1 _ZN102_$LT$tokio..runtime..blocking..task..BlockingTask$LT$T$GT$$u20$as$u20$core..future..future..Future$GT$4poll17h420c12ffc48f4c91E (/usr/bin/cosmic-app-library + 0x15064f1)
                                                             #15 0x000055d2326a8a88 _ZN5tokio7runtime4task4core17Core$LT$T$C$S$GT$4poll17hd21c8a6ef2f8af0dE (/usr/bin/cosmic-app-library + 0x1523a88)
                                                             #16 0x000055d232687e44 _ZN5tokio7runtime4task7harness20Harness$LT$T$C$S$GT$4poll17h034c7446f5ee39f3E (/usr/bin/cosmic-app-library + 0x1502e44)
                                                             #17 0x000055d2326a3901 _ZN5tokio7runtime8blocking4pool5Inner3run17hb3b8d2a111ff44cfE (/usr/bin/cosmic-app-library + 0x151e901)
                                                             #18 0x000055d23269ac43 _ZN3std3sys9backtrace28__rust_begin_short_backtrace17hd3343e86091f5116E (/usr/bin/cosmic-app-library + 0x1515c43)
                                                             #19 0x000055d2326aa095 _ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hc348d70640b3733fE (/usr/bin/cosmic-app-library + 0x1525095)
                                                             #20 0x000055d2325bc97b _ZN3std3sys3pal4unix6thread6Thread3new12thread_start17h1e6e23ace8cd5174E (/usr/bin/cosmic-app-library + 0x143797b)
                                                             #21 0x00007fe2c4c2b72a start_thread (libc.so.6 + 0x9072a)
                                                             #22 0x00007fe2c4ca8258 __clone3 (libc.so.6 + 0x10d258)
                                                             ELF object binary architecture: AMD x86-64
gru 30 16:08:41 openmandriva-cooker systemd[1]: [email protected]: Deactivated successfully.
gru 30 16:08:41 openmandriva-cooker systemd[1]: [email protected]: Consumed 1.032s CPU time, 144.8M memory peak.
gru 30 16:08:41 openmandriva-cooker /usr/libexec/gdm-wayland-session[8916]: 2024-12-30T15:08:41.712889Z  WARN cosmic-osd: cosmic_session: polkit-agent-helper-1: pam_authenticate failed: Authentication failure
gru 30 16:08:41 openmandriva-cooker polkit-agent-helper-1[34020]: pam_unix(polkit-1:auth): conversation failed
gru 30 16:08:41 openmandriva-cooker cosmic-session[8916]: polkit-agent-helper-1: pam_authenticate failed: Authentication failure
gru 30 16:08:41 openmandriva-cooker polkit-agent-helper-1[34020]: pam_unix(polkit-1:auth): auth could not identify password for [x]

If I run calamares as basic root from console

su -
calamates
Process 42473 (calamares) of user 0 terminated abnormally with signal 6/ABRT, processing...
gru 30 16:24:35 openmandriva-cooker systemd[1]: Started [email protected] - Process Core Dump (PID 42475/UID 0).
gru 30 16:24:35 openmandriva-cooker systemd[1]: Started [email protected] - Pass systemd-coredump journal entries to relevant user for potential DrKonqi handling.
gru 30 16:24:35 openmandriva-cooker systemd-coredump[42476]: [🡕] Process 42473 (calamares) of user 0 dumped core.

                                                             Stack trace of thread 42473:
                                                             #0  0x00007fb7ae8a246c __pthread_kill_implementation (libc.so.6 + 0x9246c)
                                                             #1  0x00007fb7ae84f1d2 raise (libc.so.6 + 0x3f1d2)
                                                             #2  0x00007fb7ae8384b0 abort (libc.so.6 + 0x284b0)
                                                             #3  0x00007fb7af064436 _Z6qAbortv (libQt6Core.so.6 + 0x264436)
                                                             #4  0x00007fb7af06a1b7 _ZL10qt_message9QtMsgTypeRK18QMessageLogContextPKcP13__va_list_tag (libQt6Core.so.6 + 0x26a1b7)
                                                             #5  0x00007fb7af0722b7 _ZNK14QMessageLogger5fatalEPKcz (libQt6Core.so.6 + 0x2722b7)
                                                             #6  0x00007fb7af91bfa6 _ZL13init_platformRK7QStringS1_S1_RiPPc (libQt6Gui.so.6 + 0x31bfa6)
                                                             #7  0x00007fb7af917a90 _ZN22QGuiApplicationPrivate25createPlatformIntegrationEv (libQt6Gui.so.6 + 0x317a90)
                                                             #8  0x00007fb7af91e87f _ZN22QGuiApplicationPrivate21createEventDispatcherEv (libQt6Gui.so.6 + 0x31e87f)
                                                             #9  0x00007fb7af1021da _ZN23QCoreApplicationPrivate4initEv (libQt6Core.so.6 + 0x3021da)
                                                             #10 0x00007fb7af915abe _ZN22QGuiApplicationPrivate4initEv (libQt6Gui.so.6 + 0x315abe)
                                                             #11 0x00007fb7b04d2851 _ZN19QApplicationPrivate4initEv (libQt6Widgets.so.6 + 0x2d2851)
                                                             #12 0x0000561bfcabc022 _ZN20CalamaresApplicationC1ERiPPc (/usr/bin/calamares + 0x1af022)
                                                             #13 0x0000561bfcaba6f1 main (/usr/bin/calamares + 0x1ad6f1)
                                                             #14 0x00007fb7ae839ce8 __libc_start_call_main (libc.so.6 + 0x29ce8)
                                                             #15 0x00007fb7ae839da5 __libc_start_main (libc.so.6 + 0x29da5)
                                                             #16 0x0000561bfcab9091 _start (/usr/bin/calamares + 0x1ac091)

                                                             Stack trace of thread 42474:
                                                             #0  0x00007fb7ae910266 ppoll (libc.so.6 + 0x100266)
                                                             #1  0x00007fb7ad73c9cc g_main_context_iterate_unlocked (libglib-2.0.so.0 + 0xab9cc)
                                                             #2  0x00007fb7ad7a61e8 g_main_context_iteration (libglib-2.0.so.0 + 0x1151e8)
                                                             #3  0x00007fb7af3d794e _ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE (libQt6Core.so.6 + 0x5d794e)
                                                             #4  0x00007fb7af10ce65 _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE (libQt6Core.so.6 + 0x30ce65)
                                                             #5  0x00007fb7af21ce27 _ZN7QThread4execEv (libQt6Core.so.6 + 0x41ce27)
                                                             #6  0x00007fb7af4b8395 _ZN22QDBusConnectionManager3runEv (libQt6DBus.so.6 + 0x52395)
                                                             #7  0x00007fb7af2c1aca _ZN14QThreadPrivate5startEPv (libQt6Core.so.6 + 0x4c1aca)
                                                             #8  0x00007fb7ae8a072a start_thread (libc.so.6 + 0x9072a)
                                                             #9  0x00007fb7ae91d258 __clone3 (libc.so.6 + 0x10d258)
                                                             ELF object binary architecture: AMD x86-64

Trying also running it via lxqt-sudo but then I see this:

lxqt-sudo calamares
lxqt-sudo: Stripping child environment except for: DISPLAY,GDK_DPI_SCALE,GDK_SCALE,GTK_CSD,GTK_OVERLAY_SCROLLING,LANG,LANGUAGE,LC_ADDRESS,LC_ALL,LC_COLLATE,LC_CTYPE,LC_IDENTIFICATION,LC_MEASUREMENT,LC_MESSAGES,LC_MONETARY,LC_NAME,LC_NUMERIC,LC_PAPER,LC_TELEPHONE,LC_TIME,PATH,QT_PLATFORM_PLUGIN,QT_QPA_PLATFORMTHEME,QT_SCALE_FACTOR,TERM,WAYLAND_DISPLAY,XAUTHLOCALHOSTNAME,XAUTHORITY
[sudo] password for x:
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
Failed to create wl_display (No such file or directory)
qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
Authorization required, but no authorization protocol specified

qt.qpa.xcb: could not connect to display :0
qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.
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, vkkhrdisplay, vnc, xcb, wayland-egl, wayland.

Maybe there is some problems with error: XDG_RUNTIME_DIR is invalid or not set in the environment. ?

Here all comsic packages installed:

rpm -qa|grep cosmic
cosmic-reader-0.1.0+git20241022-0.x86_64
cosmic-ext-tweaks-0.1.3-1.x86_64
cosmic-settings-daemon-1.0.0-0.alpha4.0.x86_64
cosmic-randr-1.0.0-0.alpha4.0.x86_64
cosmic-icons-1.0.0-0.alpha4.0.noarch
cosmic-applets-1.0.0-0.alpha4.0.x86_64
cosmic-comp-1.0.0-0.alpha4.0.x86_64
cosmic-greeter-1.0.0-0.alpha4.0.x86_64
cosmic-applet-app-list-1.0.0-0.alpha4.0.noarch
cosmic-applet-audio-1.0.0-0.alpha4.0.noarch
cosmic-applet-battery-1.0.0-0.alpha4.0.noarch
cosmic-applet-bluetooth-1.0.0-0.alpha4.0.noarch
cosmic-applet-input-sources-1.0.0-0.alpha4.0.noarch
cosmic-applet-launcher-button-1.0.0-0.alpha4.0.noarch
cosmic-applet-minimize-1.0.0-0.alpha4.0.noarch
cosmic-applet-network-1.0.0-0.alpha4.0.noarch
cosmic-applet-notifications-1.0.0-0.alpha4.0.noarch
cosmic-applet-panel-button-1.0.0-0.alpha4.0.x86_64
cosmic-applet-power-1.0.0-0.alpha4.0.noarch
cosmic-applet-status-area-1.0.0-0.alpha4.0.noarch
cosmic-applet-tiling-1.0.0-0.alpha4.0.noarch
cosmic-applet-time-1.0.0-0.alpha4.0.noarch
cosmic-applet-workspaces-1.0.0-0.alpha4.0.noarch
cosmic-settings-1.0.0-0.alpha4.0.x86_64
cosmic-player-0.1.0+git20241207-0.x86_64
xdg-desktop-portal-cosmic-1.0.0-0.alpha4.0.x86_64
cosmic-workspaces-1.0.0-0.alpha4.0.x86_64
cosmic-wallpapers-1.0.0-0.alpha.4.0.x86_64
cosmic-term-1.0.0-0.alpha4.0.x86_64
cosmic-store-1.0.0-0.alpha.4.0.x86_64
cosmic-session-1.0.0-0.alpha4.0.x86_64
cosmic-screenshot-1.0.0-0.alpha4.0.x86_64
cosmic-panel-1.0.0-0.alpha4.0.x86_64
cosmic-osd-1.0.0-0.alpha4.0.x86_64
cosmic-notifications-1.0.0-0.alpha4.0.x86_64
cosmic-launcher-1.0.0-0.alpha4.0.x86_64
cosmic-files-1.0.0-0.alpha4.0.x86_64
cosmic-edit-1.0.0-0.alpha4.0.x86_64
cosmic-bg-1.0.0-0.alpha4.0.x86_64
cosmic-applibrary-1.0.0-0.alpha4.0.x86_64
cosmic-idle-1.0.0-0.alpha4.0.x86_64

I don't know how to fix it, maybe I forgot something?

@git-f0x
Copy link

git-f0x commented Dec 31, 2024

Apps cannot run as root by default on Wayland.
That security feature can be disabled by running xhost +SI:localuser:root, but isn't recommended for general usage.
For something like an installer, it's fine, and is used for the Pop!_OS 24.04 installer.

@AngryPenguinPL
Copy link
Author

Us any way to opt it globally for COSMIC?
This problem affects more than one Calamares application. Gparted, iso imagewriter and a few others.
I wonder why it works successfully in gnome for example and not in cosmic.

@mmstick
Copy link
Member

mmstick commented Jan 11, 2025

This will not be supported globally by XWayland by default. It is intentionally disabled for security reasons. Even in GNOME. To circumvent that security measure to run X11 applications as root in XWayland, see https://wiki.archlinux.org/title/Running_GUI_applications_as_root#Wayland. In general, applications should not be designed to run as root anymore. Image writers and disk management utilities do not need root. See Popsicle and GNOME disks, for example.

sudo -EH gparted

@mmstick mmstick closed this as not planned Won't fix, can't repro, duplicate, stale Jan 11, 2025
@GloriousEggroll
Copy link

GloriousEggroll commented Mar 22, 2025

I just ran into this from a user who was not able to run the nobara updater tool gui

the updater tool re-runs itself with pkexec, sending user info to the new pkexec's process so that it can update both system packages and system + user flatpaks.

We also have an auto-mounting tool which allows fast mount/dismount of disks via checkbox if users are in the wheel/admin group via the mount command (which requires root).

What I'm gathering from this decision is that rather than pkexec'ing the entire applications.. users will have to type in their password every time a gui wants to perform a root requiring action, and pray the gui only has to run a command and not render anything as root..

For now seems easiest way to get around this xhost si:localuser:root xhost -si:localuser:root.. per the docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants