IBM Support

Why does "bsub -I logname" generates an error message : logname: no login name?

Troubleshooting


Problem

Why does "bsub -I logname" generates an error message : logname: no login name?

Resolving The Problem

Why does "bsub -I logname" generates an error message : logname: no login name?The trouble is that after the logname job being dispatched to a host to run, it loses the controlling terminal information, so that getlogin() cannot get the login name.

There are two solutions:
1. Refer to $LOGIN environment variable instead of using logname command. For example, use bsub -q term -I "echo $LOGNAME" to query the login name.
2. Use the following C program to query the user name as a replacement of logname command:

#include
#include

int main(void)
{
struct passwd *pwd;
pwd = getpwuid(geteuid());
printf("%s\n", pwd->pw_name);
return (0);
}

[{"Product":{"code":"SSWRJV","label":"IBM Spectrum LSF"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"--","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"6.1","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}},{"Product":{"code":"SSWRJV","label":"IBM Spectrum LSF"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":null,"Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
23 June 2018

UID

isg3T1013974