Skip to content

Instantly share code, notes, and snippets.

Last active May 28, 2023 14:32
What would you like to do?
Updating FreeBSD -CURRENT from source, and more


  • the routine is personalised – things such as SDDM and graphics/drm-devel-kmod in the mix, and the longhand helps me to not make mistakes after being distracted (or falling asleep at the keyboard, or whatever)
  • /bin/csh for all commands below, some no longer require root since I changed ownership of /usr/doc, /usr/obj, /usr/ports, and /usr/src.


  1. glance at,, and to estimate whether it's a good time to update
  2. su -
  3. pkg lock -l
  4. pkg unlock emulators/virtualbox-ose-kmod graphics/drm-510-kmod graphics/drm-515-kmod
  5. chown -vR grahamperrin /usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG/usr/ports/
  6. exit
  7. git -C /usr/ports branch && git -C /usr/src branch
  8. git -C /usr/ports pull --ff-only freebsd main && git -C /usr/src pull --ff-only freebsd main
  9. repeat step 8 until no changes are found
echo "" ; date ; uname -sr ; echo "shell: $SHELL" ; echo "" ; set freebsdmaingitcommitcount="`git -C /usr/src rev-list --first-parent --count HEAD`" && echo "freebsd/main (FreeBSD-CURRENT) Git commit count: $freebsdmaingitcommitcount" && set freebsdmaingithash="`git -C /usr/src rev-list --max-count=1 HEAD`" && echo "freebsd/main Git hash: $freebsdmaingithash" && echo "<$freebsdmaingithash>" && echo "– in context: <$freebsdmaingithash>"
  1. cd /usr/src && time make -j4 buildworld > & buildworld.log && time make DISABLE_VULNERABILITIES=yes -j2 buildkernel > & buildkernel.log && tail buildworld.log && tail buildkernel.log
  2. continue using the desktop environment until completion of the builds
  3. check the tails of the first and second logs for sanity
  4. sudo bectl create n"$freebsdmaingitcommitcount"-"$freebsdmaingithash"-a && sudo bectl activate n"$freebsdmaingitcommitcount"-"$freebsdmaingithash"-a && sudo bectl mount n"$freebsdmaingitcommitcount"-"$freebsdmaingithash"-a /tmp/up
  5. sudo sysrc -R /tmp/up sddm_enable="NO"
  6. sudo bectl umount n"$freebsdmaingitcommitcount"-"$freebsdmaingithash"-a && bectl list -c creation
  7. use bectl(8) to shorten the name of the boot environment – remove twenty-eight characters from the tail of the git hash, leave twelve
  8. restart the computer
  9. key Alt-F2 for ttyv1
  10. login
  11. nextboot -o "-s"
  12. cd /usr/src && time make installkernel > & installkernel.log && history -S && shutdown -r now
  13. /bin/csh
  14. mount -uw /
  15. zfs mount -a
  16. kldload radeonkms
  17. setenv EDITOR /usr/local/bin/nano
  18. tail /usr/src/installkernel.log
  19. check the tail of the third log for sanity
  20. etcupdate -p
  21. cd /usr/src && time make installworld > & installworld.log && etcupdate -B
  22. tail -n 100 /usr/src/installworld.log
  23. check the tail of the fourth log for sanity
  24. make -DBATCH_DELETE_OLD_FILES delete-old && exit
  25. pkg search drm-510-kmod ; pkg search drm-515-kmod
  26. pkg lock -l
  27. pkg lock emulators/virtualbox-ose-kmod drm-510-kmod graphics/drm-515-kmod
  28. pkg upgrade --yes && pkg clean -a && pkg autoremove
  29. sysrc sddm_enable="YES" && history -S && reboot -r
  30. sign in to the desktop environment.


For an existing poudriere jail named main with method src=/usr/src to gain an update equal to its host:

  • sudo poudriere jail -u -j main

Then, have readily-available packages of ports that are special to you. For example:

  • sudo poudriere ports -u && sudo poudriere bulk -j main -b latest -Ct emulators/virtualbox-ose-kmod drm-510-kmod graphics/drm-515-kmod graphics/gpu-firmware-radeon-kmod@btc graphics/gpu-firmware-radeon-kmod@sumo graphics/gpu-firmware-radeon-kmod@turks



git -C /usr clone -o freebsd -b main --depth 1 src

One-off, 2021-03-02

git -C /usr/src pull --ff-only --unshallow

One-off, 2021-03-10

After removing all source files:

git -C /usr clone -o freebsd -b main src

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment