Skip to content

nmdctl: unattended flag ignored by many prompts #92

@tim000x3

Description

@tim000x3

Summary

Running nmdctl with -u/--unattended still triggers several read -r -p prompts because they never check UNATTENDED. That leaves systemd units and automation stuck waiting for input.

Impact

High: nmdctl unassign (4021) always asks for confirmation, so the unassign → replace → start → mount → check replacement flow cannot be automated.

Medium: parity check prompts if a previous resync is paused (2628).

Low/medium: create/add/replace and reload also ignore -u, so unattended runs stall there too.

Guarded prompts (6 total)

Line Context What happens
2286 import Size mismatch confirmation
2474 start Abnormal state confirmation
2539 stop Unmount request
2647 check Pending non-check sync warning
2659 check Default corrective check confirmation
4187 mount Start array now?

Unguarded prompts (13 total)

Line(s) Context Description Impact
2628 parity check Start new op while a paused resync exists Medium
3020 create Recreate array with new config Low (interactive flow)
3065 create Enter array label Low
3095 create Press enter to continue when disk lacks ID Low
3146 create Slot selection Low
3258 create Mark parity valid Low
3283 create Start array now? Low
3725 add/replace Select device to add Medium
3773 add/replace Slot selection Medium
3829 add/replace Preclear confirmation Medium
3847 add/replace Final confirmation Medium
4021 unassign Confirm unassignment High
4096 reload Confirm creating new superblock Low

Expected behavior

If -u is set, commands should either proceed noninteractively or fail fast with a clear error instead of blocking for input.

Suggested fix

Wrap each prompt with the same UNATTENDED gate used in existing guarded spots (e.g., 2647/2659). Return an error in unattended mode instead of prompting.

I’m happy to open a PR to add the guards; if any of these are intentionally interactive, just say so and I’ll leave those as-is.

Reproduction

  • Stop the array, then run nmdctl -u unassign 1; it still asks “Are you sure you want to unassign this disk?”
  • Pause a parity check, then run nmdctl -u check; it asks whether to start a new operation without resuming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions