Fatal in <TROOT::InitSystem>: HOME directory not set

Hello,

I have the error: Fatal in TROOT::InitSystem: HOME directory not set

I’ve looked around for solutions to this error and the only answer I’ve seen is modifying the source code so it doesn’t kill root. I am trying to run batch jobs with aprun and I get this error when I do: aprun rootapp -o out.root in.root

Also I ran a aprun whoami and it gives: whoami: cannot find name for user ID 593

So aprun is obviously using some exterior user to start these jobs. The problem is that the ROOT code has no way to define the home directory because this user ID 593 has no name to be passed to find the home directory. root.cern.ch/root/html/TSystem.h … eDirectory

Does anyone know a fix for this?

Thanks,
Eric

bump

[quote=“econrad”]Hello,

I have the error: Fatal in TROOT::InitSystem: HOME directory not set

I’ve looked around for solutions to this error and the only answer I’ve seen is modifying the source code so it doesn’t kill root. I am trying to run batch jobs with aprun and I get this error when I do: aprun rootapp -o out.root in.root

Also I ran a aprun whoami and it gives: whoami: cannot find name for user ID 593

So aprun is obviously using some exterior user to start these jobs. The problem is that the ROOT code has no way to define the home directory because this user ID 593 has no name to be passed to find the home directory. root.cern.ch/root/html/TSystem.h … eDirectory

Does anyone know a fix for this?

Thanks,
Eric[/quote]

If possible, run a bash script that sets the home variable and then runs your code. I realize that this isn’t always easy for the end-user to do, but shouldn’t be too hard for whomever is setting up the batch system framework to do.

Cheers,
Charles

I tried something like this so far, I submit the job using:

qsub jobfile

Where the jobfile contains:

#!/bin/bash

#PBS -N jobName
#PBS -j oe
#PBS -l mppwidth=1
#PBS -l walltime=100:00:00

cd $PBS_O_WORKDIR
source startupdefs.sh
export HOME="/mnt/lustre_server/users/econrad"
echo $USER
echo $HOME
aprun echo $USER
aprun echo $HOME
aprun rootapp -o out.root in.root


Running this script gives as an output:


econrad
/mnt/lustre_server/users/econrad
econrad
Application 39491 resources: utime ~0s, stime ~0s
/mnt/lustre_server/users/econrad
Application 39492 resources: utime ~0s, stime ~0s
Fatal in TROOT::InitSystem: HOME directory not set

*** Break *** segmentation violation
Application 39493 exit signals: Segmentation fault
Application 39493 resources: utime ~0s, stime ~0s

Still doesn’t work >:-(

My work around is to change in TUnixSystem.cxx:

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;
}

To use the getenv(“HOME”) instead so the function is:

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, getenv(“HOME”), kMAXPATHLEN);
return path;
}
} else {
//if (mydir[0])
// return mydir;

pw = getpwuid(getuid());
if (pw) {
  strncpy(mydir, getenv("HOME"), kMAXPATHLEN);
  return mydir;
}

}
return 0;
}

Hi,

I’ve taken your suggestion to check for the HOME shell variable in case the home directory is not defined in the passwd file. The fix is in the trunk and the v5-30-00 and v5-28-00 patches branches.

Cheers, Fons.