albertlauncher / albert

A fast and flexible keyboard launcher
https://albertlauncher.github.io
Other
7.26k stars 305 forks source link

Queries that lead to a password prompt fail to do so #909

Closed chkiss closed 3 years ago

chkiss commented 4 years ago

Source

following the instructions from the website (Linux Mint 20): curl https://build.opensuse.org/projects/home:manuelschneid3r/public_key | sudo apt-key add - echo 'deb http://download.opensuse.org/repositories/home:/manuelschneid3r/xUbuntu_20.04/ /' | sudo tee /etc/apt/sources.list.d/home:manuelschneid3r.list sudo wget -nv https://download.opensuse.org/repositories/home:manuelschneid3r/xUbuntu_20.04/Release.key -O "/etc/apt/trusted.gpg.d/home:manuelschneid3r.asc" sudo apt update sudo apt install albert #### Environment Albert version: 0.16.1 Build date: Jun 13 2020 13:10:17 Qt version: 5.12.8 QT_QPA_PLATFORMTHEME: qt5ct Binary location: /usr/bin/albert PWD: /home/** SHELL: /bin/bash LANG: en_US.UTF-8 XDG_SESSION_TYPE: x11 XDG_CURRENT_DESKTOP: X-Cinnamon DESKTOP_SESSION: cinnamon XDG_SESSION_DESKTOP: cinnamon OS: Linux Mint 20 OS (type/version): linuxmint/20 Build ABI: x86_64-little_endian-lp64 Arch (build/current): x86_64/x86_64 Kernel (type/version): linux/5.4.0-42-generic

Steps to reproduce

Type a query that will bring up a password prompt. e.g. on Mint: "timeshift" or "driver manager" then hit enter.

Expected behaviour

Timeshift or Driver Manager should open.

Actual behaviour

Nothing happens.

idkCpp commented 4 years ago

Is there any log output?

You can see the log output by starting albert from terminal.

chkiss commented 4 years ago

Interesting - when I run it from the terminal, it brings up the password prompt as expected. Perhaps it's something about the user running it when it starts up? I don't have any funky settings (only one user on my personal laptop) and autostart is enabled with Albert's "Autostart on login" setting checked.

The log looks normal to me:

10:18:43 [DEBG:default] ========== QUERY: "timeshif" ========== 10:18:43 [DEBG:default] TIME: 74 µs SESSION TEARDOWN OVERALL 10:18:43 [DEBG:default] TIME: 0 µs MATCHES [org.albert.extension.terminal] 10:18:43 [DEBG:default] TIME: 7 µs MATCHES [org.albert.extension.system] 10:18:43 [DEBG:default] TIME: 108 µs MATCHES [org.albert.extension.calculator] 10:18:43 [DEBG:default] TIME: 133 µs MATCHES [org.albert.extension.applications] 10:18:43 [DEBG:default] TIME: 440 µs MATCHES [org.albert.extension.files] 10:18:43 [DEBG:default] TIME: 6142 µs QUERY OVERALL 10:18:43 [DEBG:default] ========== SESSION TEARDOWN STARTED ========== 10:18:43 [DEBG:default] TIME: 0 µs SESSION TEARDOWN [org.albert.extension.applications] 10:18:43 [DEBG:default] TIME: 0 µs SESSION TEARDOWN [org.albert.extension.files] 10:18:43 [DEBG:default] TIME: 0 µs SESSION TEARDOWN [org.albert.extension.calculator] 10:18:43 [DEBG:default] TIME: 0 µs SESSION TEARDOWN [org.albert.extension.system] 10:18:43 [DEBG:default] TIME: 0 µs SESSION TEARDOWN [org.albert.extension.terminal] 10:18:43 [DEBG:default] TIME: 15454 µs SESSION TEARDOWN OVERALL 10:18:43 [DEBG:default] ========== QUERY: "" ========== 10:18:43 [DEBG:default] TIME: 33 µs SESSION TEARDOWN OVERALL 10:18:43 [DEBG:default] TIME: 1 µs MATCHES [org.albert.extension.files] 10:18:43 [DEBG:default] TIME: 0 µs MATCHES [org.albert.extension.system] 10:18:43 [DEBG:default] TIME: 56 µs MATCHES [org.albert.extension.calculator] 10:18:43 [DEBG:default] TIME: 0 µs MATCHES [org.albert.extension.terminal] 10:18:43 [DEBG:default] TIME: 106 µs MATCHES [org.albert.extension.applications] 10:18:43 [DEBG:default] TIME: 317 µs QUERY OVERALL App config loaded: /etc/timeshift.json

/dev/sda1 is mounted at: /run/timeshift/backup, options: rw,relatime

App config saved: /etc/timeshift.json

RedBearAK commented 4 years ago

I am having a similar issue. New install of Linux Mint 20 (XFCE) on a 2007 MacBook3,1.

I can launch GParted from Albert, which asks for a password. But I can't launch TimeShift from Albert. Nothing happens. I have to run it from the XFCE whisker menu.

Here is a bit of output from the terminal while trying to run the "timeshift" query. This covers the output from the moment I finished typing "timeshift" and hit enter.

19:15:19 [DEBG:default] ========== QUERY: "timeshift"  ==========
19:15:19 [DEBG:default] TIME:     12 µs MATCHES [org.albert.extension.system]
19:15:19 [DEBG:default] TIME:      4 µs MATCHES [org.albert.extension.mpris]
19:15:19 [DEBG:default] TIME:    260 µs MATCHES [org.albert.extension.applications]
19:15:19 [DEBG:default] TIME:    146 µs MATCHES [org.albert.extension.calculator]
19:15:19 [DEBG:default] TIME:      3 µs MATCHES [org.albert.extension.terminal]
19:15:19 [DEBG:default] TIME:    280 µs MATCHES [org.albert.extension.snippets]
19:15:19 [DEBG:default] TIME:    369 µs MATCHES [org.albert.extension.files]
19:15:19 [DEBG:default] TIME:    853 µs SESSION TEARDOWN OVERALL
19:15:19 [DEBG:default] TIME:   2742 µs QUERY OVERALL
19:15:23 [DEBG:default] ========== QUERY: ""  ==========
19:15:23 [DEBG:default] TIME:    775 µs SESSION TEARDOWN OVERALL
19:15:23 [DEBG:default] ========== SESSION TEARDOWN STARTED ==========
19:15:23 [DEBG:default] TIME:      2 µs SESSION TEARDOWN [org.albert.extension.system]
19:15:23 [DEBG:default] TIME:      2 µs SESSION TEARDOWN [org.albert.extension.mpris]
19:15:23 [DEBG:default] TIME:      2 µs SESSION TEARDOWN [org.albert.extension.applications]
19:15:23 [DEBG:default] TIME:      2 µs SESSION TEARDOWN [org.albert.extension.files]
19:15:23 [DEBG:default] TIME:      2 µs SESSION TEARDOWN [org.albert.extension.calculator]
19:15:23 [DEBG:default] TIME:      2 µs SESSION TEARDOWN [org.albert.extension.terminal]
19:15:23 [DEBG:default] TIME:      2 µs SESSION TEARDOWN [org.albert.extension.snippets]
Refusing to render service to dead parents.
19:15:23 [DEBG:default] TIME:      3 µs MATCHES [org.albert.extension.system]
19:15:23 [DEBG:default] TIME:      4 µs MATCHES [org.albert.extension.mpris]
19:15:23 [DEBG:default] TIME:      4 µs MATCHES [org.albert.extension.files]
19:15:23 [DEBG:default] TIME:     85 µs MATCHES [org.albert.extension.calculator]
19:15:23 [DEBG:default] TIME:      2 µs MATCHES [org.albert.extension.terminal]
19:15:23 [DEBG:default] TIME:      3 µs MATCHES [org.albert.extension.snippets]
19:15:23 [DEBG:default] TIME:    590 µs MATCHES [org.albert.extension.applications]
19:15:23 [DEBG:default] TIME: 116792 µs SESSION TEARDOWN OVERALL
19:15:23 [DEBG:default] TIME: 118707 µs QUERY OVERALL

Same happens when I try to run the Login Window application.

19:19:05 [DEBG:default] ========== QUERY: "login"  ==========
19:19:05 [DEBG:default] TIME:     11 µs MATCHES [org.albert.extension.system]
19:19:05 [DEBG:default] TIME:    232 µs MATCHES [org.albert.extension.applications]
19:19:05 [DEBG:default] TIME:    151 µs MATCHES [org.albert.extension.files]
19:19:05 [DEBG:default] TIME:   1235 µs SESSION TEARDOWN OVERALL
19:19:05 [DEBG:default] TIME:      3 µs MATCHES [org.albert.extension.mpris]
19:19:05 [DEBG:default] TIME:    107 µs MATCHES [org.albert.extension.calculator]
19:19:05 [DEBG:default] TIME:    287 µs MATCHES [org.albert.extension.snippets]
19:19:05 [DEBG:default] TIME:      2 µs MATCHES [org.albert.extension.terminal]
19:19:05 [DEBG:default] TIME:  26598 µs QUERY OVERALL
19:19:07 [DEBG:default] ========== QUERY: ""  ==========
19:19:07 [DEBG:default] TIME:    164 µs SESSION TEARDOWN OVERALL
19:19:07 [DEBG:default] ========== SESSION TEARDOWN STARTED ==========
19:19:07 [DEBG:default] TIME:      1 µs SESSION TEARDOWN [org.albert.extension.system]
19:19:07 [DEBG:default] TIME:      1 µs SESSION TEARDOWN [org.albert.extension.mpris]
19:19:07 [DEBG:default] TIME:      1 µs SESSION TEARDOWN [org.albert.extension.applications]
19:19:07 [DEBG:default] TIME:      1 µs SESSION TEARDOWN [org.albert.extension.files]
19:19:07 [DEBG:default] TIME:      1 µs SESSION TEARDOWN [org.albert.extension.calculator]
19:19:07 [DEBG:default] TIME:      1 µs SESSION TEARDOWN [org.albert.extension.terminal]
19:19:07 [DEBG:default] TIME:      2 µs SESSION TEARDOWN [org.albert.extension.snippets]
19:19:07 [DEBG:default] TIME:      2 µs MATCHES [org.albert.extension.system]
19:19:07 [DEBG:default] TIME:    160 µs MATCHES [org.albert.extension.applications]
19:19:07 [DEBG:default] TIME:      4 µs MATCHES [org.albert.extension.files]
19:19:07 [DEBG:default] TIME:     87 µs MATCHES [org.albert.extension.calculator]
19:19:07 [DEBG:default] TIME:      2 µs MATCHES [org.albert.extension.terminal]
19:19:07 [DEBG:default] TIME:      2 µs MATCHES [org.albert.extension.snippets]
19:19:07 [DEBG:default] TIME:      3 µs MATCHES [org.albert.extension.mpris]
Refusing to render service to dead parents.
19:19:07 [DEBG:default] TIME: 106652 µs SESSION TEARDOWN OVERALL
19:19:07 [DEBG:default] TIME: 107608 µs QUERY OVERALL
RedBearAK commented 4 years ago

If this means anything, the actual commands behind these applications in the Whisker menu are:

pkexec timeshift-gtk
pkexec lightdm-settings

And when I use ">" in Albert to launch the command directly via terminal, it of course works just fine, leaving a terminal window in the background.

The GParted command, which launches fine from Albert, is this:

/usr/sbin/gparted %f

So maybe Albert is having an issue launching these apps that use "pkexec" commands? I tried changing one to "/usr/bin/pkexec" but that didn't seem to have any effect, so it doesn't appear to be a path issue.

Need to figure this out. It's annoying having a launcher that can't launch certain apps.

ManuelSchneid3r commented 4 years ago

I can launch GParted from Albert, which asks for a password. But I can't launch TimeShift from Albert. Nothing happens. I have to run it from the XFCE whisker menu.

can you please post the exec keys of the three related desktop entries?

"Refusing to render service to dead parents." makes somewhat sense to me. but unfortunately this is intended. albert runs the commandine and disowns because crashes in albert should not end in termination of all the processes you launched with albert. sure we could use QProcess which effectively makes albert a parent and accept all the consequences or we could as pkexec devs why they fail without parents. What do you think?

just to get further evidence: can you try to run gparted-pkexec?

Further reads: https://askubuntu.com/questions/608419/trying-to-execute-a-process-with-pkexec-asynchronously-and-get-refusing-to-rend https://github.com/bit-team/backintime/issues/593

RedBearAK commented 4 years ago

@ManuelSchneid3r

just to get further evidence: can you try to run gparted-pkexec?

I am not certain exactly what you are asking me to do here. There is no "gparted-pkexec" command on my system.

I tried editing the application defined in the XFCE menu from "/usr/sbin/gparted %f" to "pkexec gparted". This of course results in the same error about refusing to render service.

I don't know what the proper solution for this is but it needs to be fixed, even if that means using a shell wrapper or something. A launcher that can't launch some GUI applications is a bit useless. Just figure out how the XFCE menu launches these pkexec apps successfully and do that.

ManuelSchneid3r commented 4 years ago

I am not certain exactly what you are asking me to do here. There is no "gparted-pkexec" command on my system.

I just read of this binary in one of those link. I though maybe the package ships this executale.

needs to be fixed, even if that means using a shell wrapper or something.

sure, can you please try if this fixes the issue? I mean before hardcoding a shell one try to change the exec key to use a shell to emulate the latter. I mean does it make sense at all that pkexec refuses to start detached if a detached shell wrapper fixes this issue, especially if the resoning is that detaching gives the control of the process to another user (i.e. root)?

idkCpp commented 4 years ago

I just tested the following file:

[Desktop Entry]
Name=Test Entry
Comment=Used to test pkexec
Exec=/usr/bin/pkexec echo Test
Icon=gtk-properties
Terminal=true
Type=Application

The password prompt came without problems.

ManuelSchneid3r commented 4 years ago

I just tested this on buntu 20.04 which is the base for LM20. I cannot reproduce this issue with timeshift.

RedBearAK commented 4 years ago

@ManuelSchneid3r

Well, Ubuntu is the base but Mint does some things differently. Was the desktop XFCE? I can't think of anything unusual that I've done to this install of LM20, and it is a very recent install.

I used the mint-meta-mate to install the MATE desktop and tried running the same applications via Albert, with the same results. Apps like GParted run and ask for password, apps using pkexec do nothing via Albert, but launch just fine and ask for password when launched from the MATE application menu. So it seems obvious that Albert is launching applications via some different method or with different permissions than the standard application menus in DEs like MATE and XFCE, leading to this failure to launch.

As far as I know I'm using the Ubuntu 20 version of Albert most appropriate for LM20, and the system is up to date.

Unless you can point me to a debug version of Albert or some other error log for another system component that could be causing this, I don't know how to proceed.

needs to be fixed, even if that means using a shell wrapper or something.

sure, can you please try if this fixes the issue?

Again, not sure exactly what you want me to do. Want me to try and use Albert to launch a shell script that calls 'pkexec' or something? I just tried changing the TimeShift command from pkexec timeshift-gtk to sh -c 'pkexec timeshift-gtk'. That launches fine from the MATE menu but still won't launch from Albert.

If you want me to do something more, assume that I am an intermediate-beginner Linux user familiar with basic shell commands and some amateurish Bash scripting.

ManuelSchneid3r commented 4 years ago

LM20

Also LM20 working fine.

ManuelSchneid3r commented 4 years ago

Well okay in Mint Mate I can reproduce it. As I assumed mintmenu does not detach the process.

Bildschirmfoto 2020-11-06 um 13 27 29

Now we could start a discussion which option is more reasonable. 🤷‍♂️

RedBearAK commented 4 years ago

@ManuelSchneid3r

Odd that you can only replicate it in MATE when the Whisker menu in XFCE is launching the same apps using the same application definition files (if I understand correctly). But it's a start.

It's commendable to not want Albert to be the parent process if it can be avoided, for the sake of system stability. But if it works for mintmenu, well...

If there is a more perfect solution I'm sure it could be added later.

ManuelSchneid3r commented 4 years ago

XFCE

did not test it yet. the first test was on cinnamon. hmm i'll have to sleep over it. ;D

ManuelSchneid3r commented 3 years ago

Not that 9 votes is a reliable spot check, but a tendency:

Bildschirmfoto 2020-11-26 um 20 21 27
idkCpp commented 3 years ago

You know what. I don't think detaching is the problem here. Don't things like polkit and stuff get the auth stuff from the PTS/TTY? Maybe when started via the DE the PTS is set in such a way that pkexec can't spawn the password prompt but when launched from terminal it can. I mean I don't know this stuff but it just crossed my mind, that maybe that could be the case.

image displaying a terminal with command `( sleep 5; pkexec whoami; ) & disown` and a password prompt

This image likely shows that disowning a process may not inhibit pkexec from working properly.

idkCpp commented 3 years ago

And as @chkiss mentioned:

when I run it from the terminal, it brings up the password prompt as expected

this is not a problem with detaching processes, b/c if it were than running albert from terminal cannot change the effect.

chkiss commented 3 years ago

Please let me know if there's anything I can do to test this. I've been following the thread but am out of my depth.

On Fri, Nov 27, 2020, 14:27 idkCpp notifications@github.com wrote:

And as @chkiss https://github.com/chkiss mentioned:

when I run it from the terminal, it brings up the password prompt as expected

this is not a problem with detaching processes, b/c if it were than running albert from terminal cannot change the effect.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/albertlauncher/albert/issues/909#issuecomment-734960717, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAF5O3H45N7Z75WBOMU4BYDSR74QRANCNFSM4QA6Y6DQ .

RedBearAK commented 3 years ago

@ManuelSchneid3r

I just did a system update on my Linux Mint 20 machine (where I was having the problem described above of certain "pkexec" launched apps failing to present a password dialog), and noticed that Albert was updated to 0.17.2. The problem apps like TimeShift and Login Window seem to launch just fine now and present their password dialogs.

I don't see this issue (#909) mentioned specifically or a fix for this issue described in the recent change logs. But the issue I described in this thread seems to have gone away. This is just confirmation that I'm not having the problem anymore.

ManuelSchneid3r commented 3 years ago

This is weird because iirc I removed root actions as a whole.

RedBearAK commented 3 years ago

This is weird because iirc I removed root actions as a whole.

Interesting. So if I hadn't said something you wouldn't have known it was "fixed".

Just a wild guess but maybe that was the actual problem. Like pkexec wasn't presenting the password dialog before because it thought it was already being called by a user with superuser privileges? Except it wasn't, so the actual process launch would then fail, or just hang waiting for the response to the password dialog that was never displayed.

Seems logical, which means it's probably wrong.

ManuelSchneid3r commented 3 years ago

🤷🏼‍♂️ Fixed