0

I re-furbish PCs for a small non-profit and we use xubuntu cloned using clonezilla. I am experiencing an issue where I set up an alias:

alias pkexec='pkexec /usr/bin/env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY'

This works fine from the command line and from a menu entry that I edited on my work rig. From my work rig, I get the password prompt that:

Authentication is required to run '/usr/bin/env'  

I enter my password and /usr/bin/hardinfo opens as superuser.

However, when this is attempted on any of my 'clones', pkexec displays the password prompt:

Athentication is required to run /usr/bin/hardinfo 

I enter my password and top show hardinfo starts then crashes or no longer appears as an executing program. I know there is something different between my rig and my clones. I don't know what is it. I'm posting here for your comments and suggestions.

Thanks in advance,

@bacOn,

I set up the function in .bashrc

pkexec() { command pkexec /usr/bin/env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "$@" }

I get a syntax error when I run source .bashrc syntax error unexpected token:

bash: .bashrc: line 146: syntax error near unexpected token `('
bash: .bashrc: line 146: `pkexec(){"command pkexec /usr/bin/env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "$@" "}'

@muru

I modified it and it now works.

pkexec(){ /usr/bin/pkexec /usr/bin/env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "$@" } source .bashrc and boom. it works on my home rig running mint from the commandline. but if I edit a menu entry pkexec /usr/bin/hardinfo, I get the password windows saying that /usr/bin/hardinfo requires authentication to run as root. hardinfo crashes.

But even after all your help, my question still remains, What could have changed on my work rig that would cause a cloned imaged to not work as expected. What troubleshooting steps might assist me in digging into the weeds on an issue that may/may not otherwise affect out future imaged machines.

Thanks for all of your help.

  • I'm not sure of the issue, but have you considered taking one of your cloned images, and booting it up in a VM? That might allow you to debug the issue... – cocomac Feb 24 '22 at 16:04
  • No actually, I havn't. I don't think I know how to go about that. I mean I can install virtualbox (what I am familiar with) but actually cloning the image to a vm, I don't know. But I am game to learn. – Terence Golightly Feb 24 '22 at 16:34
  • use a function instead. –  Feb 24 '22 at 17:10
  • Hi @bac0n, I havn't used/setup a function before. Not sure how that might look like. – Terence Golightly Feb 24 '22 at 18:07
  • 1
    function is use much the same way `pkexec(){ command pkexec env ... ... "$@"; }` you can ethier use `command` as I have done or full path to the real pkexec command or you will get a race condition. –  Feb 24 '22 at 19:22
  • You need the `;` before the closing `}` if you put the function definition all in one line: https://askubuntu.com/a/521943/158442 – muru Feb 25 '22 at 03:23

0 Answers0