PreviousINDEXNext
Mail failure due to Cloudflare DNSSamba share visibility in Windows 10

FreeBSD source repository moves to Git

Late last year (2020), FreeBSD moved from subversion to git for their source code repository. Since I continue to build FreeBSD releases from source, this meant some changes in process.

To obtain the FreeBSD source code from git, use the following:

  # rm -rf /usr/src
  # git clone -b releng/12.2 --depth 1 https://git.freebsd.org/src.git /usr/src

The git command will clone just the releng/12.2 branch, not the rest of the git repo (all the other branches). This is because the --depth argument (which ignores history) implies --single-branch. The consequence of this is that to move to a later FreeBSD release (e.g. 13.0), the above commands have to be repeated, but specifing e.g. releng/13.0 as the branch.

The alternative is to clone the entire repository (2.6GB versus 1.6GB for just releng/12.2). You can then switch between branches at will. For example:

  # rm -rf /usr/src
  # git clone https://git.freebsd.org/src.git /usr/src
  # git checkout releng/12.2

Note: It is possible to define the branch you wish to track initially by adding the -b releng/12.2 option to the git clone command line.

To update the branch you are on to the latest version from the FreeBSD master repository:

  # cd /usr/src
  # git pull --ff-only

The --ff-only flag sets the pull option; git will give you a helpful information message if you don't supply it. If you are not updating source locally, --ff-only is probably the best choice.

Note that you can set --ff-only as a permanent option by:

  # git config pull.ff only # for this repository

or

  # git config --global pull.ff only # for all repositories

Updating /etc files

One fallout of the shift to git is that mergemaster is no longer the preferred method of updating /etc/ files, since git doesn't support the $FreeBSD$ ident tags used by subversion.

etcupdate should be used instead. It operates in a similar way to mergemaster, e.g. it has a -p option to be run pre-buildworld.

When using etcupdate for the first time, it should be bootstrapped. You must do this before nuking the svn src tree. Issue the command:

  # etcupdate extract

etcupdate has a configuration file /etc/etcupdate.conf, in which I put the following:

  FREEBSD_ID="yes"
  IGNORE_FILES="/etc/mail/*.cf"

This ensures etcupdate will

Here's what running etcupdate looks like:

Prebuild step

  root@opal:~ # etcupdate -p
    M /etc/group
    M /etc/master.passwd

Neat; it has merged local changes without any need for my interaction.

Post install

  root@opal:~ # etcupdate
    D /etc/amd.map
    D /etc/newsyslog.conf.d/amd.conf
    D /etc/rc.d/amd
    D /etc/rc.d/nsswitch
    D /etc/rc.d/timed
    D /etc/rc.firewall
    U /COPYRIGHT
    U /boot/device.hints
    U /etc/auto_master
    U /etc/autofs/include_ldap
    U /etc/autofs/include_nis
    U /etc/autofs/include_nis_nullfs
    U /etc/autofs/special_hosts
    U /etc/autofs/special_media
    U /etc/autofs/special_noauto
    U /etc/autofs/special_null
    U /etc/blacklistd.conf
    U /etc/cron.d/at
    U /etc/crontab
    U /etc/csh.cshrc
    U /etc/csh.login
    U /etc/csh.logout
    U /etc/ddb.conf
    U /etc/defaults/devfs.rules
    U /etc/defaults/periodic.conf
    U /etc/defaults/rc.conf
    U /etc/devd.conf
    U /etc/devd/asus.conf
    U /etc/devd/devmatch.conf
    U /etc/devd/hyperv.conf
    U /etc/devd/uath.conf
    U /etc/devd/ulpt.conf
    U /etc/devfs.conf
    U /etc/dhclient.conf
    U /etc/disktab
    U /etc/dma/dma.conf
    U /etc/fbtab
    U /etc/freebsd-update.conf
    U /etc/ftpusers
    U /etc/gettytab
    U /etc/gss/mech
    U /etc/gss/qop
    U /etc/hosts
    U /etc/hosts.allow
    U /etc/hosts.equiv
    U /etc/hosts.lpd
    U /etc/inetd.conf
    U /etc/libalias.conf
    U /etc/libmap.conf
    U /etc/locate.rc
    U /etc/login.access
    U /etc/login.conf
    U /etc/mac.conf
    U /etc/mail/Makefile
    U /etc/mail/README
    U /etc/mail/access.sample
    M /etc/mail/aliases
    U /etc/mail/freebsd.mc
    U /etc/mail/freebsd.submit.mc
    U /etc/mail/mailer.conf
    U /etc/mail/mailertable.sample
    U /etc/mail/virtusertable.sample
    U /etc/mtree/BSD.debug.dist
    U /etc/mtree/BSD.include.dist
    U /etc/mtree/BSD.lib32.dist
    U /etc/mtree/BSD.root.dist
    U /etc/mtree/BSD.sendmail.dist
    U /etc/mtree/BSD.tests.dist
    U /etc/mtree/BSD.usr.dist
    U /etc/mtree/BSD.var.dist
    U /etc/netconfig
    U /etc/netstart
    U /etc/network.subr
    U /etc/networks
    U /etc/newsyslog.conf
    U /etc/newsyslog.conf.d/ftp.conf
    U /etc/newsyslog.conf.d/lpr.conf
    U /etc/newsyslog.conf.d/opensm.conf
    U /etc/newsyslog.conf.d/sendmail.conf
    U /etc/nscd.conf
    U /etc/nsmb.conf
    U /etc/nsswitch.conf
    U /etc/ntp.conf
    U /etc/opieaccess
    U /etc/pam.d/README
    U /etc/pam.d/atrun
    U /etc/pam.d/cron
    U /etc/pam.d/ftp
    U /etc/pam.d/ftpd
    U /etc/pam.d/imap
    U /etc/pam.d/login
    U /etc/pam.d/other
    U /etc/pam.d/passwd
    U /etc/pam.d/pop3
    U /etc/pam.d/sshd
    U /etc/pam.d/su
    U /etc/pam.d/system
    U /etc/pam.d/telnetd
    U /etc/pam.d/xdm
    U /etc/pccard_ether
    U /etc/periodic/daily/100.clean-disks
    U /etc/periodic/daily/110.clean-tmps
    U /etc/periodic/daily/120.clean-preserve
    U /etc/periodic/daily/130.clean-msgs
    U /etc/periodic/daily/140.clean-rwho
    U /etc/periodic/daily/150.clean-hoststat
    U /etc/periodic/daily/200.backup-passwd
    U /etc/periodic/daily/210.backup-aliases
    U /etc/periodic/daily/300.calendar
    U /etc/periodic/daily/310.accounting
    U /etc/periodic/daily/330.news
    U /etc/periodic/daily/400.status-disks
    U /etc/periodic/daily/401.status-graid
    U /etc/periodic/daily/406.status-gmirror
    U /etc/periodic/daily/407.status-graid3
    U /etc/periodic/daily/408.status-gstripe
    U /etc/periodic/daily/409.status-gconcat
    U /etc/periodic/daily/410.status-mfi
    U /etc/periodic/daily/420.status-network
    U /etc/periodic/daily/430.status-uptime
    U /etc/periodic/daily/440.status-mailq
    U /etc/periodic/daily/450.status-security
    U /etc/periodic/daily/460.status-mail-rejects
    U /etc/periodic/daily/480.leapfile-ntpd
    U /etc/periodic/daily/480.status-ntpd
    U /etc/periodic/daily/500.queuerun
    U /etc/periodic/daily/510.status-world-kernel
    U /etc/periodic/daily/999.local
    U /etc/periodic/monthly/200.accounting
    U /etc/periodic/monthly/450.status-security
    U /etc/periodic/monthly/999.local
    U /etc/periodic/security/100.chksetuid
    U /etc/periodic/security/110.neggrpperm
    U /etc/periodic/security/200.chkmounts
    U /etc/periodic/security/300.chkuid0
    U /etc/periodic/security/400.passwdless
    U /etc/periodic/security/410.logincheck
    U /etc/periodic/security/700.kernelmsg
    U /etc/periodic/security/800.loginfail
    U /etc/periodic/security/900.tcpwrap
    U /etc/periodic/security/security.functions
    U /etc/periodic/weekly/310.locate
    U /etc/periodic/weekly/320.whatis
    U /etc/periodic/weekly/340.noid
    U /etc/periodic/weekly/450.status-security
    U /etc/periodic/weekly/999.local
    U /etc/phones
    U /etc/pkg/FreeBSD.conf
    U /etc/portsnap.conf
    M /etc/printcap
    U /etc/profile
    U /etc/protocols
    U /etc/rc
    U /etc/rc.bsdextended
    U /etc/rc.d/DAEMON
    U /etc/rc.d/FILESYSTEMS
    U /etc/rc.d/LOGIN
    U /etc/rc.d/NETWORKING
    U /etc/rc.d/SERVERS
    U /etc/rc.d/accounting
    U /etc/rc.d/addswap
    U /etc/rc.d/adjkerntz
    U /etc/rc.d/apm
    U /etc/rc.d/archdep
    U /etc/rc.d/auditd
    U /etc/rc.d/auditdistd
    U /etc/rc.d/automount
    U /etc/rc.d/automountd
    U /etc/rc.d/autounmountd
    U /etc/rc.d/bgfsck
    U /etc/rc.d/blacklistd
    U /etc/rc.d/bootparams
    U /etc/rc.d/bridge
    U /etc/rc.d/bsnmpd
    U /etc/rc.d/ccd
    U /etc/rc.d/cfumass
    U /etc/rc.d/cleanvar
    U /etc/rc.d/cleartmp
    U /etc/rc.d/cron
    U /etc/rc.d/ctld
    U /etc/rc.d/ddb
    U /etc/rc.d/defaultroute
    U /etc/rc.d/devd
    U /etc/rc.d/devfs
    U /etc/rc.d/devmatch
    U /etc/rc.d/dhclient
    U /etc/rc.d/dmesg
    U /etc/rc.d/dumpon
    U /etc/rc.d/fsck
    U /etc/rc.d/ftpd
    U /etc/rc.d/gbde
    U /etc/rc.d/geli
    U /etc/rc.d/geli2
    U /etc/rc.d/gptboot
    U /etc/rc.d/growfs
    U /etc/rc.d/gssd
    U /etc/rc.d/hastd
    U /etc/rc.d/hostapd
    U /etc/rc.d/hostid
    U /etc/rc.d/hostid_save
    U /etc/rc.d/hostname
    U /etc/rc.d/inetd
    U /etc/rc.d/iovctl
    U /etc/rc.d/ip6addrctl
    U /etc/rc.d/ipropd_master
    U /etc/rc.d/ipropd_slave
    U /etc/rc.d/ipsec
    U /etc/rc.d/iscsictl
    U /etc/rc.d/iscsid
    U /etc/rc.d/kadmind
    U /etc/rc.d/kdc
    U /etc/rc.d/keyserv
    U /etc/rc.d/kfd
    U /etc/rc.d/kld
    U /etc/rc.d/kldxref
    U /etc/rc.d/kpasswdd
    U /etc/rc.d/ldconfig
    U /etc/rc.d/linux
    U /etc/rc.d/local
    U /etc/rc.d/local_unbound
    U /etc/rc.d/localpkg
    U /etc/rc.d/lockd
    U /etc/rc.d/lpd
    U /etc/rc.d/mdconfig
    U /etc/rc.d/mdconfig2
    U /etc/rc.d/mixer
    U /etc/rc.d/motd
    U /etc/rc.d/mountcritlocal
    U /etc/rc.d/mountcritremote
    U /etc/rc.d/mountd
    U /etc/rc.d/mountlate
    U /etc/rc.d/moused
    U /etc/rc.d/msgs
    U /etc/rc.d/natd
    U /etc/rc.d/netif
    U /etc/rc.d/netoptions
    U /etc/rc.d/netwait
    U /etc/rc.d/newsyslog
    U /etc/rc.d/nfscbd
    U /etc/rc.d/nfsclient
    U /etc/rc.d/nfsd
    U /etc/rc.d/nfsuserd
    U /etc/rc.d/nisdomain
    U /etc/rc.d/nscd
    U /etc/rc.d/ntpd
    U /etc/rc.d/ntpdate
    U /etc/rc.d/opensm
    U /etc/rc.d/os-release
    U /etc/rc.d/othermta
    U /etc/rc.d/pf
    U /etc/rc.d/pflog
    U /etc/rc.d/pfsync
    U /etc/rc.d/power_profile
    U /etc/rc.d/powerd
    U /etc/rc.d/ppp
    U /etc/rc.d/pppoed
    U /etc/rc.d/pwcheck
    U /etc/rc.d/quota
    U /etc/rc.d/random
    U /etc/rc.d/rarpd
    U /etc/rc.d/rctl
    U /etc/rc.d/resolv
    U /etc/rc.d/root
    U /etc/rc.d/route6d
    U /etc/rc.d/routed
    U /etc/rc.d/routing
    U /etc/rc.d/rpcbind
    U /etc/rc.d/rtadvd
    U /etc/rc.d/rtsold
    U /etc/rc.d/rwho
    U /etc/rc.d/savecore
    U /etc/rc.d/securelevel
    U /etc/rc.d/sendmail
    U /etc/rc.d/serial
    U /etc/rc.d/sppp
    U /etc/rc.d/sshd
    U /etc/rc.d/statd
    U /etc/rc.d/static_arp
    U /etc/rc.d/static_ndp
    U /etc/rc.d/stf
    U /etc/rc.d/swap
    U /etc/rc.d/swaplate
    U /etc/rc.d/syscons
    U /etc/rc.d/sysctl
    U /etc/rc.d/syslogd
    U /etc/rc.d/sysvipc
    U /etc/rc.d/tmp
    U /etc/rc.d/ugidfw
    U /etc/rc.d/utx
    U /etc/rc.d/var
    U /etc/rc.d/virecover
    U /etc/rc.d/watchdogd
    U /etc/rc.d/wpa_supplicant
    U /etc/rc.d/ypbind
    U /etc/rc.d/ypldap
    U /etc/rc.d/yppasswdd
    U /etc/rc.d/ypserv
    U /etc/rc.d/ypset
    U /etc/rc.d/ypupdated
    U /etc/rc.d/ypxfrd
    U /etc/rc.initdiskless
    U /etc/rc.resume
    U /etc/rc.sendmail
    U /etc/rc.shutdown
    U /etc/rc.subr
    U /etc/rc.suspend
    U /etc/regdomain.xml
    U /etc/remote
    U /etc/rpc
    U /etc/security/audit_class
    U /etc/security/audit_control
    U /etc/security/audit_event
    U /etc/security/audit_user
    U /etc/security/audit_warn
    U /etc/services
    M /etc/shells
    U /etc/snmpd.config
    U /etc/ssh/ssh_config
    M /etc/ssh/sshd_config
    U /etc/ssl/openssl.cnf
    M /etc/sysctl.conf
    M /etc/syslog.conf
    U /etc/syslog.d/ftp.conf
    U /etc/syslog.d/lpr.conf
    U /etc/termcap.small
    U /etc/ttys
    U /root/.cshrc
    U /root/.k5login
    M /root/.login
    C /root/.profile
    A /etc/kyua/kyua.conf
    A /etc/motd.template
    A /etc/periodic/daily/221.backup-gpart
    A /etc/periodic/daily/222.backup-gmirror
    A /root/.shrc
  Warnings:
    Modified regular file remains: /etc/motd

The canned motd text is now in /etc/motd.template and prepended with the FreeBSD version at boot time by the motd service, the result of which is written to /var/run/motd.

Kernel version string in motd

One nit with 13.0, as a consequence of the move to git, is that the FreeBSD version string, issued as part of the motd, is now longer than 80 characters due to the inclusion of the git branch and commit information. For example:

  FreeBSD 13.0-BETA2 (GENERIC) #2 releng/13.0-678abec02: Sat Feb 13 10:11:39 GMT 2021

This annoyed me out of all proportion. I patched /etc/rc.d/motd to reduce the length by removing the branch name. Here's the diff:

  --- /var/db/etcupdate/current/etc/rc.d/motd	2021-02-09 16:19:18.675931000 +0000
  +++ /etc/rc.d/motd	2021-02-13 13:00:51.551911000 +0000
  @at;@at; -45,7 +45,7 @at;@at;
      fi

      T=`mktemp -t motd`
  -	uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T}
  +	uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,;s/releng.*-\([^:]*\)/[\1]/' > ${T}
      cat "${TEMPLATE}" >> ${T}

      install -C -o root -g wheel -m "${PERMS}" "$T" "${TARGET}"
 

Now it looks like:

   FreeBSD 13.0-BETA2 (GENERIC) #2 [678abec02]: Sat Feb 13 10:11:39 GMT 2021
 
PreviousINDEXNext
Mail failure due to Cloudflare DNSSamba share visibility in Windows 10