# Can't rebuild system after deleting a package from the store

**URL:** https://discourse.nixos.org/t/cant-rebuild-system-after-deleting-a-package-from-the-store/15063
**Category:** Help
**Created:** [September 17, 2021, 10:03am UTC](https://discourse.nixos.org/t/cant-rebuild-system-after-deleting-a-package-from-the-store/15063 "2021-09-17T10:03:48Z")
**Posts on this page:** 1
**Showing post:** 8

<div class="post-metadata">

### Author: ![skogsbrus](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/s/ecc23a/32.png) [@skogsbrus](https://discourse.nixos.org/u/skogsbrus)
#### Post date: [September 17, 2021, 12:24pm UTC](https://discourse.nixos.org/t/cant-rebuild-system-after-deleting-a-package-from-the-store/15063/8 "2021-09-17T12:24:44Z")

</div>

All right, so I backed up the profiles with `cp -r -d /nix/var/nix/profiles .` and then removed all the broken symlinks:

```auto
for f in $(find /nix/var/nix/profiles/); do if [! -e "$f"]; then sudo rm $f; fi; done

```

Rebuilding the system now works.

So reading up on [profiles](https://nixos.org/manual/nix/unstable/package-management/profiles.html), here’s what I think happened.

The _store_ did not break, but I had lots of generations that broke because I forcefully removed a package that they still referenced.

Thanks for the help all! Really appreciate the quick responses 🙂

edit: for the .desktop entry not showing up in Gnome, I think it’s due to a change in the package so not Nix-related.

---

_[View the full topic](https://discourse.nixos.org/t/cant-rebuild-system-after-deleting-a-package-from-the-store/15063)._
