Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

LOGNAME: Undefined variable

145 views
Skip to first unread message

neilsolent

unread,
Nov 2, 2009, 5:16:29 AM11/2/09
to
Hi All

On a Solaris 8 system of ours, scripts are failing because daemon
processes (running as root) have started up with the environment
variable LOGNAME unset. I have checked /etc/profile, /.profile, /.shrc
and root's entry in /etc/passwd and all looks the same as another
working system.

Where else can I look to track down why LOGNAME is not set?

Thanks,
Neil

Martin Paul

unread,
Nov 2, 2009, 6:17:30 AM11/2/09
to
neilsolent wrote:
> Where else can I look to track down why LOGNAME is not set?

I think that LOGNAME is set by /usr/bin/login, so it might not be set
for processes which haven't been started from login shells. Some shells
(tcsh/zsh) seem to set it explicitely, while others don't.

Maybe you should use /usr/bin/id or some alternative in your scripts
instead?

Martin.
--
SysAdmin | Institute of Scientific Computing, University of Vienna
PCA | Analyze, download and install patches for Solaris
| http://www.par.univie.ac.at/solaris/pca/

neilsolent

unread,
Nov 2, 2009, 6:42:34 AM11/2/09
to
> I think that LOGNAME is set by /usr/bin/login, so it might not be set
> for processes which haven't been started from login shells. Some shells
> (tcsh/zsh) seem to set it explicitely, while others don't.
>
> Maybe you should use /usr/bin/id or some alternative in your scripts
> instead?
>

Thanks for the reply. Yes we could change scripts (though they are
vendor supplied).
The real problem here though is 2 servers (supposedly) built the same
should behave the same - not good practice to hack things to force it
to work!

Richard B. Gilbert

unread,
Nov 2, 2009, 7:41:59 AM11/2/09
to

It seems pretty clear that either the two servers were NOT built the
same or that one or both have been modified since they were built!

Do you use some form of "Change Control"? If not, perhaps you should.

Martin Paul

unread,
Nov 2, 2009, 8:11:08 AM11/2/09
to
neilsolent wrote:
> (supposedly)

That could be the problem :) Anyway, here's a few things I'd try for a
start:

Think: When you say that the servers are installed in the same way, are
they really using the same OS release (/etc/release), have the same
packages (pkginfo) and patches installed (pca, what else :) ), and have
the same modifications been made to central configuration files?

Run "find /etc -type f | xargs grep LOGNAME" on both machines and look
for differences.

Temporarily modify one of the script to write output from "env" to a
file ("/usr/bin/env > /tmp/env.$$"). Is the LOGNAME setting the only
difference? If not, it may help you to identify the problem.

hth,

mp.

neilsolent

unread,
Nov 2, 2009, 9:57:56 AM11/2/09
to

> It seems pretty clear that either the two servers were NOT built the
> same or that one or both have been modified since they were built!

Yes, but I wasn't asking if you think the builds are identical!
Clearly they are not, clearly something has gone wrong.
The problem is to find out what.

> Do you use some form of "Change Control"?  If not, perhaps you should.

I agree. It is out of my hands though. Generally technical people
(that use these forums) are not the same people as those that decide
change control procedures.

Richard B. Gilbert

unread,
Nov 2, 2009, 11:35:36 AM11/2/09
to
neilsolent wrote:
>> It seems pretty clear that either the two servers were NOT built the
>> same or that one or both have been modified since they were built!
>
> Yes, but I wasn't asking if you think the builds are identical!
> Clearly they are not, clearly something has gone wrong.
> The problem is to find out what.
>

That is a mammoth task. I think it might be easier to rebuild both servers!

If you can't or won't do that, see man sysidconfig. The list of files
in the man page covers pretty much the whole configuration. Test those
files for identical content on both machines. There WILL be LEGITIMATE
differences; e.g. the nodename, IP address, etc.

>> Do you use some form of "Change Control"? If not, perhaps you should.
>
> I agree. It is out of my hands though. Generally technical people
> (that use these forums) are not the same people as those that decide
> change control procedures.
>

You might speak to the people in charge and point out that change
control can be valuable. It can also be a PITA but in some situations
it is worth the pain.

In situations such as your current one, change control (documenting and
publishing EXACTLY what you are going to do) can be a life/job saver!
It gives people who will be affected some notice and gives them an
opportunity to point out potential problems.

Chris Ridd

unread,
Nov 2, 2009, 12:19:27 PM11/2/09
to
On 2009-11-02 16:35:36 +0000, "Richard B. Gilbert"
<rgilb...@comcast.net> said:

> neilsolent wrote:
>>> It seems pretty clear that either the two servers were NOT built the
>>> same or that one or both have been modified since they were built!
>>
>> Yes, but I wasn't asking if you think the builds are identical!
>> Clearly they are not, clearly something has gone wrong.
>> The problem is to find out what.
>>
>
> That is a mammoth task. I think it might be easier to rebuild both servers!
>
> If you can't or won't do that, see man sysidconfig. The list of files
> in the man page covers pretty much the whole configuration. Test those
> files for identical content on both machines. There WILL be LEGITIMATE
> differences; e.g. the nodename, IP address, etc.

That also sounds a bit of a sledgehammer to crack a nut, though if
you're nervous about what *else* might have changed it is more
reasonable to rebuild them both.

Has someone changed shells on one of the machines?

--
Chris

Tim Bradshaw

unread,
Nov 3, 2009, 7:05:44 PM11/3/09
to
On 2009-11-02 10:16:29 +0000, neilsolent <n...@solenttechnology.co.uk> said:

> Where else can I look to track down why LOGNAME is not set?

I'd modify the scripts (or create equivalent scripts) which do a ptree
on their PID and have a look at what is up the tree. Chances are it is
different, somehow.

neilsolent

unread,
Nov 7, 2009, 6:28:31 AM11/7/09
to
Thanks everyone for your help. They are just going to rebuild the
system.
0 new messages