19

I am trying to run an update of freebsd10 and I am being asked for the kernel sources

===>>> Launching child to update lsof-4.89.b,8 to lsof-4.89.d,8

===>>> All >> lsof-4.89.b,8 (9/9)

===>>> Currently installed version: lsof-4.89.b,8
===>>> Port directory: /usr/ports/sysutils/lsof

        ===>>> This port is marked IGNORE
        ===>>> requires kernel sources


        ===>>> If you are sure you can build it, remove the
               IGNORE line in the Makefile and try again.

===>>> Update for lsof-4.89.b,8 failed
===>>> Aborting update

but sysinstall no longer exist

sysinstall: not found

What is the new method of installing the kernel sources in FreeBSD10?

I thought bsdinstall, but it only tries to chop up my disk which I do not want enter image description here

  • You're fairly evidently not updating FreeBSD if you are upgrading a third-party port by the name of sysutils/lsof. Even aside from the fact that this is happening in /usr/ports, the actual FreeBSD operating system command is fstat. Which are you actually trying to do: upgrade the ports collection? or upgrade the operating system? Because they are two different answers and two different chapters of the FreeBSD Handbook. Yes, this is all in the Handbook. – JdeBP May 22 '15 at 6:21
  • lsof was looking for them and I really just wanted them. I am not shy about a kernel, but the info is no where to be found. Just getting the current kernel sources. – nix May 24 '15 at 2:27
6

You can do it:

git clone https://github.com/freebsd/freebsd.git /usr/src
cd /usr/src; make clean
  • 2
    For future searchers, this will pull down a significant amount of additional data (git stuff) that's not needed for actual building from source. J. Delgado's answer is the canonical and most efficient method. – Royce Williams Mar 1 '18 at 7:34
37

You can manually download and extract a tarball of the full source tree for your specific release from ftp://ftp.freebsd.org/pub/FreeBSD/releases/

E.g.

fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/10.2-RELEASE/src.txz

tar -C / -xzvf src.txz

10.2-RELEASE MUST be replaced with correct version of your OS.

One can find version using command: freebsd-version -k

The minor versions should be ignored to fetch from the above URL. For ex: if it is 10.2-RELEASE-p1, just use: 10.2-RELEASE

  • This is the right answer. – mghaoui Jan 18 '18 at 19:42
  • 2
    Works with FreeBSD 11.2. – Code4R7 Jul 30 '18 at 17:13
  • 1
    Note that the -z option is unnecessary here, as tar will autodetect the input format. Per the man page, In extract or list modes, this option is ignored. I also like doing this inline: fetch -o- ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/X.Y-RELEASE/src.txz | sudo tar -C / -xvf -. No need to store src.txz locally. – ghoti Sep 25 '18 at 20:51
11

A bit more generic solution:

fetch -o /tmp ftp://ftp.freebsd.org/pub/`uname -s`/releases/`uname -m`/`uname -r | cut -d'-' -f1,2`/src.txz

tar -C / -xvf /tmp/src.txz

And you can replace /tmp with your favorite directory to download things into.

Or:

svn checkout https://svn.freebsd.org/base/releng/`uname -r | cut -d'-' -f1,1` /usr/src

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.