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

flash.py and other python scripts does not work on Arch Linux #72

Closed
erikw opened this issue Jan 14, 2015 · 9 comments
Closed

flash.py and other python scripts does not work on Arch Linux #72

erikw opened this issue Jan 14, 2015 · 9 comments

Comments

@erikw
Copy link

erikw commented Jan 14, 2015

Version: prey-node-client 1.3.6
OS: Arch Linux

Currently the feature of sending messages to a Arch Linux laptop does not work. This is because
/opt/prey-node-client/lib/agent/actions/alert/linux/flash.py is a python2 script but in arch the binary "python" is a symlink to python3.

Update:
The same goes for /opt/prey-node-client/lib/agent/actions/lock/linux/pre-lock and all other python scripts.

@erikw erikw changed the title flash.py does not work on arch linux flash.py and other python scripts does not work on Arch Linux Jan 14, 2015
@mauricioschneider
Copy link
Contributor

Hello @erikw,

Thanks for reporting the issue. We are aware of the python2/python3 issue in Arch Linux since it was exposed in #63. I'm currently downloading said distribution to try to deal with this and other issues.

@erikw
Copy link
Author

erikw commented Jan 14, 2015

Alright cool! :)

@erikw
Copy link
Author

erikw commented Jan 15, 2015

Also, a wonder. What's up with the weird header in the sh-python files?

#!/bin/sh
''':'
':'; python=$(command -v python)
':'; [ -z "$python" ] || [ -n "${python##*usr*}" ] && python="/usr/bin/python"
':'; exec "$python" "$0" "$@"

Wouldn't a simple env in the shebang do it?

#!/usr/bin/env python

@mauricioschneider
Copy link
Contributor

Thanks @erikw for your feedback. Most likely 1.3.8 will address most of them (that's because 1.3.7 it's already on the way).

@tomas
Copy link
Contributor

tomas commented Jan 15, 2015

That wried shebang attempts to locate the correct python path in order to execute the script. Normally a /usr/bin/env python should do it, but there are cases in which there's a local python (e.g. installed via homebrew) that does not contain the required modules for the script to run.

@beeatriz
Copy link

User's output of journalctl: when executing LOCK:

Jul 23 12:26:16 warchx su[6130]: (to wesley) root on none

Jul 23 12:26:16 warchx su[6130]: pam_unix(su:session): session opened for
user wesley by (uid=0)
Jul 23 12:26:16 warchx su[6130]: pam_unix(su:session): session closed for
user wesley
Jul 23 12:26:16 warchx sudo[6129]: pam_unix(sudo:session): session closed
for user root
Jul 23 12:26:16 warchx sudo[6138]: prey : TTY=unknown ;
PWD=/opt/prey-node-client/lib/agent/actions/lock/linux ; USER=root ;
COMMAND=/usr/sbin/su wesley -c
"/opt/prey-node-client/lib/agent/actions/lock/linux/prey-lock"
"e8d95a51f3af4a3b134bf6bb680a213a"
Jul 23 12:26:16 warchx sudo[6138]: pam_unix(sudo:session): session opened
for user root by (uid=0)

Jul 23 12:26:16 warchx su[6139]: (to wesley) root on noneJul 23 12:26:16
warchx su[6139]: pam_unix(su:session): session opened for user wesley by
(uid=0)Jul 23 12:26:16 warchx su[6139]: pam_unix(su:session): session
closed for user wesleyJul 23 12:26:16 warchx sudo[6138]:
pam_unix(sudo:session): session closed for user rootJul 23 12:28:22 warchx
sudo[7109]: prey : TTY=unknown ;
PWD=/opt/prey-node-client/lib/agent/actions/lock/linux ; USER=root ;
COMMAND=/usr/sbin/su wesley -c
"/opt/prey-node-client/lib/agent/actions/lock/linux/prey-lock"
"e8d95a51f3af4a3b134bf6bb680a213a"

(it repeats until I stop the action! ...)

He recorded the screen showing what happens: http://youtu.be/ShjmSHtaKzc

@wcota
Copy link

wcota commented Jul 26, 2015

Just changed

#!/bin/sh
''':'
':'; python=$(command -v python)
':'; [ -z "$python" ] || [ -n "${python##*usr*}" ] && python="/usr/bin/python"
':'; exec "$python" "$0" "$@"
'''

to

#!/usr/bin/env python2

in file /opt/prey-node-client/lib/agent/actions/lock/linux/prey-lock and now it works. :)

With the first code, Arch Linux still uses python3.

@mauricioschneider
Copy link
Contributor

Thanks for the feedback @wesleycota. There are some other priorities in the pipeline right now, but I'll look into the issue as soon as possible.

@JotaRandom
Copy link

as a reminder, the weird lined pointed by erikw on 15 Jan 2015 still present and ALL the envs still point to python where not all distros have python as version 2 interpreter.
so for future references Arch use this patch https://aur.archlinux.org/cgit/aur.git/tree/prey-node-client.patch?h=prey-node-clientbto fix it and add arch specific tweaks (no autoupdate for example)

@patriciojofre patriciojofre closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2022
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

7 participants