# Upgrading flox breaks default environment

**URL:** https://discourse.flox.dev/t/upgrading-flox-breaks-default-environment/494
**Category:** Help
**Created:** [November 16, 2022, 5:54pm UTC](https://discourse.flox.dev/t/upgrading-flox-breaks-default-environment/494 "2022-11-16T17:54:42Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![fleimgruber](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/fleimgruber/32/400_2.png) [@fleimgruber](https://discourse.flox.dev/u/fleimgruber)
#### Post date: [November 16, 2022, 5:54pm UTC](https://discourse.flox.dev/t/upgrading-flox-breaks-default-environment/494/1 "2022-11-16T17:54:42Z")

</div>

Upgrading from `0.0.5-r31` to `0.0.6-r45` broke the default environment.

```nohighlight
flox activate
INFO environment not found: /home/fps/.local/share/flox/environments/local/default
INFO environment not found: /home/fps/.local/share/flox/environments/local/default

```

`flox list -e default` shows no installed Packages, only the env metadata:

```nohighlight
local/default
    Alias local/default
    System x86_64-linux
    Path /home/fps/.local/share/flox/environments/local/default
    Curr Gen 9

Packages

```

Looking at the location of the env, I tried

```nohighlight
file .local/share/flox/environments/local/default

```

saying

```auto
.local/share/flox/environments/local/default: broken symbolic link to default-9-link

```

---

<div class="post-metadata">

### Author: ![jurraca](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/jurraca/32/397_2.png) [@jurraca](https://discourse.flox.dev/u/jurraca)
#### Post date: [November 16, 2022, 7:43pm UTC](https://discourse.flox.dev/t/upgrading-flox-breaks-default-environment/494/2 "2022-11-16T19:43:55Z")

</div>

Hi @fleimgruber !  
Thanks for pointing this out. Looking into it, I have a few questions:

- did you `flox push` your environment at any point? If so a `flox pull` should set your env back up.
- did you perform any garbage collection on your envs? This could delete a package necessary for that env if it didn’t have a GCRoot any longer.
- can you still see symlinks under `.local/share/flox/environments/local/` ?

Thanks,  
Julien

---

<div class="post-metadata">

### Author: ![fleimgruber](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/fleimgruber/32/400_2.png) [@fleimgruber](https://discourse.flox.dev/u/fleimgruber)
#### Post date: [November 16, 2022, 11:22pm UTC](https://discourse.flox.dev/t/upgrading-flox-breaks-default-environment/494/3 "2022-11-16T23:22:50Z")

</div>

Hi @jurraca, thanks for looking into it!

> did you perform any garbage collection on your envs?

I did an upgrade (on 22.05 channel) via `nixos-rebuild switch --upgrade` and after reboot I did `nix-store --gc` and `nix-collect-garbage -d` after `nix-env --delete-generations old`.

> can you still see symlinks under `.local/share/flox/environments/local/` ?

Yes:

```e
ls ~/.local/share/flox/environments/local/
default default-4-link default-5-link default-6-link default-7-link default-8-link default-9-link work work-1-link

```

and

```auto
file default-9-link
.local/share/flox/environments/local/default-9-link: broken symbolic link to /nix/store/38icd9ys4m7vlr0fcl18v3agq4dpizxn-profile

```

which looks like you were right about the missing GCRoot?

How should I proceed? Did I miss that in the docs? Can we exclude packages from GC that are referenced by flox?

---

<div class="post-metadata">

### Author: ![jurraca](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/jurraca/32/397_2.png) [@jurraca](https://discourse.flox.dev/u/jurraca)
#### Post date: [November 17, 2022, 12:06am UTC](https://discourse.flox.dev/t/upgrading-flox-breaks-default-environment/494/4 "2022-11-17T00:06:25Z")

</div>

> How should I proceed? Did I miss that in the docs?

You did not miss it, we should provide some documentation around this.  
In short, the packages are gone, but the metadata which defines your environments is not.

The easiest way to recover your environments would be to push your environments up to github via `flox push` and `flox pull` them back down ([docs](https://beta.floxdev.com/docs/getting-started/sharing-environments/)). I’d recommend stashing your environments this way, never know when (or where) you may need them 🙂 .

Another way to recover is to run `flox edit` to edit your manifest. Currently editing the manifest will force an upgrade to all packages in the environment, effectively re-rendering the env locally (adding a whitespace will suffice). If you don’t want to upgrade, go with the first option.

> Can we exclude packages from GC that are referenced by flox?

Not currently, but we are working on handling GC better and should have some updates on this front soon. Look out for the release notes.

Let me know if you run into any issues with this!

---

<div class="post-metadata">

### Author: ![fleimgruber](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/fleimgruber/32/400_2.png) [@fleimgruber](https://discourse.flox.dev/u/fleimgruber)
#### Post date: [November 17, 2022, 5:14pm UTC](https://discourse.flox.dev/t/upgrading-flox-breaks-default-environment/494/5 "2022-11-17T17:14:51Z")

</div>

Thanks for checking back! Is Gitlab supported for hosting environments? If not, how can I re-configure `flox push`? It let me choose Gitlab from a list, but it seems Gitlab can’t be configured e.g. via `flox gl auth login`, so now it appears it always wants to push to Gitlab - I did the Github auth after selecting Gitlab from that list…

---

<div class="post-metadata">

### Author: ![jurraca](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/jurraca/32/397_2.png) [@jurraca](https://discourse.flox.dev/u/jurraca)
#### Post date: [November 17, 2022, 11:36pm UTC](https://discourse.flox.dev/t/upgrading-flox-breaks-default-environment/494/6 "2022-11-17T23:36:35Z")

</div>

GitLab is supported, but we don’t ship the GitLab CLI with flox like we do with `gh`.  
In the third step [here](https://beta.floxdev.com/docs/getting-started/sharing-environments/#push-the-default-environment-to-github), it asks you to confirm the URL, and you should input the gitlab URL, not the default.  
If you haven’t messed with your config too much, a `flox config --reset` should be harmless and get you out of that loop. Just go back to `flox push` and with the prompt select GitLab, HTTPS, and the GitLab URL.  
You’ll need to set up the GitLab token or similar auth in your shell somehow.

---

<div class="post-metadata">

### Author: ![fleimgruber](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/fleimgruber/32/400_2.png) [@fleimgruber](https://discourse.flox.dev/u/fleimgruber)
#### Post date: [November 18, 2022, 1:16pm UTC](https://discourse.flox.dev/t/upgrading-flox-breaks-default-environment/494/7 "2022-11-18T13:16:03Z")

</div>

> `flox config --reset` should be harmless and get you out of that loop. Just go back to `flox push` and with the prompt select GitLab, HTTPS, and the GitLab URL.

`flox config --reset` did not work unfortunately.

---

<div class="post-metadata">

### Author: ![tomberek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/tomberek/32/83_2.png) [@tomberek](https://discourse.flox.dev/u/tomberek)
#### Post date: [November 18, 2022, 6:13pm UTC](https://discourse.flox.dev/t/upgrading-flox-breaks-default-environment/494/8 "2022-11-18T18:13:51Z")

</div>

@fleimgruber under the hood this is a git repository, so the changing of its location can be done via (if using git via SSH auth):

```auto
$ flox git remote set-url origin git@gitlab.com:USERNAME/floxmeta
$ flox push

```

You need to ensure that your Gitlab authentication is set up the way you like, if you are using https auth then `https://gitlab.com/USERNAME/floxmeta` and so forth.

Note: also, you would need to create that empty repo yourself.

---

<div class="post-metadata">

### Author: ![jurraca](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/jurraca/32/397_2.png) [@jurraca](https://discourse.flox.dev/u/jurraca)
#### Post date: [November 18, 2022, 7:10pm UTC](https://discourse.flox.dev/t/upgrading-flox-breaks-default-environment/494/9 "2022-11-18T19:10:46Z")

</div>

OK, sorry about that.  
You can actually check your remote for the `floxmeta` repo with `flox git remote -v`.  
And you can then replace the origin with git as you would with git (`flox git remote add origin https://gitlab.com/myrepo`).  
Let me know if that doesn’t sort you out.

---

<div class="post-metadata">

### Author: ![fleimgruber](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/fleimgruber/32/400_2.png) [@fleimgruber](https://discourse.flox.dev/u/fleimgruber)
#### Post date: [November 18, 2022, 11:28pm UTC](https://discourse.flox.dev/t/upgrading-flox-breaks-default-environment/494/10 "2022-11-18T23:28:19Z")

</div>

Thank you both for the helpful answers, I could sort it out and the default environment works again!
