Technical article 105940

The command "logname" doesn't report the login name while in single-user (maintenance) mode under SCO OpenServer 5.0.x.

OpenServer 5.0.0OpenServer 5.0.2OpenServer 5.0.4

Written · Last revised

Problem

In single user (maintenance) mode I type "logname" and instead of the system returning the login name, it returns:

logname: could not find entry in /etc/utmp

Cause

The functionality of "logname" is behaving properly. The command "logname" is available only in multiuser mode.

The "login" process registers the login name with /etc/utmp; however, login is not run when single-user (maintenance) mode is entered so no login name is registered.

Solution

If the "logname" command is to be used, the system must be booted to multiuser mode.

An alternate method of finding the login name is to run:

id -lun
which will not depend on utmp.
Or, alternatively:
id -l | sed 's/.*luid=[0-9]*(//;s/).*//'

See also

TA105022 "logname(C) fails with the error message 'could not find entry in /etc/utmp'."

From the Xinuos technical article database, record 105940. Reproduced with permission. The original is at www.sco.com/ta/105940, which is reachable but blocked from search engines. Xinuos marks this article against a retired product line. That refers to the product’s lifecycle, not to whether the advice still works — plenty of it still applies to running systems.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.