RE: Is UNIX home directory really needed to run root? (fwd)

From: Fine, Valeri <fine_at_bnl.gov>
Date: Wed, 29 Aug 2007 13:29:17 -0400

 

Hello
 I think the issue is not just Condor.
 This is a common case for example for BNL laptops those must (!!!) be connected to the BNL Windows NT domain.  The problem is that the home directory of the domain user (in case of the BNL Windows framework) always points to the "domain server". This means as soon as such laptop is disconnected from the BNL network (which is the normal case for the mobile computer) one can not use ROOT anymore.  

The simple (STAR custom) solution is to check within the TSystem::HomeDirectory method whether HOME is writable and return the directory that was the current at the time of the TSystem object is instantiated. instead. If the that directory is not writable either return "tmp". This should work for the Unix real as well.    

Just my 2 cents.

                       Valeri

 
________________________________

From: owner-roottalk_at_root.cern.ch on behalf of Dimitri Bourilkov Sent: Wed 8/29/2007 12:37 PM
To: Christophe Delaere
Cc: Fons Rademakers; Roottalk
Subject: Re: [ROOT] Is UNIX home directory really needed to run root? (fwd)

Hi Christophe,

    Thanks for your mail. Here the results of looking deeper:

  1. In my condor flocking case this won't solve the problem, as root is using getuid() to detect the UID and HOME dir, and for running the job condor uses my UID from the submission machine with no corresponding user on the farm :-( .
  2. export HOME=$_CONDOR_SCRATCH_DIR works and can be a nice way to use the local node without taxing the network before staging out on completion, BUT: beware of the leading _ in _CONDOR_SCRATCH_DIR, versions of the condor manual below 6.8 may be inconsistent (I am running with 6.7).

    Cheers, Dimitri

Christophe Delaere wrote:
> Hi Dimitri,
>
> It was quite a long time ago already, but I remember defining the home in my
> condor scripts with something like
> export HOME=$CONDOR_SCRATCH_DIR
>
> I was then able to run ROOT jobs.
>
> Cheers,
> Christophe.
>
> On Monday 27 August 2007, Fons Rademakers wrote:
>
>>Hi Dimitri,
>>
>> a priory the HOME directory is not needed anymore. Before removing the
>>Fatal() I've to check carefully if all occasions where we use the
>>HomeDirectory is properly protected against no-home directory.
>>
>>Cheers, Fons.
>>
>>
>>>---------- Forwarded message ----------
>>>Date: Fri, 24 Aug 2007 20:19:32 -0400
>>>From: Dimitri Bourilkov <bourilkov_at_phys.ufl.edu>
>>>To: roottalk_at_pcroot.cern.ch
>>>Subject: [ROOT] Is UNIX home directory really needed to run root?
>>>
>>>Hi,
>>>
>>> Having succeeded to use condor flocking to submit (my) batch jobs, I
>>>am trying to submit _root_ batch jobs (root -b -q xxx.C) to a remote
>>>farm where I do not have a unix account (condor is taking care of this),
>>>just an NFS mounted working space. The jobs are running into problems,
>>>terminating with the message:
>>>
>>> Fatal in <TROOT::InitSystem>: HOME directory not set
>>>
>>>Looking in the root source this comes from the snippets enclosed below.
>>>If I read them correctly, things are more or less hardcoded to look for
>>>the unix user and get the home dir from the passwd file.
>>>
>>> My questions are:
>>> 1) Is this really needed to run root?
>>> 2) Or defining a dir where root can read/write could be enough, and
>>>how to achieve this (if needed, modifying the code)?
>>>
>>> Thanks, Dimitri
>>>
>>>PS Actually if mydir[kMAXPATHLEN] is initialized before calling
>>>TUnixSystem::UnixHomedirectory maybe things will behave differently, is
>>>this feasible and a viable solution?
>>>
>>>============================
>>>void TROOT::InitSystem()
>>>{
>>> // Initialize operating system interface.
>>>
>>> if (gSystem == 0) {
>>>#if defined(R__UNIX)
>>> gSystem = new TUnixSystem;
>>>#elif defined(R__WIN32)
>>> gSystem = new TWinNTSystem;
>>>#elif defined(R__VMS)
>>> gSystem = new TVmsSystem;
>>>#else
>>> gSystem = new TSystem;
>>>#endif
>>>
>>> if (gSystem->Init())
>>> fprintf(stderr, "Fatal in <TROOT::InitSystem>: can't init
>>>operating system layer\n");
>>>
>>> if (!gSystem->HomeDirectory())
>>> fprintf(stderr, "Fatal in <TROOT::InitSystem>: HOME directory
>>>not set\n");
>>>.....
>>>
>>>===============================
>>> and in TUnixSystem
>>>===============================
>>>//_______________________________________________________________________
>>>_______
>>>
>>>const char *TUnixSystem::HomeDirectory(const char *userName)
>>>{
>>> // Return the user's home directory.
>>>
>>> return UnixHomedirectory(userName);
>>>}
>>>
>>>//---- directories
>>>-------------------------------------------------------------
>>>
>>>//_______________________________________________________________________
>>>_______
>>>
>>>const char *TUnixSystem::UnixHomedirectory(const char *name)
>>>{
>>> // Returns the user's home directory.
>>>
>>> static char path[kMAXPATHLEN], mydir[kMAXPATHLEN];
>>> struct passwd *pw;
>>>
>>> if (name) {
>>> pw = getpwnam(name);
>>> if (pw) {
>>> strncpy(path, pw->pw_dir, kMAXPATHLEN);
>>> return path;
>>> }
>>> } else {
>>> if (mydir[0])
>>> return mydir;
>>> pw = getpwuid(getuid());
>>> if (pw) {
>>> strncpy(mydir, pw->pw_dir, kMAXPATHLEN);
>>> return mydir;
>>> }
>>> }
>>> return 0;
>>>}
>
>
>
>

--
        _/_/_/                             _/_/_/
       _/    _/   Dimitri  BOURILKOV      _/    _/
      _/    _/   University of Florida   _/_/_/
     _/    _/   bourilkov_at_phys.ufl.edu  _/    _/
    _/_/_/                             _/_/_/
Received on Wed Aug 29 2007 - 19:29:58 CEST

This archive was generated by hypermail 2.2.0 : Thu Aug 30 2007 - 11:50:01 CEST