Operating System - HP-UX
1833016 Members
2289 Online
110048 Solutions
New Discussion

sh: Generated or received a file descriptor number that is not valid.

 
SOLVED
Go to solution
Teck Sim
Frequent Advisor

sh: Generated or received a file descriptor number that is not valid.

When I first log in to the server after I entered my username/password:

Your current Oracle instance is set to SMT1, use the . sid
command to change your Oracle instance.

And right here, it paused for about 1 minute or so, and returned the following message:

sh: Generated or received a file descriptor number that is not valid.

Please help.
Thanks.
4 REPLIES 4
Dietmar Konermann
Honored Contributor
Solution

Re: sh: Generated or received a file descriptor number that is not valid.

Hi, Teck!

There may be some corruption in the history file ($HOME/.sh_history by default). Try to remove that file before logging in again.

Regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Dave Chamberlin
Trusted Contributor

Re: sh: Generated or received a file descriptor number that is not valid.

You may have a problem in your .profile. One way to see which item is the problem is to add echo statements throughout the file, - these will then indicate how far the script is getting before your problem. Then you can focus on the problem item.
Bill Hassell
Honored Contributor

Re: sh: Generated or received a file descriptor number that is not valid.

You'll need to trace your .profile in your home directory. Run it by hand using:

sh -x $HOME/.profile

This will trace execution of everything in .profile. but most likely, the problem is in another script called by your .profile so do the same sh -x with the other scripts until you locate where the error is located.


Bill Hassell, sysadmin
INCS Dept.
Frequent Advisor

Re: sh: Generated or received a file descriptor number that is not valid.

Hi,

This problem has been bugging us for a long time now. It seems to be a problem of the shell related to the .sh_history file. Whenever someone logged into a system this user occasionally encountered the "Generated or received .....". This happened for several different users.

We saw that more than 8000 times the .sh_history was opened, just for the same user in 1 session (same tty). As a result of this we almost ran into the maximum of the kernel parameter nfile (use sar -v to see the current value on the system).

We were fortunate to had a tool like lsof on the system so we could track this down.

So what we did was the following:

1. remove all .sh_history files on the system.
2. set HISTFILE and HISTSIZE variables in the /etc/profile and export them. The .sh_history file will be created whenever a user logs into the system, so do not worry.

Hope this works.

Bye,

INCS Dept.