Pkexec not prompting for password

Hello good folks,

I’m hoping someone might be able to point me in the right direction. I have recently installed XAMPP (manually instead of the arch package), which is currently installed in /opt/lampp. This software comes with a GUI control panel which may be executed in terminal with sudo /opt/lampp/manager-linux-x64.run. However, I do not wish to load a terminal window every time I want to load the GUI control panel, so some searching led me to Using pkexec on the Arch Linux Wiki. When I follow the directions and execute pkexec env WAYLAND_DISPLAY="$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" XDG_RUNTIME_DIR=/run/user/0 /opt/lampp/manager-linux-x64.run in the terminal, I get this output:

> pkexec env WAYLAND_DISPLAY="$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" XDG_RUNTIME_DIR=/run/user/0 /opt/lampp/manager-linux-x64.run
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ====
Authentication is needed to run `/usr/bin/env WAYLAND_DISPLAY=/run/user ... er/0 /opt/lampp/manager-linux-x64.run' as the super user
Authenticating as: Shaya (shaya)
Password: 
==== AUTHENTICATION COMPLETE ====
Unknown Error no display name and no $DISPLAY environment variable

If I click on the menu icon on the top-left corner, and type in the same command in the search, and then click to execute in KDE, nothing happens:

I’m at a total loss on how to figure this out. Back in the day I used to use kdesu or gksu but I understand these tools are now deprecated/not recommended and that pkexec is the proper way to do it.

I do see other applications like Btrfs Assistant or KDE Partition Manager automatically prompt for the user’s password to elevate privileges for that application to run - so how do I do this for the GUI Control Panel from XAMPP?

Many thanks in advance!!

PS - Here’s my garuda-inxi output:

System:
  Kernel: 6.13.5-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 14.2.1 clocksource: tsc
    avail: acpi_pm parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
    root=UUID=8dcc0c9c-8fe9-4fc6-b189-a8db2cfa3823 rw rootflags=subvol=@ rd.driver.pre=vfio-pci
    intel_iommu=on i915.enable_guc=3 i915.max_vfs=7 quiet
    resume=UUID=a14a443b-9c6b-47d0-b49a-d9686d767b7c loglevel=3 sysrq_always_enabled=1
    split_lock_detect=off nvidia-drm.modeset=1 pci=disable_acs_redir=pci:12D8:2308 ibt=off
  Console: pty pts/0 DM: SDDM Distro: Garuda base: Arch Linux
Machine:
  Type: Desktop System: ASUS product: N/A v: N/A serial: <superuser required>
  Mobo: ASUSTeK model: PRIME Z690-P WIFI v: Rev 1.xx serial: <superuser required> part-nu: SKU
    uuid: <superuser required> UEFI: American Megatrends v: 3601 date: 10/14/2024
CPU:
  Info: model: 12th Gen Intel Core i9-12900K bits: 64 type: MST AMCP arch: Alder Lake gen: core 12
    level: v3 note: check built: 2021+ process: Intel 7 (10nm ESF) family: 6 model-id: 0x97 (151)
    stepping: 2 microcode: 0x38
  Topology: cpus: 1x dies: 1 clusters: 10 cores: 16 threads: 24 mt: 8 tpc: 2 st: 8 smt: enabled
    cache: L1: 1.4 MiB desc: d-8x32 KiB, 8x48 KiB; i-8x32 KiB, 8x64 KiB L2: 14 MiB
    desc: 8x1.2 MiB, 2x2 MiB L3: 30 MiB desc: 1x30 MiB
  Speed (MHz): avg: 800 min/max: 800/5100:5200:3900 scaling: driver: intel_pstate
    governor: powersave cores: 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800 8: 800 9: 800
    10: 800 11: 800 12: 800 13: 800 14: 800 15: 800 16: 800 17: 800 18: 800 19: 800 20: 800
    21: 800 22: 800 23: 800 24: 800 bogomips: 152985
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities: <filter>
Graphics:
  Device-1: Intel AlderLake-S GT1 vendor: ASUSTeK driver: i915 v: kernel alternate: xe arch: Xe
    process: Intel 10nm built: 2020-21 ports: active: none empty: DP-1,HDMI-A-1,HDMI-A-2
    bus-ID: 00:02.0 chip-ID: 8086:4680 class-ID: 0300
  Device-2: NVIDIA GA104 [GeForce RTX 3060 Ti Lite Hash Rate] vendor: ASUSTeK driver: nvidia
    v: 570.124.04 alternate: nouveau,nvidia_drm non-free: 550/565.xx+ status: current (as of
    2025-01; EOL~2026-12-xx) arch: Ampere code: GAxxx process: TSMC n7 (7nm) built: 2020-2023
    pcie: gen: 1 speed: 2.5 GT/s lanes: 16 link-max: gen: 4 speed: 16 GT/s ports: active: none
    off: DP-2,DP-4 empty: DP-3,HDMI-A-3,HDMI-A-4 bus-ID: 01:00.0 chip-ID: 10de:2489 class-ID: 0300
  Device-3: Microsoft LifeCam Studio driver: hid-generic,snd-usb-audio,usbhid,uvcvideo type: USB
    rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-9:4 chip-ID: 045e:0772 class-ID: 0300
  Display: unspecified server: X.org v: 1.21.1.16 with: Xwayland v: 24.1.6
    compositor: kwin_wayland driver: X: loaded: modesetting,nvidia unloaded: nouveau
    alternate: fbdev,intel,nv,vesa dri: iris gpu: nvidia,nvidia-nvswitch tty: 144x35
  Monitor-1: DP-2 model: Samsung SyncMaster serial: <filter> built: 2009 res: 1920x1080 dpi: 92
    gamma: 1.2 size: 531x298mm (20.91x11.73") diag: 609mm (24") ratio: 16:9 modes: max: 1920x1080
    min: 640x480
  Monitor-2: DP-4 model: Dell UZ2715H serial: <filter> built: 2014 res: 1920x1080 dpi: 83
    gamma: 1.2 size: 597x336mm (23.5x13.23") diag: 676mm (26.6") ratio: 16:9 modes: max: 1920x1080
    min: 640x480
  API: EGL v: 1.5 hw: drv: nvidia platforms: device: 0 drv: nvidia gbm: drv: nvidia surfaceless:
    drv: nvidia wayland: drv: nvidia inactive: x11
  API: OpenGL v: 4.6.0 vendor: nvidia v: 570.124.04 note: console (EGL sourced) renderer: NVIDIA
    GeForce RTX 3060 Ti/PCIe/SSE2
  API: Vulkan v: 1.4.304 layers: 14 device: 0 type: discrete-gpu name: NVIDIA GeForce RTX 3060
    Ti driver: N/A device-ID: 10de:2489 surfaces: wayland device: 1 type: integrated-gpu
    name: Intel UHD Graphics 770 (ADL-S GT1) driver: N/A device-ID: 8086:4680 surfaces: wayland
    device: 2 type: cpu name: llvmpipe (LLVM 19.1.7 256 bits) driver: N/A device-ID: 10005:0000
    surfaces: wayland
  Info: Tools: api: clinfo, eglinfo, glxinfo, vulkaninfo de: kscreen-console,kscreen-doctor
    gpu: corectrl, gputop, intel_gpu_top, lsgpu, nvidia-settings, nvidia-smi
    wl: wayland-info,wlr-randr x11: xdpyinfo, xprop, xrandr
Audio:
  Device-1: Intel Alder Lake-S HD Audio vendor: ASUSTeK driver: vfio-pci alternate: snd_hda_intel,
    snd_soc_avs, snd_sof_pci_intel_tgl bus-ID: 00:1f.3 chip-ID: 8086:7ad0 class-ID: 0403
  Device-2: NVIDIA GA104 High Definition Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel
    pcie: gen: 4 speed: 16 GT/s lanes: 16 bus-ID: 01:00.1 chip-ID: 10de:228b class-ID: 0403
  Device-3: Microsoft LifeCam Studio driver: hid-generic,snd-usb-audio,usbhid,uvcvideo type: USB
    rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-9:4 chip-ID: 045e:0772 class-ID: 0300
  API: ALSA v: k6.13.5-zen1-1-zen status: kernel-api with: aoss type: oss-emulator tools: N/A
  Server-1: PipeWire v: 1.2.7 status: active with: 1: pipewire-pulse status: active
    2: wireplumber status: active 3: pipewire-alsa type: plugin 4: pw-jack type: plugin
    tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Intel Alder Lake-S PCH CNVi WiFi driver: iwlwifi v: kernel bus-ID: 00:14.3
    chip-ID: 8086:7af0 class-ID: 0280
  IF: wlo1 state: down mac: <filter>
  Device-2: Realtek RTL8125 2.5GbE vendor: ASUSTeK driver: r8169 v: kernel pcie: gen: 2
    speed: 5 GT/s lanes: 1 port: 3000 bus-ID: 06:00.0 chip-ID: 10ec:8125 class-ID: 0200
  IF: enp6s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
  IF-ID-1: br-1f7862558da6 state: up speed: 10000 Mbps duplex: unknown mac: <filter>
  IF-ID-2: br-7bfc84ea431e state: down mac: <filter>
  IF-ID-3: br-82d31aa0b51e state: up speed: 10000 Mbps duplex: unknown mac: <filter>
  IF-ID-4: br-b787944b7593 state: down mac: <filter>
  IF-ID-5: br-e9c38ec2b98c state: up speed: 10000 Mbps duplex: unknown mac: <filter>
  IF-ID-6: docker0 state: down mac: <filter>
  IF-ID-7: veth32f9183 state: up speed: 10000 Mbps duplex: full mac: <filter>
  IF-ID-8: veth7a931ef state: up speed: 10000 Mbps duplex: full mac: <filter>
  IF-ID-9: veth8cbfd9f state: up speed: 10000 Mbps duplex: full mac: <filter>
  IF-ID-10: virbr0 state: down mac: <filter>
  Info: services: NetworkManager, smbd, sshd, systemd-timesyncd
Bluetooth:
  Device-1: Intel AX201 Bluetooth driver: btusb v: 0.8 type: USB rev: 2.0 speed: 12 Mb/s lanes: 1
    mode: 1.1 bus-ID: 1-14:8 chip-ID: 8087:0026 class-ID: e001
  Report: btmgmt ID: hci0 rfk-id: 0 state: down bt-service: enabled,running rfk-block:
    hardware: no software: yes address: <filter> bt-v: 5.2 lmp-v: 11 status: discoverable: no
    pairing: no
RAID:
  Hardware-1: Intel Volume Management Device NVMe RAID Controller driver: vmd v: 0.6 port: N/A
    bus-ID: 00:0e.0 chip-ID: 8086:467f rev: class-ID: 0104
Drives:
  Local Storage: total: 6.37 TiB used: 2.65 TiB (41.6%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung model: SSD 990 PRO with Heatsink 2TB
    size: 1.82 TiB block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s lanes: 4 tech: SSD
    serial: <filter> fw-rev: 4B2QJXD7 temp: 37.9 C scheme: GPT
  ID-2: /dev/nvme1n1 maj-min: 259:4 vendor: Samsung model: SSD 980 PRO 1TB size: 931.51 GiB
    block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s lanes: 4 tech: SSD serial: <filter>
    fw-rev: 5B2QGXA7 temp: 33.9 C scheme: GPT
  ID-3: /dev/sda maj-min: 8:0 vendor: Seagate model: ST4000NE001-2MA101 size: 3.64 TiB
    block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s tech: HDD rpm: 7200 serial: <filter>
    fw-rev: EN01 scheme: GPT
  SMART Message: Unknown smartctl error. Unable to generate data.
Partition:
  ID-1: / raw-size: 1.79 TiB size: 1.79 TiB (100.00%) used: 420.02 GiB (23.0%) fs: btrfs
    block-size: 4096 B dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%) used: 612 KiB (0.2%) fs: vfat
    block-size: 512 B dev: /dev/nvme0n1p1 maj-min: 259:1
  ID-3: /home raw-size: 1.79 TiB size: 1.79 TiB (100.00%) used: 420.02 GiB (23.0%) fs: btrfs
    block-size: 4096 B dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-4: /var/log raw-size: 1.79 TiB size: 1.79 TiB (100.00%) used: 420.02 GiB (23.0%) fs: btrfs
    block-size: 4096 B dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-5: /var/tmp raw-size: 1.79 TiB size: 1.79 TiB (100.00%) used: 420.02 GiB (23.0%) fs: btrfs
    block-size: 4096 B dev: /dev/nvme0n1p2 maj-min: 259:2
Swap:
  Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
  ID-1: swap-1 type: zram size: 31.08 GiB used: 0 KiB (0.0%) priority: 100 comp: zstd
    avail: lzo-rle,lzo,lz4,lz4hc,deflate,842 max-streams: 24 dev: /dev/zram0
  ID-2: swap-2 type: partition size: 34.2 GiB used: 0 KiB (0.0%) priority: -2
    dev: /dev/nvme0n1p3 maj-min: 259:3
Sensors:
  System Temperatures: cpu: 33.0 C mobo: N/A gpu: nvidia temp: 35 C
  Fan Speeds (rpm): N/A
Info:
  Memory: total: 32 GiB note: est. available: 31.08 GiB used: 12.58 GiB (40.5%)
  Processes: 560 Power: uptime: 1h 19m states: freeze,mem,disk suspend: deep avail: s2idle
    wakeups: 0 hibernate: platform avail: shutdown, reboot, suspend, test_resume image: 12.37 GiB
    services: org_kde_powerdevil, power-profiles-daemon, upowerd Init: systemd v: 257
    default: graphical tool: systemctl
  Packages: 2282 pm: pacman pkgs: 2264 libs: 629 tools: octopi,pacseek,paru pm: flatpak pkgs: 18
    Compilers: clang: 19.1.7 gcc: 14.2.1 alt: 13 Shell: garuda-inxi default: fish v: 4.0.0
    running-in: pty pts/0 (SSH) inxi: 3.3.37
Garuda (2.7.2-1):
  System install date:     2024-10-16
  Last full system update: 2025-03-06
  Is partially upgraded:   No
  Relevant software:       snapper NetworkManager dracut nvidia-dkms
  Windows dual boot:       Probably (Run as root to verify)
  Failed units:

Hello shayaknyc,

Did you try the official file from their homepage?

The problem is if you use the installer its used in terminal with root and you need your second marked promt to start.also it need other package to run fine.(IF you also haver server problems to start) .It is also not recommended to istall this on root permissions the octopi version works better =)

Please go to your /opt/ folder where lampp is and delete it with Root actions(right click on folder).Then open Octopi and search for xampp and install it.When its finished you have a Icon on App Launcher–>internet–>XAMPP Manager and work without Terminal stuff if your looking for this =)

Thank you for this! I considered installing the arch package, but this is just for a temporary project I’m working on, and it would be so much easier for me to just sudo rm -rf the lampp directory in /opt and then this all goes away when I’m done. Since I’ve already begun work on this little project, removing and reinstalling the arch package will delete my work as well.

That said, what about installing the arch package provides for this functionality that I can’t just do it myself now? Like, how would I recreate it manually?

Thanks!

Edit: PS - truth be told, this isn’t the only application I’d want to run with elevated privileges, and I’m wondering how I can get pkexec to work. From what I’ve read on the wiki page, it’s a lot more involved to get the polkit agent to prompt for a password than it used to be with utilities like kdesu and gksudo.

hm okay but you can copy the actually Folder from lampp to other place with other name as backup for needed files and folders.When i have the installed octopi version and uninstall its create a backup folder itself in /opt/ i dont know about the already installed folder but if i try to install the run file again i checked beside octopi it says folder existing but no override …

what is your output from terminal?

echo $DISPLAY

Good idea! lol thanks.

> echo $DISPLAY
:1

may try to logout und bellow use X11 Session and not Wayland =) because pointing to x11 but wayland bridge functions and not all use same points.

:confused: that is not really a solution… how does it work on Btrfs Assistant ?

Edit: so, I looked inside btrfs-assistant-launcher and I suspect this section of the bash script is what I’m looking for:

# Define the base command with common options
command="pkexec btrfs-assistant --xdg-runtime=\"${XDG_RUNTIME_DIR}\""
...
...
...

# Add platform and display options when using Wayland
if [[ -n "${WAYLAND_DISPLAY}" ]]; then
    command="${command} --display=\"${WAYLAND_DISPLAY}\""
    if [[ -n "${QT_QPA_PLATFORM}" ]]; then
        command="${command} --platform=\"${QT_QPA_PLATFORM}\""
    fi
fi

So… I tried this: pkexec /opt/lampp/manager-linux-x64.run --xdg-runtime="${XDG_RUNTIME_DIR}" --display="${WAYLAND_DISPLAY}" - and nothing…

Then I copied the script into my home directory, renamed it to xampp-control-panel and just replaced btrfs-assistant in the initial command variable with the path to the GUI executable…and…nothing… This is very weird. Running the script in terminal, got this:

> ./xampp-control-panel 
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ====
Authentication is needed to run `/opt/lampp/manager-linux-x64.run --xdg ... --xdg-desktop=KDE --display=wayland-0' as the super user
Authenticating as: Shaya (shaya)
Password: 
==== AUTHENTICATION COMPLETE ====
Server --xdg-desktop=KDE does not exist

i know what you mean but im sorry for any help in this way.

i use mostly a Virtual Machine and work as a root and normal user account and if i messed up safe my data via backup ftp or host and delete it.

xampp over octopi works for me fine with homepage stuff and some db and so on but im not to much in it.

you pointed yourself its over scripts so may you find other hint … but i found arch wiki check with this too IDK.

# Check if you are using Wayland
echo $XDG_SESSION_TYPE

# Get the display type
echo $DISPLAY
echo $WAYLAND_DISPLAY
wayland
:1
wayland-0

ps.you edited the post but meant any extra/kdesu or something… ?

Same exact output for each of those variables:
$XDG_SESSION_TYPE=wayland
$DISPLAY=:1
$WAYLAND_DISPLAY=wayland-0

I was referring to an old utility that was used to elevate the running of programs within a GUI context. I do see that I have kdesu installed, but it doesn’t do anything when I execute it as a stand-in replacement for pkexec.

On a hunch, I decided to run sudo systemctl status polkit.service and this is the output I received:

> sudo systemctl status polkit.service
● polkit.service - Authorization Manager
     Loaded: loaded (/usr/lib/systemd/system/polkit.service; static)
● polkit.service - Authorization Manager
     Loaded: loaded (/usr/lib/systemd/system/polkit.service; static)
     Active: active (running) since Fri 2025-03-07 11:35:31 EST; 20s ago
 Invocation: e906eba8793640aca49fd58cf294ba19
       Docs: man:polkit(8)
   Main PID: 3345517 (polkitd)
     Status: "Processing requests..."
      Tasks: 4 (limit: 37841)
     Memory: 6.8M (peak: 7.6M)
        CPU: 55ms
     CGroup: /system.slice/polkit.service
             └─3345517 /usr/lib/polkit-1/polkitd --no-debug --log-level=notice

Mar 07 11:35:31 desktop polkitd[3345517]: Started polkitd version 126
Mar 07 11:35:31 desktop polkitd[3345517]: Loading rules from directory /etc/polkit-1/rules.d
Mar 07 11:35:31 desktop polkitd[3345517]: Loading rules from directory /run/polkit-1/rules.d
Mar 07 11:35:31 desktop polkitd[3345517]: Error opening rules directory: Error opening directory “/run/polkit-1/rules.d”: No such file or directory (g-file-error-quark, 4)
Mar 07 11:35:31 desktop polkitd[3345517]: Loading rules from directory /usr/local/share/polkit-1/rules.d
Mar 07 11:35:31 desktop polkitd[3345517]: Error opening rules directory: Error opening directory “/usr/local/share/polkit-1/rules.d”: No such file or directory (g-file-error-quark, 4)
Mar 07 11:35:31 desktop polkitd[3345517]: Loading rules from directory /usr/share/polkit-1/rules.d
Mar 07 11:35:31 desktop polkitd[3345517]: Finished loading, compiling and executing 14 rules

I have confirmed that the path /run/polkit-1/ doesn’t exist, nor does /usr/local/share/polkit-1/ - which would explain the No such file or diretory error.

I don’t suppose those errors have anything to do with it. However, I do see a bunch of rules in /usr/share/polkit-1/rules.d/ 2 files of which, have 0750 permissions (99-garuda.rules and garuda-system-maintenance.rules) whereas the rest of the files in this directory have 0644 perms. Not sure if that’s relevant, although I’m curious why those two files have execution permissions on the owner and group. I’ll also point out that those two files have a different group ownership, instead of root:root they have root:polkitd.

did you try this?

pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY /opt/lampp/manager-linux-x64.run

3 Likes

Whoop! This command worked!!! Thank you for this. Can you explain how you led to this solution?

2 Likes

i was playing arround here and read some wiki and x11 and come across $xauthority=)

2 Likes

Thank you! I don’t understand these enough to have even thought about doing that. Much appreciated!!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.