Posted by & filed under Sysadmin.

I recently setup a new FreeBSD 6.2 server, only to find the following:

server# cd /usr/ports
/usr/ports: No such file or directory.

I panicked a little bit, as I’ve not setup a freeBSD server in a while, so I tried to recall what I did last time.

I remembered that all I did last time was use “cvsup”, however…

server# cvsup
cvsup: Command not found.


Here’s the deal… apparently the “cvsup” command is no longer used, and instead we’ve now got “csup“, which apparently is a rewrite of cvsup in C. This can be quite confusion if you were not aware of the change (like myself).

Now we know this we can log in as the “root” user, and setup the ports:

First of all, copy the example “ports-supfile” (needed for csup) to your root directory.

server# cp /usr/share/examples/cvsup/ports-supfile /root/ports-supfile

Now we run the csup command:

server# csup /root/ports-supfile
Name lookup failure for “”: hostname nor servname provided, or not known

Obviously there’s a problem. We need to edit the “ports-supfile” and change the host, or do we…?

server# csup
Usage: csup [options] supfile
-1 Don’t retry automatically on failure (same as “-r 0″)
-4 Force usage of IPv4 addresses
-6 Force usage of IPv6 addresses
-A addr Bind local socket to a specific address
-b base Override supfile’s “base” directory
-c collDir Subdirectory of “base” for collections (default “sup”)
-d delLimit Allow at most “delLimit” file deletions (default unlimited)
-h host Override supfile’s “host” name
-i pattern Include only files/directories matching pattern.
May be repeated for an OR operation. Default is
to include each entire collection.
-k Keep bad temporary files when fixups are required
-l lockfile Lock file during update; fail if already locked
-L n Verbosity level (0..2, default 1)
-p port Alternate server port (default 5999)
-r n Maximum retries on transient errors (default unlimited)
-s Don’t stat client files; trust the checkouts file
-v Print version and exit
-z Enable compression for all collections
-Z Disable compression for all collections

We can use the -h option of csup to supply a host override, we now just need to find a cvsup host to use. Select one that is closest to your server, for example, my server is in the UK, so I would use “”. You could also use fastest_cvsup, to find the fastest one for you.

Now we issue the command again, but now with the -h option:

server# csup -h /root/ports-supfile

And with any luck, providing your server has an internet connection the process should begin.

Note: I hate using the “vi” editor and since this system hasn’t got ports yet, I can’t install my preferred editor “nano”, once I have nano installed via ports, I would edit the ports-supfile with the selected cvsup hostname, meaning I do not have to supply one in the future when I come to update the ports.

Hope this helps somebody!

11 Responses to “FreeBSD 6.2 “/usr/ports: No such file or directory””

  1. agu

    HoooooHooo thanks ……..nice frend..this problem I am source…Now I faind..again thanks

  2. Tom

    Helped me a lot!
    Thank you!
    AND I HATE vi too. It should be deleted from every hard drive in existence.
    I hate that damn ding, ding, ding, ding….^H~E crap!
    Whoever though up such a dumb editor should be shot, then burned, then shot again just to be sure!

  3. Tom

    One more comment on FreeBSD, why can’t the damn sysinstall sort the package list before asking for a CD?
    CD swapping, package by package?
    A full package list would take days, even weeks, and wear out a CD drive door.
    Another stupid idea but not as stupid as vi.

  4. jelf

    Hey, just wanted to say thanks – this was just the info needed to get me up and running.

  5. Erik

    thanks, mate. i’m new to freebsd but this got me started. really appreciate that you took the time to write this post.

  6. flatdog

    He hates using vi, so he doesn’t edit the file, funny.
    I think you have no idea about using vi :)

  7. Azhar

    Thanks for this guide. It is a huge help for a newbie like me

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>