# Flox containerize stops working after flox edit

**URL:** <https://discourse.flox.dev/t/flox-containerize-stops-working-after-flox-edit/805>\
**Category:** Bug Reports\
**Tags:** closed\
**Created:** [October 9, 2023, 2:53pm UTC](https://discourse.flox.dev/t/flox-containerize-stops-working-after-flox-edit/805 "2023-10-09T14:53:49Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon59756714](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@anon59756714](https://discourse.flox.dev/u/anon59756714)\
**Post date:** [October 9, 2023, 2:53pm UTC](https://discourse.flox.dev/t/flox-containerize-stops-working-after-flox-edit/805/1 "2023-10-09T14:53:49Z")

</div>

Flox edit creates new generation but it is not created in /nix/store/\*-source folder. This confuses a flox containerize that cannot find new generation folder.

---

<div class="post-metadata">

**Author:** ![mkenigs](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/mkenigs/32/520_2.png) [@mkenigs](https://discourse.flox.dev/u/mkenigs)\
**Post date:** [October 9, 2023, 5:26pm UTC](https://discourse.flox.dev/t/flox-containerize-stops-working-after-flox-edit/805/2 "2023-10-09T17:26:42Z")

</div>

Are you getting `ERROR: No matching environments found`? That may be fixed in r633 - what’s your `flox --version`?

---

<div class="post-metadata">

**Author:** ![anon59756714](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@anon59756714](https://discourse.flox.dev/u/anon59756714)\
**Post date:** [October 9, 2023, 6:11pm UTC](https://discourse.flox.dev/t/flox-containerize-stops-working-after-flox-edit/805/3 "2023-10-09T18:11:41Z")

</div>

```plaintext
λ flox containerize -e test > ~/docker
Building container...
Done.
No 'fromImage' provided
Creating layer 1 from paths: ['/nix/store/s2gi8pfjszy6rq3ydx0z1vwbbskw994i-libunistring-1.1']
Creating layer 2 from paths: ['/nix/store/k8ivghpggjrq1n49xp8sj116i4sh8lia-libidn2-2.3.4']
Creating layer 3 from paths: ['/nix/store/jbwb8d8l28lg9z0xzl784wyb9vlbwss6-xgcc-12.3.0-libgcc']
Creating layer 4 from paths: ['/nix/sto
...

λ flox edit -e test # add a new line in shell.hook
warning: remote HEAD refers to nonexistent ref, unable to checkout
warning: input 'flox-floxpkgs/etc-profiles' has an override for a non-existent input 'flox-floxpkgs'
Environment 'test' modified.

λ flox containerize -e test > ~/docker
Building container...
error: getting status of '/nix/store/7fl0p4j4x2zbjg203z9cnbq92c2kij63-source/8': No such file or directory
ERROR: Nix failed with: [exit status: 1]

λ flox --version
Version: 0.3.4-r638

```

---

<div class="post-metadata">

**Author:** ![mkenigs](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/mkenigs/32/520_2.png) [@mkenigs](https://discourse.flox.dev/u/mkenigs)\
**Post date:** [October 10, 2023, 4:10pm UTC](https://discourse.flox.dev/t/flox-containerize-stops-working-after-flox-edit/805/4 "2023-10-10T16:10:07Z")

</div>

Hmm I’m struggling to reproduce:

```auto
> flox --version
Version: 0.3.4-r638
> flox destroy -e test
Nothing to delete for the 'aarch64-darwin.test' environment
> flox install -e test hello
...
Installed 'hello' package(s) into 'test' environment.
> flox containerize -e test > ~/docker
Building container...
Done.
No 'fromImage' provided
Creating layer 1 from paths: ['/nix/store/hjlf7fscq2mihg4b1y28cpgmp0j9pxg5-hello-2.12.1']
...
Creating layer 17 from paths: ['/nix/store/p5kwl9j2y6adxzwl4vcj29b46a4sy84s-coreutils-9.3']
Creating layer 18 with customisation...
Adding manifests...
Done.
> flox edit -e test
warning: input 'flox-floxpkgs/etc-profiles' has an override for a non-existent input 'flox-floxpkgs'
Environment 'test' modified.
> flox containerize -e test > ~/docker
Building container...
Done.
No 'fromImage' provided
Creating layer 1 from paths: ['/nix/store/hjlf7fscq2mihg4b1y28cpgmp0j9pxg5-hello-2.12.1']
...
Creating layer 17 from paths: ['/nix/store/p5kwl9j2y6adxzwl4vcj29b46a4sy84s-coreutils-9.3']
Creating layer 18 with customisation...
Adding manifests...
Done.

```

I wonder if there’s some other state that your environment is - are you at generation 8?

---

<div class="post-metadata">

**Author:** ![anon59756714](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@anon59756714](https://discourse.flox.dev/u/anon59756714)\
**Post date:** [October 10, 2023, 4:31pm UTC](https://discourse.flox.dev/t/flox-containerize-stops-working-after-flox-edit/805/5 "2023-10-10T16:31:59Z")

</div>

Immediate containerize run will fail, I tested now on new environment:

```auto
flox create -e cont-test
flox install -e cont-test hello
flox containerize -e cont-test | docker load
flox edit -e cont-test # remove the comment from # echo Flox Environment | figlet line
flox containerize -e cont-test | docker load # Fail

Building container...
error: getting status of '/nix/store/yfj1csj4i1az21mzpm1w4np307ypbnw1-source/3': No such file or directory
ERROR: Nix failed with: [exit status: 1]
open /var/lib/docker/tmp/docker-import-921281233/repositories: no such file or directory

```

For the cont-test, latest is generation 3 :

```auto
λ flox history -e cont-test
Tue Oct 10 18:24:53 2023 +0200 dgoslawski edited declarative profile (generation 3)

flox edit

Tue Oct 10 18:24:19 2023 +0200 dgoslawski installed stable.nixpkgs-flox.hello

flox install hello
  stable.nixpkgs-flox.hello: ∅ -> 2.12.1

Tue Oct 10 18:24:05 2023 +0200 dgoslawski created environment

flox create

Tue Oct 10 18:24:04 2023 +0200 dgoslawski created environment x86_64-linux.cont-test (x86_64-linux)

```

It seems to self-heal after a while, right now I can do a containerize for test env, but if I do edit it, it will fail again.

---

<div class="post-metadata">

**Author:** ![mkenigs](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/mkenigs/32/520_2.png) [@mkenigs](https://discourse.flox.dev/u/mkenigs)\
**Post date:** [October 10, 2023, 7:42pm UTC](https://discourse.flox.dev/t/flox-containerize-stops-working-after-flox-edit/805/6 "2023-10-10T19:42:32Z")

</div>

Can you send the output of a failing `flox --debug containerize -e cont-test | docker load` (I added the `--debug`)?

---

<div class="post-metadata">

**Author:** ![anon59756714](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@anon59756714](https://discourse.flox.dev/u/anon59756714)\
**Post date:** [October 11, 2023, 7:03am UTC](https://discourse.flox.dev/t/flox-containerize-stops-working-after-flox-edit/805/7 "2023-10-11T07:03:33Z")

</div>

I checked this on new, fresh machine and the same effect:

```auto
[DEBUG] [flox::config] `$FLOX_CONFIG_HOME` not set, using "/home/dawid/.config/flox/"
[DEBUG] [flox::utils::init] no default user nix.conf found - weird
[DEBUG] [flox::utils::init::metrics] Attempting to read own UUID from file
[DEBUG] [posix] + "/nix/store/whnrbi502jasi4bj6kai31q3fiky6w62-git-minimal-2.41.0/bin/git" "-C" "/home/dawid/.cache/flox/meta/local" "-c" "user.name=Flox User" "-c" "user.email=floxuser@example.invalid" "rev-parse" "--is-bare-repository"
[DEBUG] [posix] + "/nix/store/whnrbi502jasi4bj6kai31q3fiky6w62-git-minimal-2.41.0/bin/git" "-C" "/home/dawid/.cache/flox/meta/local" "-c" "user.name=Flox User" "-c" "user.email=floxuser@example.invalid" "show" "floxmain:floxUserMeta.json"
[DEBUG] [flox_rust_sdk::models::legacy_environment_ref] Finding environment for cont-test
[DEBUG] [posix] + "/nix/store/whnrbi502jasi4bj6kai31q3fiky6w62-git-minimal-2.41.0/bin/git" "-C" "/mnt/c/Users/dawid.DESKTOP-JCICJKE" "-c" "user.name=Flox User" "-c" "user.email=floxuser@example.invalid" "rev-parse" "--is-bare-repository"
[DEBUG] [flox::utils::metrics] Writing new metrics buffer entry
[DEBUG] [flox_rust_sdk::models::legacy_environment_ref] Not in a Git repository
[DEBUG] [flox_rust_sdk::models::legacy_environment_ref] Checking `local` symlink (`/home/dawid/.local/share/flox/environments/local`) for true name of default user
[DEBUG] [posix] + "/nix/store/whnrbi502jasi4bj6kai31q3fiky6w62-git-minimal-2.41.0/bin/git" "-C" "/home/dawid/.cache/flox/meta/local" "-c" "user.name=Flox User" "-c" "user.email=floxuser@example.invalid" "rev-parse" "--is-bare-repository"
[DEBUG] [posix] + "/nix/store/whnrbi502jasi4bj6kai31q3fiky6w62-git-minimal-2.41.0/bin/git" "-C" "/home/dawid/.cache/flox/meta/local" "-c" "user.name=Flox User" "-c" "user.email=floxuser@example.invalid" "rev-parse" "--is-bare-repository"
[DEBUG] [posix] + "/nix/store/whnrbi502jasi4bj6kai31q3fiky6w62-git-minimal-2.41.0/bin/git" "-C" "/home/dawid/.cache/flox/meta/local" "-c" "user.name=Flox User" "-c" "user.email=floxuser@example.invalid" "show" "x86_64-linux.cont-test:metadata.json"
[INFO] [flox::commands::package] Building container...
[DEBUG] [runix::command_line] Invoking /nix/store/vdzd2vqaapf5j09fs7p1j8qv053nzn8r-flox-bash-0.3.4-r638/libexec/flox/nix:
    env = {"FLOX_VERSION": Some("0.3.4-r638"), "NIX_USER_CONF_FILES": Some("/home/dawid/.config/flox/nix.conf")}
    args = [
        "--connect-timeout",
        "0",
        "--no-warn-dirty",
        "--connect-timeout",
        "0",
        "--no-warn-dirty",
        "build",
        "--json",
        "--impure",
        "git+file:///home/dawid/.cache/flox/meta/local?dir=3&ref=x86_64-linux.cont-test#.floxEnvs.x86_64-linux.default.passthru.streamLayeredImage",
        "--quiet",
        "--quiet",
    ]
[DEBUG] [posix] + FLOX_VERSION="0.3.4-r638" NIX_USER_CONF_FILES="/home/dawid/.config/flox/nix.conf" /nix/store/vdzd2vqaapf5j09fs7p1j8qv053nzn8r-flox-bash-0.3.4-r638/libexec/flox/nix --connect-timeout 0 --no-warn-dirty --connect-timeout 0 --no-warn-dirty build --json --impure 'git+file:///home/dawid/.cache/flox/meta/local?dir=3&ref=x86_64-linux.cont-test#.floxEnvs.x86_64-linux.default.passthru.streamLayeredImage' --quiet --quiet
error: getting status of '/nix/store/ygfjf9wg1k056dbkna9av847zppqa8ph-source/3': No such file or directory
[ERROR] [flox] Nix failed with: [exit status: 1]
open /var/lib/docker/tmp/docker-import-3726534124/repositories: no such file or directory

```

---

<div class="post-metadata">

**Author:** ![mkenigs](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/mkenigs/32/520_2.png) [@mkenigs](https://discourse.flox.dev/u/mkenigs)\
**Post date:** [October 11, 2023, 11:34pm UTC](https://discourse.flox.dev/t/flox-containerize-stops-working-after-flox-edit/805/8 "2023-10-11T23:34:00Z")

</div>

If you pass `--refresh` does it work? `flox containerize --refresh -e cont-test`

---

<div class="post-metadata">

**Author:** ![anon59756714](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@anon59756714](https://discourse.flox.dev/u/anon59756714)\
**Post date:** [October 12, 2023, 12:21pm UTC](https://discourse.flox.dev/t/flox-containerize-stops-working-after-flox-edit/805/9 "2023-10-12T12:21:38Z")

</div>

Yeah, it works with `--refresh`. Will all Nix options be passed if not recognized by flox?

---

<div class="post-metadata">

**Author:** ![mkenigs](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/mkenigs/32/520_2.png) [@mkenigs](https://discourse.flox.dev/u/mkenigs)\
**Post date:** [October 12, 2023, 6:54pm UTC](https://discourse.flox.dev/t/flox-containerize-stops-working-after-flox-edit/805/10 "2023-10-12T18:54:34Z")

</div>

It depends on the flox subcommand, but containerize currently does

---

<div class="post-metadata">

**Author:** ![mkenigs](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/mkenigs/32/520_2.png) [@mkenigs](https://discourse.flox.dev/u/mkenigs)\
**Post date:** [October 12, 2023, 6:57pm UTC](https://discourse.flox.dev/t/flox-containerize-stops-working-after-flox-edit/805/11 "2023-10-12T18:57:48Z")

</div>

Opening a bug to fix having to pass `--refresh`
