Vaultwarden service can't access data folder

Hi, I’m trying to install Vaultwarden on my server, but after creation of service, when I start it, it couldn’t access to the data folder.

Environement :

  • User and Group : bitwarden
  • Installation folder : /opt/vaultwarden
  • Data folder : /home/bitwarden/vaultdata

The installation and data folder are set to bitwarden user and group, with drwxr-xr-x mode …

But when I start the service, the service return the status failed, with this error :

Aug 06 11:59:23 smtp.magicseeserver vaultwarden[9351]: [INFO] No .env file found.
Aug 06 11:59:23 smtp.magicseeserver vaultwarden[9351]: [2022-08-06 11:59:23.192][vaultwarden][ERROR] Data folder '/home/bitwarden/v>
Aug 06 11:59:23 smtp.magicseeserver vaultwarden[9351]: [2022-08-06 11:59:23.192][vaultwarden][ERROR] Create the data folder and try>
Aug 06 11:59:23 smtp.magicseeserver systemd[1]: vaultwarden.service: Main process exited, code=exited, status=1/FAILURE
Aug 06 11:59:23 smtp.magicseeserver systemd[1]: vaultwarden.service: Failed with result 'exit-code'.

Service has this 3 options set :
User=bitwarden
Group=bitwarden
EnvironmentFile=/etc/vaultwarden.env

Could you help me please ?

Make sure the data folder has the correct rights. 775 or something.

Yes, the data folder was at 755, I tried with 775, but same result

Then i’m not sure what or why. Try 777. If that helps then there is something wrong with the user/group

It’s strange … same issue with 777 …

Is it possible to start vaultwarden directly without service ? I tried, but it doesn’t found the .env file

It can start with a service file.
Just point either run the Vaultwarden binary from the location where the .env file is located, or place the .env file at the same location as the binary, and run it from there.

It’s strange I made a link of .env file into binary file … And running can’t find .env …

I also try to copy file instead of link … Same issue

The file needs to be named .env as the message indicates, not vaultwarden.env.

mmmh no, same issue with .env file :

Hum, it seems to be definitively a service problem … If I start the execution file, it’s ok, it start and create all files in data folder … But If I start service, it says :

[ERROR] Data folder ‘/home/bitwarden/vaultdata’ doesn’t exist.

OK, solved, I have to duplicate .env in vaultwarden folder and in EnvironementFile for the service.

If it is only in EnvironementFile, but not in vaultwarden folder, service say “no .env file”, but use also the EnvironementFile.

The .env file INFO message is because Vaultwarden it self couldn’t find that file it self.

If you load that file via systemd or any other option it’s normal that Vaultwarden doesn’t see that file it self. And it doesn’t need to.

Vaultwarden needs the environment populated with all the config options. Systemd does this for you. Or Vaultwarden tries to read a .env file when available.

So tldr, when using systemd, you will get that message. And it is no issue.