Link to home
Start Free TrialLog in
Avatar of hrolsons
hrolsonsFlag for United States of America

asked on

"Bad File Descriptor" in FreeBSD

I was having trouble writing to a directory so I got on the server and for that directory it said "Bad File Descriptor".

Does anyone know how to fix this?
Avatar of Chris Staunton
Chris Staunton
Flag of United States of America image

File corruption, have you run an fsck yet?
Avatar of hrolsons

ASKER

I have not, I'll look up how to do that.
My hosting company ran the fsck and I'm still getting the error.
How do you upload the file? Where do you get the error?
"Bad file descriptor" is a probable sign of software bug - closing file and then writing to descriptor. or writing to TCP connection when it was not open etc etc.
I'm uploading the file via a Visual Basic program I wrote.
Is it a windows error or a error text in (FTP) protocol or a error logged somewhere on UNIX side?
I get "Path Not Found" on the FTP side, but when I look up the file in unix doing a "ls -li" is where I see the "Bad File Descriptor".
i would tend to think that there is a problem with your FTP server software. namely it loses file descriptor on otherwise "good" error.

try another FTP server?
Yes, but taking FTP out of the equation all together I still see the error when I'm in an SSH session and issue "ls -li".
On particular freebsd system - are userland and kernel versions matching? (you cannot check userland, but if uname -a says either -p[0-9]* or -current somewhere it is a clear sign that patched kernel was installed likely without updating userland (by means of make world)
When I run uname -a I get:

FreeBSD xxx-xx-xxx-xxx.dedicated.abac.net 7.1-RELEASE-p11 FreeBSD 7.1-RELEASE-p11 #0: Fri Feb 26 18:34:31 UTC 2010     root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386

I'm not sure what userland is and will search Google and learn more about it.
You have patched kernel.
It might happen that respective userland aka all programs included in system, was not installed. Sadly they are not well versioned.

You can try recompiling "ls" command alone (in usr.bin)
I ended up sending all files to a new directory and deleting the old and it seems to be working fine.  Not sure what the speedbump was but it seems to be in the past.
ASKER CERTIFIED SOLUTION
Avatar of gheist
gheist
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial