Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Updating FreeBSD -CURRENT from source, and more

Notes:

Routine

  1. glance at https://cgit.freebsd.org/src/log/ to estimate whether it's a good time to update
  2. pkg lock -l
  3. pkg unlock graphics/drm-510-kmod
  4. git -C /usr/ports pull --ff-only && git -C /usr/src pull --ff-only
  5. repeat step 4 until no update is found
echo "" ; date ; uname -sr ; echo "shell: $SHELL" ; echo "" ; git -C /usr/ports pull --ff-only && echo "" ; git -C /usr/src pull --ff-only && 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 "<https://cgit.freebsd.org/src/commit/?id=$freebsdmaingithash>" && echo "– in context: <https://cgit.freebsd.org/src/log/?qt=range&q=$freebsdmaingithash>"
  1. cd /usr/src && time make -j2 buildworld > & buildworld.log && time make -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. bectl create n"$freebsdmaingitcommitcount"-"$freebsdmaingithash"-a && bectl activate n"$freebsdmaingitcommitcount"-"$freebsdmaingithash"-a && bectl mount n"$freebsdmaingitcommitcount"-"$freebsdmaingithash"-a /tmp/up
  5. sysrc -R /tmp/up sddm_enable="NO"
  6. bectl umount n"$freebsdmaingitcommitcount"-"$freebsdmaingithash"-a && bectl list -c creation
  7. use bectl(8) to shorten the name of the boot environment – remove nineteen characters from the tail of the git hash, leave eleven
  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-devel-kmod
  26. pkg lock -l
  27. pkg lock graphics/drm-510-kmod
  28. pkg upgrade --yes && pkg clean -a && pkg autoremove
  29. sysrc sddm_enable="YES" && history -S && shutdown -r now
  30. sign in to the desktop environment.

Additionally

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

  • poudriere jail -u -j main

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

  • poudriere ports -u && poudriere bulk -j main -b latest -Ct emulators/virtualbox-ose-kmod graphics/drm-kmod graphics/drm-54-kmod graphics/drm-510-kmod graphics/gpu-firmware-kmod

Retrospective

Originally

git -C /usr clone -o freebsd -b main --depth 1 https://git.freebsd.org/src.git src

https://old.reddit.com/r/freebsd/comments/keme3b/heads_up_freebsd_changing_from_subversion_to_git/ghxggjm/

One-off, 2021-03-02

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

https://lists.freebsd.org/pipermail/freebsd-current/2021-March/078985.html

One-off, 2021-03-10

After removing all source files:

git -C /usr clone -o freebsd -b main https://git.freebsd.org/src.git src

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