Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aarchup.service has wrong environment #11

Open
JP-Ellis opened this issue Dec 2, 2016 · 1 comment
Open

aarchup.service has wrong environment #11

JP-Ellis opened this issue Dec 2, 2016 · 1 comment

Comments

@JP-Ellis
Copy link

JP-Ellis commented Dec 2, 2016

It aarchup.service fails to find the appropriate environment, and thus has empty user and display variables which ultimately cause sudo to fail. Here's the error:

Dec 02 20:36:25 systemd[1]: Started Run aarchup.
Dec 02 20:36:25 noxaarchup.sh[23899]: usage: sudo -h | -K | -k | -V
Dec 02 20:36:25 noxaarchup.sh[23899]: usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
Dec 02 20:36:25 noxaarchup.sh[23899]: usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]
Dec 02 20:36:25 noxaarchup.sh[23899]:             [command]
Dec 02 20:36:25 noxaarchup.sh[23899]: usage: sudo [-AbEHknPS] [-C num] [-g group] [-h host] [-p prompt] [-u user]
Dec 02 20:36:25 noxaarchup.sh[23899]:             [VAR=value] [-i|-s] [<command>]
Dec 02 20:36:25 noxaarchup.sh[23899]: usage: sudo -e [-AknS] [-C num] [-g group] [-h host] [-p prompt] [-u user] file
Dec 02 20:36:25 noxaarchup.sh[23899]:             ...
Dec 02 20:36:25 systemd[1]: aarchup.service: Main process exited, code=exited, status=1/FAILURE
Dec 02 20:36:25 systemd[1]: aarchup.service: Unit entered failed state.
Dec 02 20:36:25 systemd[1]: aarchup.service: Failed with result 'exit-code'.

and doing a bit of debugging, the command being evaluated is:

script ==> sudo -u $user sh -c "DISPLAY=\"$dply\" /usr/bin/aarchup"
exec   ==> sudo -u  sh -c "DISPLAY="" /usr/bin/aarchup"

so the issue is that it isn't finding the correct environment variables.

Note their neither gconf-helper nor dconf-service are installed, so the fallback to reading /proc/self/environ doesn't seem to work.

If this is intended to be run by the user, why not place the two systemd files in /usr/lib/systemd/user so that they can be enabled on a per-user basis with

systemctl --user enable aarchup.timer
@s3rb31
Copy link

s3rb31 commented Jan 27, 2017

I am currently using this script:

/usr/share/aarchup/noxaarchup.sh

#!/usr/bin/sh

call_aarchup(){
    dply=$(grep -z '^DISPLAY=' /proc/self/environ | sed 's/DISPLAY=//')
    sh -c "DISPLAY=\"$dply\" /usr/bin/aarchup"
}

call_aarchup || exit 1

with the service and timer files moved to /etc/systemd/user/ and started and enabled with the --user switch as above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants