Operating System - HP-UX
1748180 Members
4138 Online
108759 Solutions
New Discussion юеВ

Re: tar: couldn't get uname for uid 4968268

 
SOLVED
Go to solution
rhansen
Frequent Advisor

tar: couldn't get uname for uid 4968268

Hello,

I found a similar thread but my issue is a bit different. I am taring up files and directories with unknown UID and GID on my servers (AIX and HP-UX) and deleting them. The tar and deletion works fine for AIX but it is failing for HP-UX with the error "tar: couldn't get uname for uid 496826".

I already know that this UID does not exist in /etc/passwd. My tar is failing and eventually the deletion as well. FYI..the tar up of files before deletion is a precautionary measure.

Please advise on how to proceed.

Thanks.
10 REPLIES 10
Alex Glennie
Honored Contributor

Re: tar: couldn't get uname for uid 4968268

would help to know syntax an version of o/s but ....
http://docs.hp.com/en/B2355-60105/tar.1.html

o

Suppress writing certain directory information that older versions of tar cannot handle on input. tar normally writes information specifying owners and modes of directories in the archive. Earlier versions of tar, when encountering this information, give error messages of the form:

name - cannot create

When o is used for reading, it causes the extracted file to take on the user and group IDs of the user running the program rather than those on the tape. This is the default for the ordinary user and can be overridden, to the extent that system protections allow, by using the p function modifier.

maybe relevant ?
Prashanth.D.S
Honored Contributor

Re: tar: couldn't get uname for uid 4968268

Hi,

This issue could occurr if you delete a user without removinig the files of these users.

To find the files that tar issues this warning about, you could
search for files with uid set equal to 496826 (in our example):

cd /;ll -R | grep 496826

To get rid of the warnings, either remove the files, or use the
chown(1) commmand to give them a valid owner

Best Regards,
Prashanth
Patrick Wallek
Honored Contributor

Re: tar: couldn't get uname for uid 4968268

The "tar: couldn't get uname for uid 496826" message should **NOT** cause tar itself to fail.

Is all of this done via a script of some sort? If so, is it checking the return code of tar when the tar command finished? If it is then it may be seeing a non-zero return code and then failing.

Have you tried running a manual tar with a sub-set of the files and see if it succeeds? If it does, check the return code when it finishes with a "echo $?". See if it is 0 or some other value.
rhansen
Frequent Advisor

Re: tar: couldn't get uname for uid 4968268

Patrick,

Yes you are right the tar is being done as expected but the removal of file is failing. I am pasting the command in the script that does that.

tar cvf foo.tar /home/user/test/app && rm -f /home/user/test/app

And I just found that the && rm part of the command works on AIX but not on HP-UX. Could someone comment on this?

Thanks.
rhansen
Frequent Advisor

Re: tar: couldn't get uname for uid 4968268

Since the tar command is returning a non-zero value? Can someone help in adding logic to the tar command not to worry about uid/gid of the file?

Thanks in advance.
Patrick Wallek
Honored Contributor
Solution

Re: tar: couldn't get uname for uid 4968268

First, find out what the return code is that it is returning in this case.

Then build an if statement around the tar return code.

Something like:

tar cvf foo.tar /home/user/test/app
RETCODE=$?

if (( ${RETCODE} == 0 || ${RETCODE} == 3 )) ; then
rm -f /home/user/test/app
else
echo "The tar command returned error: ${RETCODE}"
fi

In the 'if' statement above substitute the return code that 'tar' is currently returning where "${RETCODE} == 3". You want to leave the '0' test since a normal return code is 0.
OldSchool
Honored Contributor

Re: tar: couldn't get uname for uid 4968268

I agree with Patrick. The only question I'd have is, "Does any other warning in tar return an exit code of 3". I couldn't find the errors documented in any HP-UX man page I examined.
Patrick Wallek
Honored Contributor

Re: tar: couldn't get uname for uid 4968268

I was only using '3' as an example above.

I just did a couple of quick tests and on my 11.11 and 11.23 servers, a return code of '5' is given when you the the "couldn't get uname for uid" warning.

So my script snippet would look like:

tar cvf foo.tar /home/user/test/app
RETCODE=$?
if (( ${RETCODE} == 0 || ${RETCODE} == 5 )) ; then
rm -f /home/user/test/app
else
echo "The tar command returned error: ${RETCODE}"
fi
rhansen
Frequent Advisor

Re: tar: couldn't get uname for uid 4968268

That's right Patrick. I have used exit code of 5. Thanks for your help.