# Can't rebuild after VM crash

**URL:** https://discourse.nixos.org/t/cant-rebuild-after-vm-crash/19228
**Category:** Help
**Created:** [May 19, 2022, 11:53am UTC](https://discourse.nixos.org/t/cant-rebuild-after-vm-crash/19228 "2022-05-19T11:53:24Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Nebucatnetzer](https://discourse.nixos.org/user_avatar/discourse.nixos.org/nebucatnetzer/32/5770_2.png) [@Nebucatnetzer](https://discourse.nixos.org/u/Nebucatnetzer)
#### Post date: [May 19, 2022, 11:53am UTC](https://discourse.nixos.org/t/cant-rebuild-after-vm-crash/19228/1 "2022-05-19T11:53:24Z")

</div>

My laptop crashed and with a NixOS VM which was just doing a `nixos-rebuild switch`.  
I can still boot and login to the VM but `nixos-rebuild` isn’t working anymore.  
I get thousand of the following messages.  
How could I fix this?

```auto
warning: removing corrupted link '/nix/store/.links/1xawr8zy6pfml0gzyh15ayf0lalgv8wqn7br2hqn6aqdya3rqrwp'
warning: removing corrupted link '/nix/store/.links/0d3x0s4mr24y1fcrcjm0w6sra1lbmch03204n8ckdd2a1vxnivvc'

```

`nix-store --verify --check-contents --repair` gave me the following error.

```auto
error: removing corrupt link '/nix/store/.links/1xawr8zy6pfml0gzyh15ayf0lalgv8wqn7br2hqn6aqdya3rqrwp': Is a directory

```

`nixos-rebuild build --repair` returns:

```auto
building the system configuration...
error: unrecognised flag '--repair'
Try 'nix --help' for more information

```

---

<div class="post-metadata">

### Author: ![NobbZ](https://discourse.nixos.org/user_avatar/discourse.nixos.org/nobbz/32/7022_2.png) [@NobbZ](https://discourse.nixos.org/u/NobbZ)
#### Post date: [May 19, 2022, 12:38pm UTC](https://discourse.nixos.org/t/cant-rebuild-after-vm-crash/19228/2 "2022-05-19T12:38:47Z")

</div>

> [@Nebucatnetzer](#):
>
> ```auto
> nix-store --verify --check-contents --repair` gave me the following error.
> 
> ```

Once this went through once, all errors should be fixed. Then you should be able to do a regular `nixos-rebuild switch` again.

---

<div class="post-metadata">

### Author: ![Nebucatnetzer](https://discourse.nixos.org/user_avatar/discourse.nixos.org/nebucatnetzer/32/5770_2.png) [@Nebucatnetzer](https://discourse.nixos.org/u/Nebucatnetzer)
#### Post date: [May 19, 2022, 12:52pm UTC](https://discourse.nixos.org/t/cant-rebuild-after-vm-crash/19228/3 "2022-05-19T12:52:12Z")

</div>

Doesn’t work and any subsequent try gives me the same error (`Is a directory`) again.

---

<div class="post-metadata">

### Author: ![Nebucatnetzer](https://discourse.nixos.org/user_avatar/discourse.nixos.org/nebucatnetzer/32/5770_2.png) [@Nebucatnetzer](https://discourse.nixos.org/u/Nebucatnetzer)
#### Post date: [May 24, 2022, 6:45am UTC](https://discourse.nixos.org/t/cant-rebuild-after-vm-crash/19228/4 "2022-05-24T06:45:15Z")

</div>

It worked again after a `nix flake update` today.  
Probably it didn’t need that path anymore.
