Skip to content

extra-container destroy demo outputs Operation not permitted #4

Closed

Description

@msgilligan

On a NixOS 26.05 aarch64 system, I have installed extra-container using the "With flakes" installation from the README (both the overlay and non-overlay methods.)

When I try to follow the instructions in the sudo extra-container create example in the README, everything seems to be working, but when I use sudo extra-container destroy demo, I get the following output:

$ sudo extra-container destroy demo
rm: cannot remove '/var/lib/nixos-containers/demo/var/empty': Operation not permitted
umount: /var/lib/nixos-containers/demo: not mounted
rm: cannot remove '/var/lib/nixos-containers/demo/var/empty': Operation not permitted

The container no longer shows up in nixos-container list, but the empty directory /var/lib/nixos-containers/demo/var/empty/ is not removed.

Activity

  1. stevelr commented on Oct 16, 2026

    @stevelr
    Contributor

    Thanks for the report!

    root cause: clearContainerState calls chattr to clear the immutable flag on /var/empty but ignores failures; and extra-container doesn't install chattr.

    I actually had a test to test the commands in README, but the test used my PATH, which masked the bug. If you don't have e2fsprogs installed (and don't have ext2/3/4 in use), you may not have chattr in your PATH in which case destroy would fail.

    Nix is supposed to avoid those works-on-my-machine problems!

    Fixes:

    • add e2fsprogrs to extra-container's PATH (and the devShell).
    • make the test run in a VM to get a clean path.
    • verify the container is fully removed after destroy
  2. stevelr commented on Oct 16, 2026

    @stevelr
    Contributor

    btw, nixos-container destroy has the same bug: it would fail if e2fsprogs is not installed. I'll file an upstream PR.

    Update: upstream PR NixOS/nixpkgs#574683

  3. stevelr commented on Oct 16, 2026

    @stevelr
    Contributor

    Fix is in main. I'll close this after a release is tagged.

  4. stevelr commented on Nov 3, 2026

    @stevelr
    Contributor

    fixed in extra-container-1.0.1 (Release) and on main.
    Upstream PR for nixos containers has been merged.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions