Running Bitwarden on Ubuntu 22.04, bitwarden-mssql is always in ‘unhealthy’ state.
It keeps on restarting, with the error:
Error 5(Access is denied.) occurred while opening file '/var/opt/mssql/data/master.mdf' to obtain configuration information at startup. An invalid startup option might have caused the error. Verify your startup options, and correct or remove them if necessary.
However, the service is up and running. I can login and use Bitwarden with no issues. So what is bitwarden-mssql used for? I can even completely stop the container, but no signs of errors in the webclient.
Another container bitwarden-admin, is also unhealthy. This is complaining about connection errors with the database. Makes sense, however going to the admin dashboard it doesn’t show any issues. It’s also just running fine.
The one thing that isn’t working is nightly database backups. I suspect this is then due to bitwarden-mssql not running and therefore I would still like to address this.
I’ve tried everything I could find in this forum and others to resolve the issue. The one thing that I haven’t tried is to set database_docker_volume to true. But wouldn’t that make the database data non-persistent?
Thanks for the suggestion. There is no firewall enabled at the moment, just to be sure this is not going to interfere.
Even more confusing, in another attempt, I’ve removed the installation completely and reinstalled Bitwarden. I used a different name for ‘vault’ during the first install, and I’ve ready that this could cause issues, therefore I gave it another go but using only default settings. I also removed the complete directory bwdata, including the database files. After the service was up again, to my surprise I could log in and view my vault. How is that even possible? It’s like there is some other hidden database running that I’m not seeing.
# DONT JUST COPY PASTE THIS, THIS IS TO REMOVE THE INSTALLATION
docker ps -aq
docker rmi $(docker images -q)
# […]successfully removed all images on the machine
Rm -r /opt/Bitwarden/bwdata
As I just can’t figure out what was going on, I’ve made a fresh Ubuntu VM and installed everything from scratch. Now everything is working correctly, including the nightly backups. Where I think I went wrong with the first installation is that:
(1) I ignored the section to create a dedicated bitwarden user. It was optional, and because the VM is dedicated to bitwarden, I figured it would not add any security so I skipped it. But I therefore also skipped the steps to create the /opt/bitwarden directory, and installed it into my home directory instead. One of the error messages from bitwarden-mssql was that it couldn’t find certain files below /opt/bitwarden/bwdata, which should have been /home/myusername/bwdata in my old installation. I guess those must have been hard-coded? So following the creation of the bitwarden user + dedicated folders must have solved it.
(2) As I was required to sudo many times, I just did sudo su and went on with installation, changing configurations and adding scripts for self-maintenance. This I think probably messed with ownership on certain containers, files etc.