Downloading FreeBSD src to USB thumb drive

Just a little info for the noobs (like me):

I found that I needed FreeBSD src on my install, to help me figure out the issue with my sound configuration. I am running Nomad on a 256G Samsung USB3.1 thumb drive. When I tried to download the src files from github, here’s the error I got:

root@NomadBSD:/home/nomad # git clone https://git.FreeBSD.org/src.git /usr/src
Cloning into '/usr/src'...
remote: Enumerating objects: 4101001, done.
remote: Counting objects: 100% (379565/379565), done.
remote: Compressing objects: 100% (27610/27610), done.
Receiving objects:  21% (871381/4101001), 296.11 MiB | 2.15 MiB/s
/: write failed, filesystem is full
fatal: write error: No space left on device
fatal: fetch-pack: invalid index-pack output

It took me a minute to realize that the Nomad root directory files are installed on a partition that is less than 4G and it has only about 34M of space left. The rest of the system, the user space, is mounted on the rest of the drive on /data. So the normal /usr/src directory for the installation of the src files had no room on it. Still, that’s where freebsd-update looks for it when updating.

root@NomadBSD:/home/nomad # df -h
Filesystem              Size    Used   Avail Capacity  Mounted on
/dev/label/nomadroot    3.4G    3.1G     34M    99%    /
devfs                   1.0K    1.0K      0B   100%    /dev
tmpfs                    20G     46M     20G     0%    /tmp
tmpfs                   3.6G    144K    3.6G     0%    /var/log
procfs                  4.0K    4.0K      0B   100%    /proc
fdescfs                 1.0K    1.0K      0B   100%    /dev/fd
/dev/label/nomaddata    232G     13G    201G     6%    /data
/dev/md0.uzip           6.6G    6.0G    651M    90%    /unionfs/usr/local
/dev/fuse               238G     19G    201G     9%    /usr/local
/data/compat            232G     13G    201G     6%    /compat
/data/var/tmp           232G     13G    201G     6%    /var/tmp
/data/var/db            232G     13G    201G     6%    /var/db
/data/usr/ports         232G     13G    201G     6%    /usr/ports

The solution was to create a src directory under /data/usr and install the src to that. (In fact, I did the same with ports, since the drive is plenty big.)

`# mkdir /data/usr/src`
root@NomadBSD:/ # git clone https://git.FreeBSD.org/src.git /data/usr/src
Cloning into '/data/usr/src'...
remote: Enumerating objects: 4101001, done.
remote: Counting objects: 100% (379565/379565), done.
remote: Compressing objects: 100% (27610/27610), done.
remote: Total 4101001 (delta 373820), reused 351955 (delta 351955), pack-reused 3721436
Receiving objects: 100% (4101001/4101001), 1.40 GiB | 2.19 MiB/s, done.
Resolving deltas: 100% (3251030/3251030), done.
Updating files: 100% (88339/88339), done.

I then sym-linked the /usr/src directory to the /data/usr/src directory by:

ln -s /usr/src /data/usr/src

I did the same with /data/ports. So, now I have both the ports tree and and FreeBSD src.

Then I updated the src with:

# cd /data/usr/src
# git pull --rebase

Just a comment, though, it is not recommended to mix ports with packages, due to the possibility of conflicting dependencies not being automagically resolved and the ports tree does take a lot of space on your thumb drive.

TH

1 Like