<p>You need to change the permissions on your /nix directory.</p>
<p>If you run this command you should be able to move forward:</p>
<pre><code>chmod 775 /nix
</code></pre>

CC BY-SA 4.0
2022-01-14T04:41:38.950Z
Welcome to Cardano SE! As a new user be sure to take the [Tour].
gRebel
CC BY-SA 4.0
2022-01-18T14:34:37.063Z
add code in-line with `enter code here`
Hud
CC BY-SA 4.0
2022-01-13T21:09:39.310Z
2022-01-26T22:37:29.590Z
2022-01-26T22:37:29.590Z
aseveli
<p>deleting the /nix/var directory</p>
<p>and then running</p>
<p>nix build -f default.nix docs.site --extra-experimental-features nix-command</p>
<p>fixed the</p>
<p>error: executing SQLite statement 'pragma synchronous = normal': unable to open database file (in '/nix/var/nix/db/db.sqlite')</p>
<p>error for me.</p>

CC BY-SA 4.0
2022-01-16T04:20:36.463Z
Welcome to Cardano SE! As a new user be sure to take the [Tour].
gRebel
CC BY-SA 4.0
2022-01-15T23:48:53.197Z
2022-01-15T23:48:53.197Z
Manny D
<p>I had this problem yesterday and I found that shutting down the distro and restarting it after installing nix worked to fix this issue, it may work for you as well.</p>
<ul>
<li>Exit out of the ubuntu distro</li>
<li>In a windows terminal (powershell or whatever) use <code>wsl -l -v</code> to see the running distros</li>
<li>Then use <code>wsl --terminate &lt;DistributionName&gt;</code> to stop the distro</li>
<li>Then use <code>wsl --distribution &lt;DistributionName&gt;</code> to start the distro again</li>
<li>Now you can try to build again.</li>
</ul>
<p>Here's where I found the wsl commands -
<a href="https://winaero.com/terminate-running-wsl-linux-distro-windows-10/" rel="nofollow noreferrer">https://winaero.com/terminate-running-wsl-linux-distro-windows-10/</a></p>
<p><a href="https://i.sstatic.net/jJ0bd.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/jJ0bd.png" alt="enter image description here" /></a></p>
<p>On another note you should be using the plutus-apps repo not the plutus repo.
Here's a link to a doc from another pioneer who setup the environemnt with WSL that may help you -
<a href="https://docs.google.com/document/d/1mLyuGmCvZLqFotpVElbhYR5Q6PUatGxSeGuulJ1izJA/edit" rel="nofollow noreferrer">https://docs.google.com/document/d/1mLyuGmCvZLqFotpVElbhYR5Q6PUatGxSeGuulJ1izJA/edit</a></p>

CC BY-SA 4.0
2022-01-14T04:46:05.840Z
Welcome to Cardano SE! As a new user be sure to take the [Tour].
gRebel
CC BY-SA 4.0
2022-01-14T01:15:18.180Z
2022-01-14T01:15:18.180Z
CookieDuster13
<p>I had success by uninstalling/removing Nix, and then installing it again</p>
<h3>Uninstalling:</h3>
<ol>
<li>remove the <code>. &quot;$HOME/.nix-profile/etc/profile.d/nix.sh&quot;</code> line in
your <code>~/.profile</code> or <code>~/.bash_profile</code></li>
<li><code>rm -rf $HOME/{.nix-channels,.nix-defexpr,.nix-profile,.config/nixpkgs}</code></li>
<li><code>sudo rm -rf /nix</code></li>
</ol>
<h3>Reinstalling:</h3>
<ol>
<li><code>sh &lt;(curl -L https://nixos.org/nix/install) --no-daemon</code></li>
<li><code>. $HOME/.nix-profile/etc/profile.d/nix.sh</code></li>
</ol>

CC BY-SA 4.0
2022-01-17T02:14:10.943Z
2022-01-17T02:14:10.943Z
RicWaltman
<p>I'm attempting to finish the setup for plutus pioneers cohort3 on wsl2 (Windows 10) with Ubunutu 20.04. When I run the command:</p>
<p><code>nix --extra-experimental-features nix-command build -f default.nix plutus.haskell.packages.plutus-core.components.library</code></p>
<p>I get:</p>
<p><code>error: executing SQLite statement 'pragma synchronous = normal': unable to open database file (in '/nix/var/nix/db/db.sqlite')</code></p>
<p>I have already created /etc/nix/nix.conf to configure nix with the IOHK binary cache. I also checked and there is no var folder within the nix directory. Did I fail to create a db along the way or is something else amiss?</p>

CC BY-SA 4.0
2022-01-16T23:38:17.673Z
Welcome to Cardano SE! As a new user be sure to take the [Tour].
gRebel
<plutus><plutus-pioneer-program><nix>
WSL2 install - plutus fails to build, unable to open db file in 'nix/var/nix/db/db.sqlite'
# WSL2 install - plutus fails to build, unable to open db file in 'nix/var/nix/db/db.sqlite'

(Asked by: username_0 on 2022-01-13)

I'm attempting to finish the setup for plutus pioneers cohort3 on wsl2 (Windows 10) with Ubunutu 20.04. When I run the command:

`nix --extra-experimental-features nix-command build -f default.nix plutus.haskell.packages.plutus-core.components.library`

I get:

`error: executing SQLite statement 'pragma synchronous = normal': unable to open database file (in '/nix/var/nix/db/db.sqlite')`

I have already created /etc/nix/nix.conf to configure nix with the IOHK binary cache. I also checked and there is no var folder within the nix directory. Did I fail to create a db along the way or is something else amiss?

**Tags:** plutus, plutus-pioneer-program, nix
> **Comments:**
> **username_1**: Welcome to Cardano SE! As a new user be sure to take the [Tour].  

---

## 4 answers

### Answer by username_2 on 2022-01-13. Score: 0

You need to change the permissions on your /nix directory.
If you run this command you should be able to move forward:
chmod 775 /nix

> **Comments:**
> **username_1**: Welcome to Cardano SE! As a new user be sure to take the [Tour].  
> **username_3**: add code in-line with `enter code here`  

---

### Answer by username_4 on 2022-01-15. Score: 0

deleting the /nix/var directory

and then running

nix build -f default.nix docs.site --extra-experimental-features nix-command

fixed the

error: executing SQLite statement 'pragma synchronous = normal': unable to open database file (in '/nix/var/nix/db/db.sqlite')

error for me.

> **Comments:**
> **username_1**: Welcome to Cardano SE! As a new user be sure to take the [Tour].  

---

### Answer by username_5 on 2022-01-14. Score: 0

I had this problem yesterday and I found that shutting down the distro and restarting it after installing nix worked to fix this issue, it may work for you as well.

* Exit out of the ubuntu distro
* In a windows terminal (powershell or whatever) use `wsl -l -v` to see the running distros
* Then use `wsl --terminate`  to stop the distro
* Then use `wsl --distribution`  to start the distro again
* Now you can try to build again.

Here's where I found the wsl commands -
<https://winaero.com/terminate-running-wsl-linux-distro-windows-10/>

[![enter image description here](https://i.sstatic.net/jJ0bd.png)](https://i.sstatic.net/jJ0bd.png)

On another note you should be using the plutus-apps repo not the plutus repo.
Here's a link to a doc from another pioneer who setup the environemnt with WSL that may help you -
<https://docs.google.com/document/d/1mLyuGmCvZLqFotpVElbhYR5Q6PUatGxSeGuulJ1izJA/edit>

> **Comments:**
> **username_1**: Welcome to Cardano SE! As a new user be sure to take the [Tour].  

---

### Answer by username_6 on 2022-01-17. Score: 0

I had success by uninstalling/removing Nix, and then installing it again

### Uninstalling:

1. remove the `. "$HOME/.nix-profile/etc/profile.d/nix.sh"` line in
   your `~/.profile` or `~/.bash_profile`
2. `rm -rf $HOME/{.nix-channels,.nix-defexpr,.nix-profile,.config/nixpkgs}`
3. `sudo rm -rf /nix`

### Reinstalling:

1. `sh <(curl -L https://nixos.org/nix/install) --no-daemon`
2. `. $HOME/.nix-profile/etc/profile.d/nix.sh`


---

