Skip to content

Make remote wipe script work on NixOS hostsΒ #56443

Description

@lucasmrod

Fleet versions

Web browser and operating system: N/A (affects NixOS hosts)


πŸ’₯ Actual behavior

Linux remote wipe (ee/server/service/embedded_scripts/linux_wipe.sh) deletes the traditional FHS system directories (/bin, /sbin, /usr, /lib, /opt, /etc, /var, /srv). NixOS doesn't follow FHS: system software and configuration live in /nix/store, which the wipe script never touches. On NixOS hosts, the store is left intact after a wipe. /nix/store is also typically a read-only bind mount, so a plain rm -rf would fail even if it were included.

πŸ› οΈ Expected behavior

On hosts where /nix/store exists, the wipe script also deletes it (last, after the other system directories). If /nix/store is a read-only mount, the script remounts it read-write first, and skips it with an error if the remount fails or can't be confirmed. The Linux wipe section in articles/lock-wipe-hosts.md documents this behavior and its limitations.

πŸ§‘β€πŸ’» Steps to reproduce

These steps:

  • Have been confirmed to consistently lead to reproduction in multiple Fleet instances.
  • Describe the workflow that led to the error, but have not yet been reproduced in multiple Fleet instances.
  1. Enroll a NixOS host in Fleet (Premium).
  2. Wipe the host from the host details page.
  3. Inspect the disk after the host halts: /nix/store contents remain.

Test plan

  • Test wiping a NixOS VM/host.
  • Test wiping a non-NixOS host (e.g. Ubuntu) still works.

πŸ•―οΈ More info (optional)

Fix in progress: #55492.

Activity

  1. added
    bug
    :product
    on Oct 23, 2026
  2. added
    #g-orchestration
    and removed
    bug
    on Oct 23, 2026
  3. changed the title [-]Linux remote wipe doesn't delete the Nix store on NixOS hosts[/-] [+]Make remote wipe script work on NixOS hosts[/+] on Oct 23, 2026
  4. moved this from πŸ“¨ Inbox to βœ”οΈ Awaiting QA in πŸͺ„ #g-orchestrationon Oct 23, 2026
  5. added this to the 4.95.0 milestone on Oct 23, 2026
  6. self-assigned this
    on Oct 23, 2026
  7. added a commit that references this issue on Oct 23, 2026
    8e42b37
  8. added and removed
    :product
    on Nov 6, 2026
  9. xpkoala commented on Nov 9, 2026

    @xpkoala
    Contributor

    QA Fail β€” 2/4 checks on rc-minor-fleet-v4.95.0 (b86f946). Wiped a NixOS 26.05 host and an Ubuntu 24.04 host from Fleet, then booted them again to see what was left.

    # Type Case Result
    1 Core Wipe a NixOS host (/nix/store read-only bind mount) ❌ Host halts and Fleet shows Wiped, but nothing was deleted: after a power cycle it boots normally with /home, /etc and /nix/store intact and comes back Online
    2 Core /nix/store remount + delete ❌ awk: command not found β†’ "could not inspect /nix/store mount options; skipping Nix store deletion"
    3 Regression Wipe an Ubuntu 24.04 host βœ… halts, doesn't come back after a power cycle
    4 Halo Linux wipe section in lock-wipe-hosts.md βœ… matches the script's order and branches

    On NixOS the detached fleet-wipe.service (systemd-run) gets the systemd manager's PATH, which has no coreutils or awk. Every rm fails silently (safe_rm sends errors to /dev/null), and the sysrq halt still runs. The new prepare_nix_store works when the unit gets the login PATH (systemd-run --setenv=PATH=$PATH … remounts /nix/store rw and returns 0). This also means NixOS wipes have deleted nothing since NixOS support shipped in 4.94.0.

    04:35:35 systemd[1]: Started [systemd-run] /bin/sh /run/fleet_wipe.sh wipe.
    04:35:35 sh: /run/fleet_wipe.sh: line 253: sleep: command not found
    04:35:35 sh: Wiping /home/qa
    04:35:35 sh: Wiping /etc
    04:35:35 sh: /run/fleet_wipe.sh: line 195: awk: command not found
    04:35:35 sh: Error: could not inspect /nix/store mount options; skipping Nix store deletion
    04:35:35 sh: /run/fleet_wipe.sh: line 247: /sync_bin: No such file or directory
    
  10. moved this from βœ”οΈ Awaiting QA to 🐣 In progress in πŸͺ„ #g-orchestrationon Nov 9, 2026
  11. moved this from 🐣 In progress to πŸ₯š Ready in πŸͺ„ #g-orchestrationon Nov 9, 2026
  12. moved this from πŸ₯š Ready to πŸ₯ Ready for review in πŸͺ„ #g-orchestrationon Nov 9, 2026
  13. added a commit that references this issue on Nov 11, 2026
    4c1b4df
  14. moved this from πŸ₯ Ready for review to βœ”οΈ Awaiting QA in πŸͺ„ #g-orchestrationon Nov 11, 2026
  15. xpkoala commented on Nov 11, 2026

    @xpkoala
    Contributor

    QA Pass with 1 finding: 5/6 checks on PR #58165 (head 3e0b079), on a scratch Fleet server built from the PR. The wipe now deletes everything on a real NixOS 26.05 host, including /nix/store. One new problem: the wiped host shows as Unlocked in Fleet instead of Wiped. Before the fix (same server, linux_wipe.sh from main), the NixOS wipe still deleted nothing and the host booted again.

    # Type Case Result
    1 Core Wipe a NixOS host (/nix/store read-only bind mount) βœ… /home, /etc, /bin, /usr and /var deleted; /nix/store remounted rw and deleted last, then the host halts
    2 Core Power-cycle the wiped NixOS host βœ… doesn't boot (no network, no guest agent), offline in Fleet
    3 Core Fleet status after the NixOS wipe ❌ host shows Unlocked, no Wiped badge, and Wipe can be sent again
    4 Halo Network/shared mount on the NixOS host (9p) βœ… unmounted, not deleted (awk is found now, so the network-mount check works)
    5 Regression Wipe an Ubuntu 24.04 host βœ… Fleet shows Wiped, host halts and doesn't come back
    6 Halo Wipe with awk/rm missing βž– not run on a real host (covered by the PR's container test)

    Row 3: once the wipe deletes /var/lib/orbit, orbit (still running from memory) loses its node key. It re-enrolls, because on NixOS the enroll secret comes from /run/credentials, a tmpfs the wipe doesn't touch. Orbit enroll clears host_mdm_actions (server/datastore/mysql/hosts.go), so the wipe record is gone. Before this fix nothing was deleted, so this couldn't happen.

    06:13:59 systemd[1]: Started [systemd-run] /bin/sh /run/fleet_wipe.sh wipe.
    06:14:09 Unmounting network filesystem: /mnt/installers
    06:14:09 Wiping /home/qa
    06:14:10 rm --one-file-system -rf /nix/store      (/nix/store mount: rw; 11532 β†’ 5 entries by 06:14:59)
    06:14:29 POST /api/fleet/orbit/enroll hostname=nix26-arm   (again 06:14:39, 06:14:59)
    06:15:00 host halted
    

    The finding is a small edge case that will be addressed later.

  16. moved this from βœ”οΈ Awaiting QA to βœ… Ready for release in πŸͺ„ #g-orchestrationon Nov 11, 2026
  17. xpkoala commented on Nov 11, 2026

    @xpkoala
    Contributor

    QA Pass with 1 finding: 5/6 checks on PR #58165 (head 3e0b079), on a scratch Fleet server built from the PR. The wipe now deletes everything on a real NixOS 26.05 host, including /nix/store. One new problem: the wiped host shows as Unlocked in Fleet instead of Wiped. Before the fix (same server, linux_wipe.sh from main), the NixOS wipe still deleted nothing and the host booted again.

    # Type Case Result
    1 Core Wipe a NixOS host (/nix/store read-only bind mount) βœ… /home, /etc, /bin, /usr and /var deleted; /nix/store remounted rw and deleted last, then the host halts
    2 Core Power-cycle the wiped NixOS host βœ… doesn't boot (no network, no guest agent), offline in Fleet
    3 Core Fleet status after the NixOS wipe ❌ host shows Unlocked, no Wiped badge, and Wipe can be sent again
    4 Halo Network/shared mount on the NixOS host (9p) βœ… unmounted, not deleted (awk is found now, so the network-mount check works)
    5 Regression Wipe an Ubuntu 24.04 host βœ… Fleet shows Wiped, host halts and doesn't come back
    6 Halo Wipe with awk/rm missing βž– not run on a real host (covered by the PR's container test)

    Row 3: once the wipe deletes /var/lib/orbit, orbit (still running from memory) loses its node key. It re-enrolls, because on NixOS the enroll secret comes from /run/credentials, a tmpfs the wipe doesn't touch. Orbit enroll clears host_mdm_actions (server/datastore/mysql/hosts.go), so the wipe record is gone. Before this fix nothing was deleted, so this couldn't happen.

    06:13:59 systemd[1]: Started [systemd-run] /bin/sh /run/fleet_wipe.sh wipe.
    06:14:09 Unmounting network filesystem: /mnt/installers
    06:14:09 Wiping /home/qa
    06:14:10 rm --one-file-system -rf /nix/store      (/nix/store mount: rw; 11532 β†’ 5 entries by 06:14:59)
    06:14:29 POST /api/fleet/orbit/enroll hostname=nix26-arm   (again 06:14:39, 06:14:59)
    06:15:00 host halted
    

    The finding is going to be addressed in another ticket.

  18. moved this from βœ… Ready for release to Done in πŸͺ„ #g-orchestrationon Nov 17, 2026
  19. fleet-release commented on Nov 17, 2026

    @fleet-release
    Contributor

    Nix store gleams bright
    wipe script now reaches it all
    systems fully cleared

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

#g-orchestrationquick-win

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions