2026-04-03 10:06:44 +00:00
|
|
|
|
# Clawdie Shell (bundles Clawdie-AI v1.0.2) — ISO Builder
|
2026-03-24 00:51:22 +00:00
|
|
|
|
|
|
|
|
|
|
Building a bootable Clawdie Shell installer ISO with offline package support.
|
|
|
|
|
|
|
|
|
|
|
|
## Prerequisites
|
|
|
|
|
|
|
|
|
|
|
|
**On your build host (FreeBSD 15.0+):**
|
|
|
|
|
|
```bash
|
|
|
|
|
|
pkg install curl
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**USB Key Requirements:**
|
|
|
|
|
|
| USB Size | Recommended | Spare Space | Notes |
|
|
|
|
|
|
|----------|-------------|-------------|-------|
|
|
|
|
|
|
| 64GB | Minimum | ~14GB | Default build.cfg (50GB image) |
|
|
|
|
|
|
| 128GB | **Recommended** | ~28GB | Comfortable for offline setup |
|
|
|
|
|
|
| 256GB | Extra | ~56GB | Future expansion room |
|
|
|
|
|
|
|
|
|
|
|
|
⚠️ Do **not** use USB keys smaller than 64GB
|
|
|
|
|
|
|
|
|
|
|
|
## Quick Start
|
|
|
|
|
|
|
|
|
|
|
|
### Step 1: Fetch packages (no root needed)
|
|
|
|
|
|
```bash
|
|
|
|
|
|
./build.sh --fetch-only
|
|
|
|
|
|
```
|
|
|
|
|
|
This downloads:
|
|
|
|
|
|
- FreeBSD 15.0-RELEASE memstick
|
|
|
|
|
|
- All packages (host + jails + desktop + GPU)
|
2026-04-03 10:06:44 +00:00
|
|
|
|
- Clawdie-AI v1.0.2 tarball
|
2026-03-24 00:51:22 +00:00
|
|
|
|
|
|
|
|
|
|
Takes ~30 min on fast connection. Can be interrupted/resumed.
|
|
|
|
|
|
|
|
|
|
|
|
### Step 2: Build ISO (requires root)
|
|
|
|
|
|
```bash
|
|
|
|
|
|
sudo ./build.sh --skip-fetch
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Creates 50GB image with:
|
|
|
|
|
|
- FreeBSD base system
|
|
|
|
|
|
- Offline package repository (pre-cached for jail provisioning)
|
|
|
|
|
|
- Clawdie-AI tarball + firstboot modules
|
|
|
|
|
|
- Installer config
|
|
|
|
|
|
|
2026-04-05 14:19:32 +00:00
|
|
|
|
Output: `tmp/output/clawdie-iso-24.mar.2026.img` (or current date)
|
2026-03-24 00:51:22 +00:00
|
|
|
|
|
|
|
|
|
|
### Step 3: Write to USB
|
|
|
|
|
|
```bash
|
|
|
|
|
|
# Identify USB device: da0, da1, etc (NOT da0s1 or da0a)
|
2026-04-05 14:19:32 +00:00
|
|
|
|
sudo dd if=tmp/output/clawdie-iso-24.mar.2026.img of=/dev/daX bs=1M status=progress
|
2026-03-24 00:51:22 +00:00
|
|
|
|
sudo sync
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Build Configuration
|
|
|
|
|
|
|
|
|
|
|
|
Edit `build.cfg` to customize:
|
|
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
|
FREEBSD_VERSION="15.0-RELEASE" # Kernel/base version
|
|
|
|
|
|
FREEBSD_ARCH="amd64" # x86-64 (arm64 not yet supported)
|
|
|
|
|
|
IMAGE_SIZE="50G" # For 64GB USB; set to 100G for 128GB USB
|
|
|
|
|
|
CLAWDIE_VERSION="0.8.2" # Pin Clawdie-AI version
|
2026-03-26 08:59:38 +00:00
|
|
|
|
DEFAULT_DESKTOP="lumina" # Desktop environment (Lumina only)
|
2026-03-24 00:51:22 +00:00
|
|
|
|
DEFAULT_PKG_BRANCH="latest" # Package branch (latest or quarterly)
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Advanced Options
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
# Fetch only (for CI pre-download step, no root)
|
|
|
|
|
|
./build.sh --fetch-only
|
|
|
|
|
|
|
|
|
|
|
|
# Build from cached packages (no download)
|
|
|
|
|
|
./build.sh --skip-fetch
|
|
|
|
|
|
|
|
|
|
|
|
# Override Clawdie version
|
2026-04-03 10:06:44 +00:00
|
|
|
|
./build.sh --clawdie-version 1.0.2
|
2026-03-24 00:51:22 +00:00
|
|
|
|
|
|
|
|
|
|
# Combine flags
|
|
|
|
|
|
./build.sh --fetch-only
|
|
|
|
|
|
# ... later, on another system ...
|
2026-04-03 10:06:44 +00:00
|
|
|
|
./build.sh --skip-fetch --clawdie-version 1.0.2
|
2026-03-24 00:51:22 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Build Process (7 steps)
|
|
|
|
|
|
|
|
|
|
|
|
1. **Fetch FreeBSD memstick** — Downloads base OS image
|
|
|
|
|
|
2. **Fetch packages** — Fetches all .pkg files + dependencies
|
|
|
|
|
|
3. **Generate repo metadata** — Creates offline pkg repository index
|
|
|
|
|
|
4. **Fetch Clawdie-AI** — Downloads tarball from Codeberg
|
|
|
|
|
|
5. **Prepare 25GB image** — Creates working image with proper partitioning
|
|
|
|
|
|
- Allocates 50GB disk space
|
|
|
|
|
|
- Creates MBR partition table + BSD label
|
|
|
|
|
|
- Creates UFS filesystem
|
|
|
|
|
|
- Mounts and extracts FreeBSD base
|
|
|
|
|
|
6. **Inject payload** — Copies packages, scripts, Clawdie-AI to image
|
|
|
|
|
|
7. **Write output** — Copies working image to final .img file
|
|
|
|
|
|
|
|
|
|
|
|
Each step idempotent — can resume if interrupted.
|
|
|
|
|
|
|
|
|
|
|
|
## First Boot Flow
|
|
|
|
|
|
|
|
|
|
|
|
When you boot a machine from the USB:
|
|
|
|
|
|
|
|
|
|
|
|
1. **bsdinstall** runs FreeBSD installer (standard workflow)
|
|
|
|
|
|
2. **installerconfig hook** (post-install) injects firstboot payload to HDD
|
|
|
|
|
|
3. **clawdie-firstboot service** runs on first HDD boot
|
|
|
|
|
|
4. **firstboot.sh** wizard guides user through:
|
|
|
|
|
|
- Identity setup (name, domain, timezone)
|
|
|
|
|
|
- Package repo config (online + offline USB)
|
|
|
|
|
|
- GPU detection + driver selection
|
|
|
|
|
|
- System config (hostname, services)
|
|
|
|
|
|
- Clawdie-AI deployment + jail setup
|
|
|
|
|
|
|
|
|
|
|
|
See `firstboot/MODULE-MANIFEST.md` for wizard architecture.
|
|
|
|
|
|
|
2026-03-26 14:03:08 +00:00
|
|
|
|
## Testing the Built ISO
|
|
|
|
|
|
|
|
|
|
|
|
Before writing to USB, test the ISO in a virtual machine:
|
|
|
|
|
|
|
|
|
|
|
|
### Module Integration Test (5 min, no root)
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
# Quick validation: all 5 shell modules execute with state handoff
|
|
|
|
|
|
sh firstboot/integration-test.sh
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Expected result: "Integration test passed: All 6 modules executed with state handoff"
|
|
|
|
|
|
|
|
|
|
|
|
### Full Bhyve Boot Test (20–25 min, interactive)
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
# Boot the ISO in bhyve VM (includes bsdinstall + firstboot)
|
2026-03-30 12:43:55 +00:00
|
|
|
|
cd /home/clawdie/clawdie-iso
|
2026-04-04 09:49:01 +00:00
|
|
|
|
# Optional: allow guest internet (writes /etc/pf.bhyve.conf and reloads PF)
|
|
|
|
|
|
sudo ./scripts/bhyve-pf-allow.sh
|
feat(firstboot): resume/reset flags, checkpoint guards + move bhyve scripts
firstboot.sh:
- Set SHELL_{GPU,NVIDIA,PKG,ENV,DEPLOY}_TEST=1 before sourcing modules
(prevents double-execution on source — same bug fixed in integration-test)
- Add --resume: run_step() skips steps already recorded in progress file
- Add --reset: clears progress file, starts over from scratch
- Add --help
- Wizard tracked as checkpoint so --resume skips re-prompting the user
- run_step() helper: guard → run → mark done in one call
scripts/bhyve-test.sh (was tmp/bhyve-test-setup.sh):
- Moved to tracked scripts/ directory (tmp/ is gitignored)
- Timeout 300→1800s (full install is 20–25 min, not 5)
scripts/run-bhyve-test.sh (was tmp/run-bhyve-test.sh):
- Moved to scripts/, log output redirected to logs/ (also gitignored)
BUILD.md, TESTING.md, IMPLEMENTATION-PLAN.md:
- Update all bhyve script references to scripts/bhyve-test.sh
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 13:00:24 +00:00
|
|
|
|
sudo ./scripts/bhyve-test.sh
|
2026-03-26 14:03:08 +00:00
|
|
|
|
|
|
|
|
|
|
# Follow installer prompts
|
|
|
|
|
|
# Then verify: GPU detection, package repos, Clawdie deployment
|
|
|
|
|
|
# Login to Lumina desktop when ready
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**See [TESTING.md](TESTING.md) for detailed test procedures and troubleshooting.**
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2026-03-24 00:51:22 +00:00
|
|
|
|
## Troubleshooting
|
|
|
|
|
|
|
|
|
|
|
|
**"Insufficient space on /mnt"**
|
|
|
|
|
|
- Your USB key is too small (< 64GB)
|
|
|
|
|
|
- Use `lsblk` on Linux or `gpart list` on FreeBSD to verify
|
|
|
|
|
|
|
|
|
|
|
|
**"pkg: error: Cannot access the database"**
|
|
|
|
|
|
- Offline package repo may be corrupted
|
2026-04-05 14:19:32 +00:00
|
|
|
|
- Re-run with `--skip-fetch` and clean old `tmp/packages/All`
|
2026-03-24 00:51:22 +00:00
|
|
|
|
|
|
|
|
|
|
**"Cannot attach mdconfig"**
|
|
|
|
|
|
- Verify you're running as root
|
2026-04-05 14:19:32 +00:00
|
|
|
|
- Check available disk space: `df -h ./tmp`
|
2026-03-24 00:51:22 +00:00
|
|
|
|
- Increase `IMAGE_SIZE` if building on same disk as packages
|
|
|
|
|
|
|
|
|
|
|
|
**SSH key auth failing in firstboot**
|
|
|
|
|
|
- Verify SSH key in `/home/clawdie/.ssh/codeberg-clawdie`
|
|
|
|
|
|
- Check Codeberg account has SSH key registered
|
|
|
|
|
|
|
|
|
|
|
|
## Build Environment Notes
|
|
|
|
|
|
|
|
|
|
|
|
- Tested on FreeBSD 15.0-RELEASE-p4 (amd64)
|
|
|
|
|
|
- Requires root for steps 5-7 (mdconfig, gpart, newfs, mount)
|
|
|
|
|
|
- Steps 1-4 can run as unprivileged user
|
2026-04-05 14:19:32 +00:00
|
|
|
|
- Build requires ~150GB free disk space under `tmp/` (for image + packages + cache)
|
2026-03-24 00:51:22 +00:00
|
|
|
|
|
|
|
|
|
|
## Size Breakdown (50GB image)
|
|
|
|
|
|
|
|
|
|
|
|
| Component | Size |
|
|
|
|
|
|
|-----------|------|
|
|
|
|
|
|
| FreeBSD base | ~2.5GB |
|
|
|
|
|
|
| Packages offline repo | ~8GB |
|
|
|
|
|
|
| Clawdie-AI tarball | ~400MB |
|
|
|
|
|
|
| firstboot scripts | ~1MB |
|
|
|
|
|
|
| **Free space** | **~39GB** |
|
|
|
|
|
|
| **Total image** | **50GB** |
|
|
|
|
|
|
|
|
|
|
|
|
Free space is reserved for:
|
|
|
|
|
|
- Package cache seeding during jail setup
|
|
|
|
|
|
- User data and logs
|
|
|
|
|
|
- Future offline updates
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
**Next:** See `firstboot/MODULE-MANIFEST.md` for Phase 2.1 (wizard implementation) and `AGENTS.md` for operator instructions.
|