blogng/blog/2019-01-29-tracking-freebsd-current.markdown

88 lines
3.0 KiB
Markdown
Raw Permalink Normal View History

2019-02-14 15:50:27 +00:00
---
layout: post
title: "Running FreeBSD current"
date: 2019-01-29
comments: true
tags: freebsd, x230, infra
---
I have been a FreeBSD user for quite sometime now. I run it on my
[servers](/blog/2019/01/20/experiments-in-owning-data/index.html), and on my
personal laptop, a Thinkpad x230.
One of the main reasons I started experimenting with FreeBSD was to get more
familiar with internals of a modern UNIX. What better way to learn than to poke
around source? That's how I ended up building FreeBSD.
__CURRENT__ is the FreeBSD terminology for _"bleeding edge"_ development
version, [the subversion
branch](https://www.freebsd.org/doc/handbook/current-stable.html) where
development happens. All new changes are developed against this branch, so this
was the target/version that I wanted to build and run.
## The good - Streamlined build
The code structure of FreeBSD was a big help in doing this, all base components
that one would need on a minimal UNIX installation is in [a single
repo](https://svnweb.freebsd.org/base/head/). The components in this repo is
enough to boot a computer and start writing (C/C++) code on it. Which made
[compiling and running the development
head](https://www.freebsd.org/doc/handbook/makeworld.html) a no brainer-less
than 10 commands job. Take that [LFS](http://www.linuxfromscratch.org/lfs/)!
(sorry, couldn't resist).
```
# svn update /usr/src
# cd /usr/src
# make -j4 buildworld
# make -j4 kernel
# shutdown -r now
# cd /usr/src
# make installworld
# mergemaster -Ui
# shutdown -r now
```
## The Bad - Takes too long
However compiling the entire tree is resource intensive, and it takes ~4 hours
to build on my old Thinkpad, CPU usage will be at 100% and the laptop will be
more or less unusable while building. This severely limited the frequency of
updating code on laptop.
### Mailing list to rescue
People at the [FreeBSD-Current mailing
list](https://www.mail-archive.com/freebsd-current@freebsd.org/msg175370.html)
pointed out that I could just reuse the builds from my server. So that's what I
have done, I have yet another hetzner box building FreeBSD-CURRENT periodically
with
2019-08-03 22:16:12 +00:00
```bash
2019-02-14 15:50:27 +00:00
cd /usr/src && svn update .
2019-08-03 22:16:12 +00:00
make -j 4 buildkernel buildworld KERNCONF=GENERIC-LAPTOP | \
tee /var/log/lastbuild.log
2019-02-14 15:50:27 +00:00
```
and I pull it to my laptop with rsync, with roughly following
2019-08-03 22:16:12 +00:00
```bash
2019-02-14 15:50:27 +00:00
cd /usr
rsync -avz builder:/usr/src .
rsync -avz builder:/usr/obj .
cd /usr/src
make -j4 installkernel KERNCONF=GENERIC-LAPTOP
shutdown -r now
make -j4 installworld KERNCONF=GENERIC-LAPTOP
```
## The Ugly - Nothing yet
Sorry to disappoint, I haven't come across any really bad things yet `¯\_(ツ)_/¯`.
There is always risk of really breaking your system with an experimental OS
version. I am yet to run across into that. That will eventually force me to use
[ZFS boot environments](https://mwl.io/archives/2363), I guess.
## That's all folks!
Except for [some minor hiccups](/blog/2019/01/08/recurse-center-day-%23-2/index.html) the experience running CURRENT have been
smooth, I will keep this blog updated if it breaks :-)