Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Strange sudo / bash / python error
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
urcindalo
l33t
l33t


Joined: 08 Feb 2005
Posts: 623
Location: Almeria, Spain

PostPosted: Fri Feb 12, 2010 5:37 am    Post subject: Strange sudo / bash / python error Reply with quote

Thanks for reading this.

I have this really strange problem when launching an application with sudo:
Code:
$ sudo pymol
/usr/bin/python2.6: can't open file '/__init__.py': [Errno 2] No such file or directory


However, the pymol command is a shell script:
Code:
$ cat /usr/bin/pymol
#!/bin/sh
python -O ${PYMOL_PATH}/__init__.py $*

The PYMOL_PATH value is defined for both my regular user and root, and the file __init__.py exists within the path:
Code:
$ echo $PYMOL_PATH
/usr/lib64/python2.6/site-packages/pymol
...
# echo $PYMOL_PATH
/usr/lib64/python2.6/site-packages/pymol
# ls -la /usr/lib64/python2.6/site-packages/pymol/__init__.py
-rw-r--r-- 1 root root 20178 jul  7  2009 /usr/lib64/python2.6/site-packages/pymol/__init__.py


However, I can launch the program being root, or my regular user, just by issuing the command specified in the launching script:
Code:
# python -O ${PYMOL_PATH}/__init__.py $*
 PyMOL(TM) Molecular Graphics System, Version 1.2r2pre.
 Copyright (C) 2009 by DeLano Scientific LLC.
 All Rights Reserved.

    Created by Warren L. DeLano, Ph.D.

    PyMOL is user-supported open-source software.  Although some versions
    are freely available, PyMOL is not in the public domain.

    If PyMOL is helpful in your work or study, then please volunteer
    support for our ongoing efforts to create open and affordable scientific
    software by purchasing a PyMOL Maintenance and/or Support subscription.

    More information can be found at "http://www.pymol.org".

    Enter "help" for a list of commands.
    Enter "help <command-name>" for information on a specific command.

 Hit ESC anytime to toggle between text and graphics.

 OpenGL graphics engine:
  GL_VENDOR: ATI Technologies Inc.
  GL_RENDERER: ATI Mobility Radeon HD 4500 Series
  GL_VERSION: 2.1.9116
 Note: Radeon HD cards tend not to run PyMOL well.
 Use nVidia or Intel instead, if OpenGL glitches occur.
 Attempting to compensate for known issues...
 Detected 2 CPU cores.  Enabled multithreaded rendering.
Created temporary files directory:  /root/.ADplugin
 PyMOL: normal program termination.


Finally, to make things even more strange, I run another box, the configuration of which is the same, where I can normally launch pymol with root priviledges through sudo.

Any help is greatly appreciated. I'm really clueless here.
Thanks.
Back to top
View user's profile Send private message
bombcar
Guru
Guru


Joined: 08 Apr 2003
Posts: 453
Location: Wisconsin

PostPosted: Fri Feb 12, 2010 6:10 am    Post subject: Reply with quote

sudo isn't loading environmental variables for some reason, or isn't passing them on.
Back to top
View user's profile Send private message
urcindalo
l33t
l33t


Joined: 08 Feb 2005
Posts: 623
Location: Almeria, Spain

PostPosted: Fri Feb 12, 2010 6:19 am    Post subject: Reply with quote

bombcar wrote:
sudo isn't loading environmental variables for some reason, or isn't passing them on.


Thanks for your help. Yes, I think so, but I can't guess why :?

Does anybody know what could I check out?
Back to top
View user's profile Send private message
Axilatis
n00b
n00b


Joined: 22 Oct 2010
Posts: 54
Location: Belgique

PostPosted: Mon Mar 21, 2011 10:46 pm    Post subject: Reply with quote

i know it's very very old topic but if someone's got the same problem, the solution is to :

Code:
etc-update


then

Code:
env-update && source /etc/profile


after emerging pymol :D
_________________
Gentoo : Build your own excitement. Piece. By. Piece.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23093

PostPosted: Tue Mar 22, 2011 2:41 am    Post subject: Reply with quote

No, that is not the relevant solution here. In the problem described by the OP, the environment variables were correctly set in the profile and in the running shell. However, sudo scrubbed the environment.
Back to top
View user's profile Send private message
AngelKnight
Tux's lil' helper
Tux's lil' helper


Joined: 14 Jan 2003
Posts: 127

PostPosted: Wed Mar 23, 2011 6:01 am    Post subject: Reply with quote

urcindalo wrote:
bombcar wrote:
sudo isn't loading environmental variables for some reason, or isn't passing them on.


Thanks for your help. Yes, I think so, but I can't guess why :?

Does anybody know what could I check out?


"sudo -L" and/or check on the sudoers file and see what the precise configuration is w.r.t. how sudo handles environment variables.

As a dumb test, have a test script with just:

Code:
#!/bin/sh

echo "PYMOL_PATH is $PYMOL_PATH"


Set it executable somewhere and run via sudo. This is a quicker way to test if sudo's stripping your environment.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum