Solved How do I install the src component post install?

D

d3crypt

Guest
Whenever I run freebsd-update, It says src component not installed. I don't have the option to install it during installation because this my FreeBSD box is a Digital Ocean VPS. I tried using wget(1) to download the src.txz, and then copying it to /usr/src/sys/
Then I ran freebsd-update again, and It says It still isn't installed.
 
Thanks so much. Running tar -C / -xvf src.txz worked great. Then I ran freebsd-update fetch; freebsd-update install
 
Alternatively, you can use svn(1)to get the source code of any branch (HEAD , STABLE or any particular RELEASE) by using
# svn checkout https://svn.FreeBSD.org/base/head /usr/src
Details are here.

EDIT : Lately, I have noticed that using the https mirror may cause issues, so you may want to use svn:// if the https:// mirror fails.
 
Last edited:
Thank you, Fnoyanisi. Your answer worked for me on my Digital Ocean FreeBSD instance, which is missing the SRC tar ball. For those of us new or returning to FreeBSD, the distro comes with a "light" version of subversion, subversion-lite, installed. The client (command) for the installed version is svnlite, not svn. So Fnoyanisi's command would be:
# svnlite checkout https://svn.FreeBSD.org/base/head /usr/src

Alternatively, you can use svn(1)to get the source code of any branch (HEAD , STABLE or any particular RELEASE) by using
# svn checkout https://svn.FreeBSD.org/base/head /usr/src
Details are here.

EDIT : Lately, I have noticed that using the https mirror may cause issues, so you may want to use svn:// if the https:// mirror fails.
 
Note that you want to either use freebsd-update(8) or svnlite(1) to manage your source tree, not both. If you want to keep using svnlite(1) remove the src component from /etc/freebsd-update.conf so they don't interfere with each other.

Do NOT checkout /base/head! That's 13-CURRENT. For 12.1-RELEASE use base/releng/12.1, for 11.3-RELEASE use base/releng/11.3. Make sure your source tree actually lines up with the version you have.
 
I have to say that I was a bit disappointed that there doesn't seem to be a way to use freebsd-update(8) to install missing components like the source tree. I needed it on a friend's notebook to build drm-kmod from ports and ended up fetching the source via ftp and extracting it manually. That could have gone easier.
 
Back
Top