سؤال

Two scenarios. I am installing MYSQL on a node using chef-client:

1) In the first scenario I run it as "sudo":

sudo chef-client

[2/5/14 6:30:31 PM] xxxx : : xxx:  * execute[ldconfig] action run
================================================================================
Error executing action `run` on resource 'execute[ldconfig]'
================================================================================
[2/5/14 6:30:41 PM] xxxx : : xxx: when I run again "chef-client" then it works
[2/5/14 6:30:48 PM] xxxx : : xxx: I was running as: sudo chef-client
[2/5/14 6:31:15 PM] xxxx : : xxx: Errno::ENOENT
-------------
No such file or directory - ldconfig

2) On the second scenario, recreating the VM above from the same starting point, it succeeds without any errors:

sudo su - 
chef-client

The later scenario is successfull, no errors related to ldconfig.

Therefore, I am confused why would a sudo command for chef-client not work, whereas the second one has no issues ?

هل كانت مفيدة؟

المحلول

It's probably something in the environment of your shell. From the manual page for su:

 -l      Simulate a full login.  The environment is discarded except for HOME, SHELL, PATH, TERM, and USER.  HOME and SHELL are modified as
         above.  USER is set to the target login.  PATH is set to ``/bin:/usr/bin''.  TERM is imported from your current environment.  The
         invoked shell is the target login's, and su will change directory to the target login's home directory.

 -       (no letter) The same as -l.

Running su - throws out the contents of your environment and sudo does not. Rather it's keeping something around that's throwing off something about whatever the ldconfig command was trying to do.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top