[SOLVED] Can't launch apps as admin from OB menu

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
isuzufan

[SOLVED] Can't launch apps as admin from OB menu

Post by isuzufan »

I'm running Mint 19.3 and I am using Openbox instead of Cinnamon. I'm having issues launching applications from the OB menu as the admin user.

For example, when I launch the Software Manager (mintinstall) -- from either the auto-generated OB menu or the static menu item I created -- the app opens and I can search/navigate. But when I try to install a package, it starts the process and even tells me what dependencies are needed. But then it stops and the install button resets back to green again. The command I'm using from my static menu entry is pkexec mintinstall, but I've also tried a menu item that invokes mintinstall through a terminal using gnome-terminal -- sudo mintinstall. Neither work.

When I run the same commands directly through the terminal I get the following messages:
  • Code: Select all

    pkexec mintinstall
    -- I'm prompted for a password but then it says there was an error executing the command as another user, and that I'm not authorized. Maybe this output is useful:

    Code: Select all

    polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
  • Code: Select all

    sudo mintinstall
    -- I'm prompted for a password, but it tells me "The software manager should not be run as root. Please run it in user mode."
So, I know that I posted this question as an Openbox question, but maybe this is some separate security/permissions issue? If you have any ideas, I'd love to hear them. Thank you in advance!
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 3 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Can't launch apps as admin from OB menu

Post by smurphos »

It's not supposed to be run with elevated privileges at all - the correct launch command is a plain mintinstall. It should only ask to elevate when you actually install software.

To troubleshoot launch it from the terminal with the command mintinstall and try to install something. If it fails please report the terminal output.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
isuzufan

Re: Can't launch apps as admin from OB menu

Post by isuzufan »

Thanks for taking the time to reply.

I can launch Software Manager from the terminal using mintinstall. As I mentioned previously, I can navigate, search, and find apps. And when I click Install, I'm presented with a list of dependencies that also must download. But when i click OK, it looks as if it begins to initiate the download, but then it stops and the Install button is reset to green again.

Here's the text from the terminal while Software Manager is running. Doesn't seem to be much there to indicate why it stops.

Code: Select all

MintInstall: Detected system architecture: 'x86_64'
Installer: System pkgcache is most recent, using it.
MintInstall: Deleting old screenshots
MintInstall: No new reviews

** (mintinstall.py:18403): WARNING **: 19:37:36.105: Found icon of unknown type, skipping it: unknown
Installer: Calculating changes required for APT package: cheese
For install: ['gnome-video-effects', 'cheese', 'libcheese-gtk25', 'cheese-common', 'libcheese8']
For removal: []
For upgrade: []
Starting task for package apt:cheese, type 'install'
Done with task (success) apt:cheese
Installer: Calculating changes required for APT package: cheese
For install: ['gnome-video-effects', 'cheese', 'libcheese-gtk25', 'cheese-common', 'libcheese8']
For removal: []
For upgrade: []
Here's another example. When I try to launch mintsources from the terminal, I'm prompted to enter my password, but then I get an error about polkit:

Code: Select all

==== AUTHENTICATING FOR com.linuxmint.mintsources ===
Software Sources
Authenticating as: jeff,,, (jeff)
Password: 
polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
==== AUTHENTICATION FAILED ===
Error executing command as another user: Not authorized

This incident has been reported.
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Can't launch apps as admin from OB menu

Post by smurphos »

Thanks,

Can you try running this in a terminal then repeat the test with mintinstall? I'm guessing with openbox you don't have a polkit agent running.

Code: Select all

/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
isuzufan

Re: Can't launch apps as admin from OB menu

Post by isuzufan »

Thanks again for helping. I ran the command you posted, but it doesn't seem to help. The Software Manager still doesn't complete installs after I initiate them. mintsources still gives that same polkit error. Here's the output of that command you gave me, and then the result of running mintinstall from the terminal.

Code: Select all

jeff@jmint:~$ /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1

(polkit-gnome-authentication-agent-1:2497): GLib-CRITICAL **: 10:23:39.036: g_variant_new_string: assertion 'string != NULL' failed

(polkit-gnome-authentication-agent-1:2497): polkit-gnome-1-WARNING **: 10:23:39.036: Failed to register client: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
^C
jeff@jmint:~$ mintinstall
MintInstall: Detected system architecture: 'x86_64'
Installer: System pkgcache is most recent, using it.
MintInstall: Deleting old screenshots

** (mintinstall.py:4320): WARNING **: 10:57:07.253: Found icon of unknown type, skipping it: unknown
MintInstall: Downloaded new reviews
Installer: Calculating changes required for APT package: conky-all
For install: ['libxmmsclient6', 'conky-all', 'liblua5.1-0', 'libaudclient2']
For removal: []
For upgrade: []
Starting task for package apt:conky-all, type 'install'
Done with task (success) apt:conky-all
Installer: Calculating changes required for APT package: conky-all
For install: ['libxmmsclient6', 'conky-all', 'liblua5.1-0', 'libaudclient2']
For removal: []
For upgrade: []
^CTraceback (most recent call last):
  File "/usr/bin/mintinstall", line 5, in <module>
    subprocess.call("/usr/lib/linuxmint/mintinstall/mintinstall.py")
  File "/usr/lib/python3.6/subprocess.py", line 289, in call
    return p.wait(timeout=timeout)
  File "/usr/lib/python3.6/subprocess.py", line 1477, in wait
    (pid, sts) = self._try_wait(0)
  File "/usr/lib/python3.6/subprocess.py", line 1424, in _try_wait
    (pid, sts) = os.waitpid(self.pid, wait_flags)
KeyboardInterrupt
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Can't launch apps as admin from OB menu

Post by smurphos »

Hi,

So I tried adding openbox to my Cinnamon/Mate/XFCE 19.3 Virtualbox install.

Out of the box same issue as you - nothing that elevates via polkit will work.

So after a bit of googling I opened openbox's autostart file with elevated privileges in nano.

Code: Select all

sudo nano /etc/xdg/openbox/autostart
and added the line

Code: Select all

/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 &
saved the file and logged out and back in. Everything worked as it should.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
isuzufan

Re: Can't launch apps as admin from OB menu

Post by isuzufan »

Hi, I've been away, so sorry for the delay in replying. Again, thanks so much for taking the time to try to solve this issue.

I tried your suggestion and I just can't seem to make it work. I altered my Openbox autostart file (first my local in ~/.config/openbox/, and then the default at /etc/xdg/openbox), adding the policykit line you specified. I logged out/in and even rebooted, but it just doesn't work.

For mintinstall, launching as sudo from the terminal gives me a "you can't run this as root, try as a user" message. But when I run as a user, the application opens, but won't let me install anything. Running from Obmenu gives me similar results. I get similar results when I try to launch mintupdate in the same ways.

The odd thing is that i can launch synaptic-pkexec from a terminal as sudo or from Obmenu (with the command gnome-terminal -- sudo synaptic-pkexec) and everything functions fine.

It still seems like it's a permissions issue. Do you have any ideas as to what else might be causing this?
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Can't launch apps as admin from OB menu

Post by smurphos »

I think you might be getting into a mess by mixing sudo with commands that use polkit as the elevation method.

Run this command to have a look at what files in your home folder are not owned by you as a user.

Code: Select all

find $HOME ! -user $USER
Assuming there are some then run the command below to correct

Code: Select all

sudo chown -Rc $USER:$USER $HOME
Reboot

Double check the status of the polkit service

Code: Select all

systemctl status polkit.service
it should return something like this

Code: Select all

steve@steve-Inspiron-5580:~$ systemctl status polkit.service
● polkit.service - Authorization Manager
   Loaded: loaded (/lib/systemd/system/polkit.service; static; vendor preset: enabled)
   Active: active (running) since Sun 2020-02-09 11:54:59 GMT; 17h ago
     Docs: man:polkit(8)
 Main PID: 1087 (polkitd)
    Tasks: 3 (limit: 4915)
   CGroup: /system.slice/polkit.service
           └─1087 /usr/lib/policykit-1/polkitd --no-debug

Feb 09 11:54:59 steve-Inspiron-5580 systemd[1]: Starting Authorization Manager...
Feb 09 11:54:59 steve-Inspiron-5580 polkitd[1087]: started daemon version 0.105 using authority implementation `local' v
Feb 09 11:54:59 steve-Inspiron-5580 systemd[1]: Started Authorization Manager.
If it's not returning as active report the output.

Then run this command to check that the authentication agent has successfully started.

Code: Select all

ps aux | grep polkit-gnome | grep -Ev "grep"
It should return something like this

Code: Select all

steve@steve-Inspiron-5580:~$ ps aux | grep polkit-gnome | grep -Ev "grep"
steve    15708  0.0  0.3 338156 24716 ?        Sl   04:35   0:00 /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
If it does skip to testing the application commands below. If it doesn't, open a terminal window and run the command below - leave that terminal window open and in separate terminal windows test the applications.

Code: Select all

/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
Then in separate terminal windows try and test the below with no sudo use. Both mintinstall and mintupdate only elevate privileges at the point of installing or updating software - they should pop-up an authentication dialog at that point. All the other commands with pkexec in the command should pop an authentication request at launch. Report any errors.

Code: Select all

synaptic-pkexec

Code: Select all

pkexec lightdm-settings

Code: Select all

pkexec timeshift-gtk

Code: Select all

pkexec nemo

Code: Select all

mintinstall

Code: Select all

mintupdate
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
isuzufan

Re: Can't launch apps as admin from OB menu

Post by isuzufan »

That was it! Your instructions resolved my issue and I can now launch mintinstall, mintupdate and all the other apps that were causing problems before. The password prompt now appears as it should.

Thank you so much!
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: [SOLVED] Can't launch apps as admin from OB menu

Post by smurphos »

You are welcome :)
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
Locked

Return to “Software & Applications”