portsnap Generating a "Bad file descriptor" Error Message

Polytropon freebsd at edvax.de
Mon Sep 10 13:43:43 UTC 2012

On Mon, 10 Sep 2012 08:56:29 -0400, Pierre-Luc Drouin wrote:
> On Tue, Sep 4, 2012 at 10:14 AM, Pierre-Luc Drouin <pldrouin at gmail.com>wrote:
> > Hi,
> >
> > so I have been having problems using portsnap lately. I always get a "Bad
> > file descriptor" message when trying using it on one of my i386 machine:
> >
> > Looking up portsnap5.freebsd.org mirrors... none found.
> > Fetching snapshot tag from portsnap5.freebsd.org... done.
> > Fetching snapshot metadata... done.
> > Fetching snapshot generated at Mon Sep  3 20:04:44 EDT 2012:
> > 86abb3c6f24b24e7fdadda42805f9ae38f487177dcb949  0% of   67 MB    0  Bps
> > fetch:
> > http://portsnap5.freebsd.org/s/86abb3c6f24b24e7fdadda42805f9ae38f487177dcb9493f5e0cb4f792490b2f.tgz:
> > Bad file descriptor
> > fetch:
> > 86abb3c6f24b24e7fdadda42805f9ae38f487177dcb9493f5e0cb4f792490b2f.tgz: Bad
> > file descriptor
> >
> > I tried fsck -y the /var, /tmp and /usr partitions and everything seems
> > fine. What could the problem be?
> >
> > Thanks!
> >
> Hi,
> Anyone has an idea about what could be causing this problem?

I'm not familiar enough with portsnap (I use CVS) so I can just
throw some guesses around:

The message "Bad file descriptor" is issued by fetch and seems
to be for _your_ side of the connection, and I assume it is
regarding the place where the requested file will be fetched
to. I don't exactly know _where_ that is. It could be in
the ports tree or in a temporary location (from where the
results are then written to /usr/ports). The manpage mentions
a default workdir of /var/db/portsnap which is on the /var
partition. You checked that, no errors.

Just check what /var/db/portsnap contains. In worst case,
remove portsnap/ and recreate that directory. I have no
idea what it is supposed to contain, maybe make a copy of
it. You could also try to manually create the file, e. g.
by issuing

	# touch /var/db/portsnap/86abb3c6f24b24e7fdadda42805f9ae38f487177dcb9493f5e0cb4f792490b2f.tgz

Look if the file is there. Use

	# stat /var/db/portsnap/86abb3c6f24b24e7fdadda42805f9ae38f487177dcb9493f5e0cb4f792490b2f.tgz

to check if everything is okay.

You could also try to manually fetch the file using fetch or
maybe even wget, just to see if it can be downloaded and
written properly, to a different location, e. g.

	# cd /tmp
	# fetch http://portsnap5.freebsd.org/s/86abb3c6f24b24e7fdadda42805f9ae38f487177dcb9493f5e0cb4f792490b2f.tgz


	# cd /tmp
	# wget http://portsnap5.freebsd.org/s/86abb3c6f24b24e7fdadda42805f9ae38f487177dcb9493f5e0cb4f792490b2f.tgz

That should be _no_ problem (with the correct file name of course).

Again, "Bad file descriptor" is often seen in relation to file
system trouble. I've seen that in the past myself.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list