mirror of
https://github.com/blazblue547-afk/ForgeOS.git
synced 2026-12-02 14:34:17 -05:00
fix(image): wait longer for app layer
Remote hardware can expose FORGE_APPS later than QEMU. Give systemd more time for the app partition and make bind mounts explicitly depend on forge.mount. Also teach forgeos-app to locate Nix through the default profile or store path and print app-layer recovery commands when Nix is unavailable.
This commit is contained in:
1 parent
2e202eae01
commit
23681b9f48
4 files changed
+94
-30
No files matched your search
@@ -59,6 +59,21 @@ The wrapper uses Nix profiles underneath, so direct Nix commands still work:
|
|||||||
nix profile install nixpkgs#hello
|
nix profile install nixpkgs#hello
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If `forgeos-app` says `nix is unavailable`, check whether the app layer mounted:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
forgeos-app status
|
||||||
|
lsblk -f
|
||||||
|
```
|
||||||
|
|
||||||
|
On an installed system with a `FORGE_APPS` partition, recover the current boot as root:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mount LABEL=FORGE_APPS /forge
|
||||||
|
mount -a
|
||||||
|
systemctl restart forgeos-nix-bootstrap.service nix-daemon.socket nix-daemon.service
|
||||||
|
```
|
||||||
|
|
||||||
To build a UEFI disk image:
|
To build a UEFI disk image:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -87,6 +87,23 @@ Enroll `out/secure-boot/ForgeOS.cer` in the target firmware Secure Boot database
|
|||||||
- Avoid leaving multiple ForgeOS installations attached during early testing, because multiple disks with the same GPT partition label can confuse root selection.
|
- Avoid leaving multiple ForgeOS installations attached during early testing, because multiple disks with the same GPT partition label can confuse root selection.
|
||||||
- Secure Boot trust is tied to the enrolled signing certificate. Protect the generated private key.
|
- Secure Boot trust is tied to the enrolled signing certificate. Protect the generated private key.
|
||||||
|
|
||||||
|
## App Layer Recovery
|
||||||
|
|
||||||
|
If an installed machine reports `nix is unavailable; is the ForgeOS app layer mounted?`, confirm the app partition exists and is mounted:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
forgeos-app status
|
||||||
|
lsblk -f
|
||||||
|
```
|
||||||
|
|
||||||
|
If `FORGE_APPS` exists but `/forge` or `/nix` is not mounted, recover the current boot as root:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mount LABEL=FORGE_APPS /forge
|
||||||
|
mount -a
|
||||||
|
systemctl restart forgeos-nix-bootstrap.service nix-daemon.socket nix-daemon.service
|
||||||
|
```
|
||||||
|
|
||||||
## Current Limitation
|
## Current Limitation
|
||||||
|
|
||||||
This is a host-side installer, not an in-OS guided installer yet. There is no partitioning UI, user setup wizard, or live environment workflow in this version.
|
This is a host-side installer, not an in-OS guided installer yet. There is no partitioning UI, user setup wizard, or live environment workflow in this version.
|
||||||
@@ -22,13 +22,6 @@ Short names are expanded to nixpkgs#NAME for install and shell.
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
need_nix() {
|
|
||||||
command -v nix >/dev/null 2>&1 || {
|
|
||||||
echo "nix is unavailable; is the ForgeOS app layer mounted?" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
as_installable() {
|
as_installable() {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
*#*|/*|git+*|http://*|https://*)
|
*#*|/*|git+*|http://*|https://*)
|
||||||
@@ -54,6 +47,51 @@ show_mount() {
|
|||||||
' /proc/mounts
|
' /proc/mounts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
find_nix() {
|
||||||
|
if command -v nix >/dev/null 2>&1; then
|
||||||
|
command -v nix
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -x /nix/var/nix/profiles/default/bin/nix ]; then
|
||||||
|
printf '%s\n' /nix/var/nix/profiles/default/bin/nix
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
for candidate in /nix/store/*-nix-*/bin/nix; do
|
||||||
|
[ -x "$candidate" ] || continue
|
||||||
|
printf '%s\n' "$candidate"
|
||||||
|
return 0
|
||||||
|
done
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
diagnose_missing_nix() {
|
||||||
|
echo "nix is unavailable; is the ForgeOS app layer mounted?" >&2
|
||||||
|
show_mount /forge >&2
|
||||||
|
show_mount /nix >&2
|
||||||
|
echo "check: lsblk -f" >&2
|
||||||
|
echo "check: systemctl status forge.mount forgeos-nix-bootstrap.service nix-daemon.service nix-daemon.socket" >&2
|
||||||
|
echo "repair as root: mount LABEL=FORGE_APPS /forge && mount -a && systemctl restart forgeos-nix-bootstrap.service nix-daemon.socket nix-daemon.service" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
need_nix() {
|
||||||
|
if NIX_BIN=$(find_nix); then
|
||||||
|
export NIX_BIN
|
||||||
|
export NIX_REMOTE=${NIX_REMOTE:-daemon}
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
diagnose_missing_nix
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
run_nix() {
|
||||||
|
need_nix
|
||||||
|
"$NIX_BIN" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
cmd=${1:-}
|
cmd=${1:-}
|
||||||
if [ -z "$cmd" ]; then
|
if [ -z "$cmd" ]; then
|
||||||
usage
|
usage
|
||||||
@@ -78,9 +116,8 @@ case "$cmd" in
|
|||||||
usage >&2
|
usage >&2
|
||||||
exit 2
|
exit 2
|
||||||
}
|
}
|
||||||
need_nix
|
|
||||||
for item in "$@"; do
|
for item in "$@"; do
|
||||||
nix profile install "$(as_installable "$item")"
|
run_nix profile install "$(as_installable "$item")"
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
remove)
|
remove)
|
||||||
@@ -88,32 +125,27 @@ case "$cmd" in
|
|||||||
usage >&2
|
usage >&2
|
||||||
exit 2
|
exit 2
|
||||||
}
|
}
|
||||||
need_nix
|
run_nix profile remove "$@"
|
||||||
nix profile remove "$@"
|
|
||||||
;;
|
;;
|
||||||
list)
|
list)
|
||||||
need_nix
|
run_nix profile list
|
||||||
nix profile list
|
|
||||||
;;
|
;;
|
||||||
search)
|
search)
|
||||||
[ "$#" -gt 0 ] || {
|
[ "$#" -gt 0 ] || {
|
||||||
usage >&2
|
usage >&2
|
||||||
exit 2
|
exit 2
|
||||||
}
|
}
|
||||||
need_nix
|
run_nix search nixpkgs "$@"
|
||||||
nix search nixpkgs "$@"
|
|
||||||
;;
|
;;
|
||||||
upgrade)
|
upgrade)
|
||||||
need_nix
|
|
||||||
if [ "$#" -eq 0 ]; then
|
if [ "$#" -eq 0 ]; then
|
||||||
nix profile upgrade '.*'
|
run_nix profile upgrade '.*'
|
||||||
else
|
else
|
||||||
nix profile upgrade "$@"
|
run_nix profile upgrade "$@"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
rollback)
|
rollback)
|
||||||
need_nix
|
run_nix profile rollback
|
||||||
nix profile rollback
|
|
||||||
;;
|
;;
|
||||||
shell)
|
shell)
|
||||||
[ "$#" -gt 0 ] || {
|
[ "$#" -gt 0 ] || {
|
||||||
@@ -126,12 +158,12 @@ case "$cmd" in
|
|||||||
for item in "$@"; do
|
for item in "$@"; do
|
||||||
expanded="${expanded}${expanded:+ }$(as_installable "$item")"
|
expanded="${expanded}${expanded:+ }$(as_installable "$item")"
|
||||||
done
|
done
|
||||||
|
need_nix
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
exec nix shell $expanded
|
exec "$NIX_BIN" shell $expanded
|
||||||
;;
|
;;
|
||||||
gc)
|
gc)
|
||||||
need_nix
|
run_nix store gc
|
||||||
nix store gc
|
|
||||||
;;
|
;;
|
||||||
help|--help|-h)
|
help|--help|-h)
|
||||||
usage
|
usage
|
||||||
|
|||||||
@@ -129,13 +129,13 @@ write_atomic_fstab() {
|
|||||||
cat > "$BASE_ROOTFS_STAGING_DIR/etc/fstab" <<EOF
|
cat > "$BASE_ROOTFS_STAGING_DIR/etc/fstab" <<EOF
|
||||||
# ForgeOS keeps the base OS read-only in disk images and mounts mutable
|
# ForgeOS keeps the base OS read-only in disk images and mounts mutable
|
||||||
# applications and state from the app layer.
|
# applications and state from the app layer.
|
||||||
LABEL=$APP_LABEL /forge ext4 rw,relatime,nofail,x-systemd.device-timeout=5s 0 2
|
LABEL=$APP_LABEL /forge ext4 rw,relatime,nofail,x-systemd.device-timeout=60s 0 2
|
||||||
/forge/nix /nix none bind,nofail,x-systemd.after=forge.mount 0 0
|
/forge/nix /nix none bind,nofail,x-systemd.requires=forge.mount,x-systemd.after=forge.mount 0 0
|
||||||
/forge/home /home none bind,nofail,x-systemd.after=forge.mount 0 0
|
/forge/home /home none bind,nofail,x-systemd.requires=forge.mount,x-systemd.after=forge.mount 0 0
|
||||||
/forge/root /root none bind,nofail,x-systemd.after=forge.mount 0 0
|
/forge/root /root none bind,nofail,x-systemd.requires=forge.mount,x-systemd.after=forge.mount 0 0
|
||||||
/forge/var /var none bind,nofail,x-systemd.after=forge.mount 0 0
|
/forge/var /var none bind,nofail,x-systemd.requires=forge.mount,x-systemd.after=forge.mount 0 0
|
||||||
/forge/opt /opt none bind,nofail,x-systemd.after=forge.mount 0 0
|
/forge/opt /opt none bind,nofail,x-systemd.requires=forge.mount,x-systemd.after=forge.mount 0 0
|
||||||
/forge/usr-local /usr/local none bind,nofail,x-systemd.after=forge.mount 0 0
|
/forge/usr-local /usr/local none bind,nofail,x-systemd.requires=forge.mount,x-systemd.after=forge.mount 0 0
|
||||||
tmpfs /tmp tmpfs rw,nosuid,nodev,mode=1777 0 0
|
tmpfs /tmp tmpfs rw,nosuid,nodev,mode=1777 0 0
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user