Installation
- 7 minutes read - 1300 wordsI’ve also added notes for trying to help the FreeBSD Laptop project’s goals of
making FreeBSD more laptop friendly. I’ve added my asides to that body here
with the prefix TOIMPROVE
. Most folks can safely ignore these comments.
1. Create the USB installation medium (USB key)
I’ll skip the creation of the install medium / how to boot from it. It’s well covered elsewhere.
2. Nuke the hard disk
We’re going all-in on this laptop. There’s no dual-boot going on here (for
~$100, that’s a reasonable risk/reward). Also, one of the major features of
FreeBSD is zfs
and that requires the whole hard disk. So, let’s get the disk to
a known empty state.
What’s so great about zfs
? It’s a file system that provides snapshots, data
integrity checks, and easy management. It can shrink and grow and backup
flexibly. It’ll help you “Just Focus” 😄
☢️ You’re about to destroy data on the hard disk! If this is your mom’s laptop or a laptop full of precious family memories, please do not do something you will regret! ☢️
Start from a known-good state by completely nuking the hard drive. Boot from
installation medium into “single user” mode. Find the name of the drives by
running lsdev
. Nuke the internal hard drive. Mine was ada0
:
dd if=/dev/zero of=/dev/ada0 bs=4M
dd
dumps data at the hardware level/dev/zero
a Unix feature that produces 0s/dev/ada0
is the name of my hard drive as a raw hardware device- bs=4m means buffer into 4 megabyte block sizes. My disk is something like 128 GB, so this will help alllll those zeroes get written. This took about 9 minutes.
3. Reboot from USB medium
Activate the installer. System console messages, in my case, obscured the menu. Type I for install.
4. Select keyboard keymap
Experience a joy of FreeBSD, select your keyboard and one of them is the US with Caps Lock as control! That this is a default option is glorious indeed.
This configuration recalls Sun/Solaris configuration keyboards that I cut my teeth on that had control as Caps Lock. Glorious.
The keymap to use is: “United States of America (Caps Lock acts as Left Ctrl).”
Scroll to it, strike enter. Then “Continue with us.ctrl.kbd keymap
”
5. Create a hostname
I chose “freebsd”
6. Pick Packages to Install
Here’s where you get to a really uncoached section. See the guide here. Here were my choices/rationale:
👀 TOIMPROVE: I think FreeBSD team would do themselves a lot of favors by having some online documentation to help people think through these choices.
base-dbg
- No, because I don’t want to debug these tools. I assume they’re good and maintained elsewhere. It’s not been useful to me (yet).kernel-dbg
- Yes. While I was surprised to get into kernel hacking, it was cool to have this informationlib32-dbg
- No. Same logic asbase-dbg
lib32
- Yes. Was on by default. Excluding seemed likely to hurt- ports - No. I might not ever use one of these. And if I did, I could make that decision later
src
- ⚠️ No ⚠️ . If I want to make a change to the kernel, most changes will assume you’re working from an active release branch. The installation medium will likely have an earlier version of code. So, for me, I’d rather just install this over the network viagit
so that I could (theoretically) make contributions. Nota Bene, this is the source code for both the kernel and the userland.tests
- No. Same as above
So that means “I accepted the defaults.”
7. Partition Disks
How would you like to partition the disk?
OK this is the scary one. One of the big charms I mentioned was snapshots, and
those come with ZFS. So we’re going to pick “Auto ZFS”. I accepted the default
options (in particular the “Pool Name” of zroot
will be important). Arrow
key to “Install.”
👀 TOIMPROVE: I think FreeBSD team would do themselves a lot of favors by having some online documentation to pitch why ZFS is pretty great. ZFS really shines when you have multiple physical disks acting like one disk from the operating system’s perspective. But for laptops, this default assumption makes making a decision here scary. It shouldn’t be.
Next menu, accept “stripe.” The other options are relevant if you’re doing a server installation. Pick OK.
Specify the target disk. This laptop has only one and it’s identified (and pay
attention here) as ada0
. Select (with space) and proceed.
👀 TOIMPROVE: Use of space as select is not documented. Very foreign to those not used to
curses
-based (console-based graphics) user interfaces.
Accept the “last chance” warning. Let the installer run. This configuration took about a minute to install.
8. Pick a root password
9. Activate your WiFi interface; Do not change regdomain/country
👀 TOIMPROVE: Why is this surfaced? I have no idea what this is or why I would need it. Surely some online documentation could help here.
10. Choose your WiFi network / authenticate
After authentication, I chose the IPv4 interface choice. I did not choose IPv6. I don’t know how to use that and I’m not sure why it’s useful for a laptop (yet). I can probably fix this later. Also accept DHCP (my home wifi will give this machine an address; this is what most people expect). DHCP means that the OS will ask the local WiFi router for an IP address so that the router that you pay your ISP money for can get data back to your laptop.
👀 TOIMPROVE: FreeBSD, why is this decision complexity surfaced to the end user? Seems unnecessary.
11. Network Configuration / Resolver Configuration
👀 TOIMPROVE: Again, why are we surfacing this to laptop users?
I added Google’s DNS at 8.8.8.8
as DNS #2.
12. Time setting
I set No because the menu told me to if I wasn’t sure whether the CMOS was set to UTC. I wasn’t. Traversed windows to set my time as Eastern and set the date.
13. System Configuration
The guide is really key here.
Enable:
- sshd: Secure Shell server - allows remote login to your system. Was enabled by default; I kept it on.
- ntpd: Network Time Protocol daemon - synchronizes your system clock with internet time servers. I added this.
- powerd: Power management daemon - adjusts CPU frequency to save battery. Essential for laptops, so I added this.
- dumpdev: System crash dumps - helps with debugging if something goes wrong. Was enabled by default; I kept it on.
👀 TOIMPROVE: Handbook mentions
ntp
as an option. It’s not in the menu.
14. System Hardening.
The guide is really key here.
None of these are enabled by default. Here’s what I enabled
- Enable
clear_tmp
: I love using/tmp
as a scratch space that gets automagically cleaned up. For some this is a dangerous thing. I’m used to it. YMMV
15. Add an Unprivileged User
Do it. My changes:
- I added this user to
wheel
for super powers later on - Use
/bin/sh
. In my Solaris days, I usedtcsh
, butsh
has gotten better over the years and feels more likebash
, which most Unix folks will be familiar with. Remember, since we’re in BSD land andbash
is a GNU thing, FreeBSD won’t installbash
by default. It turns outsh
is good enough (for me). If you want a GNU shell, that’s up to your preference. Popular shells in BSD are Bourne (sh
) or Korn (ksh
).zsh
is largely MIT
👀 TOIMPROVE When asked about adding to additional groups, it’s phrased as a boolean Yes or No, when what’s really being asked for is an array of string. Granted the
[]
suggests that, but it’s really unclear.
16. Exit the Installer
Hit exit; remove the media; boot into your new system.