IHP 1.1 is out now!

Installation on Windows 10 (wsl): nix-env stderr: error: executing SQLite statement

Jörg Brüggmann

Dear all,

I just tried to install IHP according to this installation procedure here: "https://ihp.digitallyinduced.com/Guide/installation.html". It seemd to work but when creating the very first project with "ihp-ne" according to this guideline: "https://ihp.digitallyinduced.com/Guide/your-first-project.html#1-project-setup" I received the following message: nix-env stderr: error: executing SQLite statement 'pragma synchronous = normal': unable to open database file (in '/nix/var/nix/db/db.sqlite')

"ls -l" in "/nix/var/nix/db/db.sqlite" prints: total 10128 -rw------- 1 joerg joerg 0 Feb 2 20:12 big-lock -rw-r--r-- 1 joerg joerg 1941504 Feb 2 20:28 db.sqlite -rw-r--r-- 1 joerg joerg 32768 Feb 2 20:42 db.sqlite-shm -rw-r--r-- 1 joerg joerg 0 Feb 2 20:42 db.sqlite-wal -rw------- 1 joerg joerg 8388608 Feb 2 20:12 reserved -rw-r--r-- 1 joerg joerg 2 Feb 2 20:12 schema

Any help is very much appreciated.

Thank you.

Best regards

Jörg

Zac Wood BUSINESS

A couple things:

  1. Nix issues are common if the ihp project you create is in the windows file system. Are you creating the project inside the WSL file system?

  2. Are you using WSL2? It seems the guide is showing instructions for WSL1, which may work but I'd recommend using WSL2. (I develop with IHP on Windows using WSL2 with Ubuntu)

Jörg Brüggmann

Wow, thank you for your fast answer.

I just checked the version by "wsl -l-v" as suggested by "https://askubuntu.com/questions/1177729/wsl-am-i-running-version-1-or-version-2"

PS C:\Users\Joerg> wsl -l -v NAME STATE VERSION

  • Ubuntu Running 2

...assumung I have wsl2 installed.

Jörg Brüggmann

Regarding your first question: I created the project using "ihp-new blog" within the ubuntu shell within the PowerShell.

Zac Wood BUSINESS

Okay, so the default directory (at least for me) once you boot WSL is inside the windows file system. We can see that here:

zac@LAPTOP-CQNDAVA7:/mnt/c/Users/zacwo$ pwd
/mnt/c/Users/zacwo

We want to run in the Linux file system, so you can run cd and then check your directory:

zac@LAPTOP-CQNDAVA7:/mnt/c/Users/zacwo$ cd
zac@LAPTOP-CQNDAVA7:~$ pwd
/home/zac

and we are in the Linux system (under /home).

Try creating an IHP project with ihp-new here.

Jörg Brüggmann

OK, I just canged the directory to "/home/joerg"...

...and entered "ihp-new blog".

...and again it prints:

nix-env stderr: error: executing SQLite statement 'pragma synchronous = normal': unable to open database file (in '/nix/var/nix/db/db.sqlite')
'nix-env --version' exited with 1
Jörg Brüggmann

The complete output was:

joerg@Suedradde:~$ ihp-new blog

grep: /home/joerg/.bash_profile: No such file or directory
Direnv shell hook doesn't seem correct.
Direnv needs to be hooked into your shell. Please follow the steps below:
Bash: Add eval "$(direnv hook bash)" to ~/.bashrc
ZSH: Add eval "$(direnv hook zsh)" to ~/.zshrc
Other shells: See https://direnv.net/#README
This could be a false negative if you use a more complex shell profile

Cachix doesn't seem to be configured
IHP provides a cachix cache with binaries for all IHP packages and     commonly used dependencies.
While not required, this greatly speeds up the installation & build     process.
This could be a false negative if you use a more complex nix configuration.


We will configure the cache for you now using 'cachix use     digitallyinduced'. Continue? (Type y to proceed)
y
nix-env stderr: error: executing SQLite statement 'pragma synchronous = normal': unable to open database file (in '/nix/var/nix/db/db.sqlite')


'nix-env --version' exited with 1joerg@Suedradde:~$
Zac Wood BUSINESS

Hmm. Try removing the /etc/nix/ directory the install guide tells you to create (I don't have that). After that try exiting your shell and restarting.

Jörg Brüggmann

Now it says:

* Main.hs (import)
* Main.hs (import)
* Main.hs (AddMountToFrontController)
+ Web/Types.hs
+ Web/Routes.hs
+ Web/FrontController.hs
+ Web/Controller/Prelude.hs
+ Web/View/Layout.hs
+ Web/View/Prelude.hs
+ Web/Controller/Static.hs
+ Web/View/Static/Welcome.hs

🚀 Project created, happy coding :)
You can start the server by running:
  cd blog
  ./start

Thank you so much.

Best regards

Jörg

Zac Wood BUSINESS

Hurray! Happy hacking!

koijigen

This post saved my life😇