- Use a
memstick.img
file to write a FreeBSD installer to a memory stick - boot from the stick in single user mode
/bin/csh
- use gpart(8) to resize things
growfs /
mount -uw /
- assuming vt(4)
setenv TERM xterm-clear
bsdconfig vt_keymap
- select, and continue with, a keymap that matches your keyboard layout
reboot -r
- live system
- login as root, no password
mount -uw /
bsdconfig networking
- get an Internet connection – for example, enable DHCP for a network interface
- assuming root-on-ZFS
zpool import
- note the name of the pool that you want to import – for example, damp
zpool import -R /tmp/altroot damp
zpool get bootfs damp
- note the value – for example, damp/ROOT/test
zfs mount damp/ROOT/test
pkg bootstrap
- add a minimal FreeBSD-base repository configuration to
/etc/pkg/FreeBSD.conf
– urlhttps://pkg.freebsd.org/FreeBSD:14:amd64/base_release_3
pkg --rootdir /tmp/altroot install --repository FreeBSD-base FreeBSD-certctl FreeBSD-pkg-bootstrap FreeBSD-utilities
chroot /tmp/altroot
cd /root
fetch https://tinyurl.com/pkgbasify-foundation -o ./pkgbasify.lua
chmod +x ./pkgbasify.lua
mkdir -p /var/db/etcupdate/current
./pkgbasify.lua
Last active
September 14, 2025 14:34
-
-
Save grahamperrin/9570092c127bd43777961b6f016e75ba to your computer and use it in GitHub Desktop.
Using pkgbasify to repair a broken installation of FreeBSD 14.3-RELEASE
bsdinstall keymap
Alternatively, whilst in single user mode, for me:
sysrc keymap="uk.kbd"
- works for live system but not for shell
- non-documented
bsdinstall startbsdinstall
apparently returns from the live system, to the FreeBSD installer welcome dialogue, however:
fetch
…-o ./pkgbasify.lua
chmod +x ./pkgbasify.lua
For simplicity, expect pkgbasify to be packaged:
Repairing an installation of 15.0
Simpler. The FreeBSD-base repo is preconfigured, and pkg is already bootstrapped.
Instead of FreeBSD-certctl
, install FreeBSD-caroot
.
Tested: FreeBSD-15.0-PRERELEASE-amd64-20250822-027be99b1f33-279771-memstick.img
Backlinks:
- https://mail-archive.freebsd.org/cgi/mid.cgi?18e1a7e9-07d8-43a2-96af-0acdab6c2920 | https://lists.freebsd.org/archives/freebsd-pkgbase/2025-August/000763.html
- https://www.reddit.com/user/grahamperrin/comments/1msyzfe/using_pkgbasify_to_repair_a_broken_installation/
- https://mastodon.bsd.cafe/@grahamperrin/115041689025019258
- https://www.reddit.com/r/freebsd/comments/1mzlfq0/comment/napu18b/?context=1
- https://www.mail-archive.com/[email protected]/index.html#192714 | https://mail-archive.freebsd.org/cgi/mid.cgi?babf662e-cded-4a2c-b5e8-c5a7175739f2 | https://lists.freebsd.org/archives/freebsd-current/2025-September/008672.html
- https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=289414#c2
- https://www.reddit.com/r/freebsd/comments/1ngrjc8/comment/ne67eaz/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Origin:
Notes:
pkgbasify.lua
is not official/var/db/etcupdate
features in FreeBSD bug 288295 – bsdinstall does not bootstrap etcupdate database for pkgbase installationsFreeBSD-pkg-bootstrap
package.Tested with:
FreeBSD-14.3-STABLE-amd64-20250814-7b9f6ebb9268-272178-mini-memstick.img
from https://download.freebsd.org/snapshots/ISO-IMAGES/14.3/Special thanks to: