Bug 511027 - KDE su: "su returned with an error"
Summary: KDE su: "su returned with an error"
Status: CONFIRMED
Alias: None
Product: kdesu
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: kdesu bugs tracker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-24 15:34 UTC by Sylens
Modified: 2025-11-13 12:26 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
this is the error it pops up, sometimes it appears 10-20x times at once (19.15 KB, image/png)
2025-10-24 15:34 UTC, Sylens
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sylens 2025-10-24 15:34:28 UTC
Created attachment 186094 [details]
this is the error it pops up, sometimes it appears 10-20x times at once

SUMMARY
After doing a sudo or pkexec command, after a few minutes later that command was issued, sometimes kdesu randomly throws up an error window (or sometimes even 10-20 windows at once) 

STEPS TO REPRODUCE
1. launch a GUI application either with pkexec or sudo
2. give a few minutes
3. kdesu error window(s) start to randomly throw up

OBSERVED RESULT
random popups

EXPECTED RESULT
no random popups please

SOFTWARE/OS VERSIONS
Operating System: Kubuntu 25.10
KDE Plasma Version: 6.5.0
KDE Frameworks Version: 6.19.0
Qt Version: 6.9.2
Kernel Version: 6.17.0-5-generic (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i5-3470 CPU @ 3.20GHz
Memory: 16 GiB of RAM (15.6 GiB usable)
Graphics Processor: Quadro K620
Manufacturer: FUJITSU
Product Name: ESPRIMO E510
Comment 1 blackadderkate 2025-10-29 19:53:51 UTC
Broken for me on Kubuntu 25.10 as well, when trying to open Driver Manager,

Operating System: Kubuntu 25.10
KDE Plasma Version: 6.4.5
KDE Frameworks Version: 6.17.0
Qt Version: 6.9.2
Kernel Version: 6.17.0-6-generic (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 1700X Eight-Core Processor
Memory: 16 GiB of RAM (15.5 GiB usable)
Graphics Processor: NVIDIA GeForce RTX 3050
Comment 2 apn235 2025-10-30 14:44:04 UTC
Same thing here, Kubuntu 25.10, fresh install. Happening with the ksystemlog as well.
Comment 3 Marko 2025-10-31 10:29:32 UTC
Same here, Kubuntu 25.10, fresh install. Happens when trying to open software sources through Discover.
But no problems when opening in terminal using sudo software-properties-qt
Comment 4 John Tanner 2025-11-05 23:27:48 UTC
Same here, and present as a bug even if 6.5.1 is installed via backports
Comment 5 Alexandr 2025-11-06 13:46:42 UTC
Same here. When trying to open KSystemLog or Driver manager
Comment 6 blackadderkate 2025-11-06 16:47:23 UTC
So it appears the actual KDESU binary is in kde-cli-tools, not kdesu(!)

I have compiled kde-cli-tools manually using kde-builder, and that works perfectly, so it seems that something may have gone wrong during compilation or packaging, and the binary provided in the Kubuntu package is corrupt.

As a result I have reported it as a bug on Ubuntu Launchpad: see https://bugs.launchpad.net/ubuntu/+source/kde-cli-tools/+bug/2130805
Comment 7 blackadderkate 2025-11-13 12:26:17 UTC
Dunno if the kdesu programmer is on the cc list for this bug, but  I have done a lot of poking around over the last few days and discovered what the problem is.

The hang is due to the settings used by the DebHelper tool, used by Ubuntu/Debian to compile their packages (possibly -DKDESU_USE_SUDO_DEFAULT).

I _think_ this causes kdesu to send different flags to sudo, which in turn changes the authentication text string it returns, which the code does not expect.
As a result, kdesu assumes what is being sent bu sudo is not a prompt for the password - so it continues to wait for something that has actually been received - causing the hang.

These are the authentication prompts received by kdesu, depending on the compiler used:

Prompt received when compiled using make & cmake: Password:
Prompt received when compiled using debhelper: [sudo: authenticate] Password:
Prompt received by the debhelper autotests: [sudo] password for jr:

As you can see, the debhelper prompt has two colons, when it is expecting only one (see line 268 of kdesu/src/suprocess.cpp.)
            if (colon == 1 && line[j] == ':') {

To fix it, the detection code for detecting when a password prompt has been received needs to be amended, or the arguments sent to sudo need to be amended so the password prompt request is consistent.

One potential fix is to skip any text in square brackets that was received  - I have a patch which does that, that I can attach if required.