Unable to create account on self.hosted BW


#1

I just installed the Bitwarden Software (version 1.22) on my Docker (running on Synology) and I’m able to access the start page. Next I want to create a new user and get the details page, but when hitting the create button I get a failure.

Any idea where the error might be?

2018-08-21 12:00:07.540 +00:00 [Error] Cannot open database "vault" requested by the login. The login failed.
Login failed for user 'sa'.
System.Data.SqlClient.SqlException (0x80131904): Cannot open database "vault" requested by the login. 
The login failed.
Login failed for user 'sa'.
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, 
SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.WaitForPendingOpen()
--- End of stack trace from previous location where exception was thrown --- 
at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in C:\projects\dapper\Dapper\SqlMapper.Async.cs:line 419
at Bit.Core.Repositories.SqlServer.UserRepository.GetByEmailAsync(String email) in /Users/kyle/Projects/bitwarden/core/src/Core/Repositories/SqlServer/UserRepository.cs:line 31
at Bit.Core.Identity.UserStore.FindByEmailAsync(String normalizedEmail, CancellationToken cancellationToken) in /Users/kyle/Projects/bitwarden/core/src/Core/Identity/UserStore.cs:line 49
at Bit.Core.Identity.UserStore.FindByNameAsync(String normalizedUserName, CancellationToken cancellationToken) in /Users/kyle/Projects/bitwarden/core/src/Core/Identity/UserStore.cs:line 73
at Microsoft.AspNetCore.Identity.UserManager`1.FindByNameAsync(String userName)
at Microsoft.AspNetCore.Identity.UserValidator`1.ValidateUserName(UserManager`1 manager, TUser user, ICollection`1 errors)
at Microsoft.AspNetCore.Identity.UserValidator`1.ValidateAsync(UserManager`1 manager, TUser user)
at Microsoft.AspNetCore.Identity.UserManager`1.ValidateUserAsync(TUser user)
at Microsoft.AspNetCore.Identity.UserManager`1.CreateAsync(TUser user)
at Microsoft.AspNetCore.Identity.UserManager`1.CreateAsync(TUser user, String password)
at Bit.Core.Services.UserService.RegisterUserAsync(User user, String masterPassword, String token, Nullable`1 orgUserId) in /Users/kyle/Projects/bitwarden/core/src/Core/Services/Implementations/UserService.cs:line 227
at Bit.Api.Controllers.AccountsController.PostRegister(RegisterRequestModel model) in /Users/kyle/Projects/bitwarden/core/src/Api/Controllers/AccountsController.cs:line 46
at lambda_method(Closure , Object )
at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at System.Threading.Tasks.ValueTask`1.get_Result()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()
ClientConnectionId:8fbc3d0e-30ae-4258-bdaf-7a4751a5da98
Error Number:4060,State:1,Class:11

#2

Sounds like something went wrong and it is using some incorrect credentials to try to connect to the database. I would suggest deleting bwdata and reinstalling again.


#3

Hi,

as it’s a brand new installation and I’m not loosing anything I deleted already the bwdata folder

rm -r ./bwdata

and installed it again. Also I deleted the existing mssql docker image to get it downloaded again.
As I can access the site I guess it not related to my reverse proxy settings? (I’m using an own reverse proxy which forwards all my https request based on the sub-domain to a specific port on my docker machine.)

/Michel


#4

What is the host OS?


#5

I’m using Synology Docker DSM 6.2 with Docker version 17.05.0-ce, build 9f07f0e-synology


#6

Just an update. I really want to start using Bitwarden self-hosted. So I installed Ubuntu 18.04.1 LTS as a VM on my Synology. Next I installed Docker, Docker-Compose for Ubuntu. The installation of bitwarden also completed successfully as before and I’m able to access the entry-site of bitwarden. When creating a new user I’m still getting this error as shown above.
So, it’s not related to the Synology host or docker version as the same error also occurs in a clean ubuntu installation.

Did someone recently installed the latest bitwarden version from scretch? Maybe it’s a general problem?

Regards,
Michel


#7

Weird. I would think we would have other people reporting this as an issue if that is the case. I will have to try a clean install again and see if I see anything.


#8

I tried the docker install on Fedora28 from fresh and I am not able to create the first account from “Create Account” button.

[[email protected] logs]# head -40 /root/bwdata/logs/api/Api/20180827.txt
2018-08-27 17:28:23.700 +00:00 [Error] Cannot open database “vault” requested by the login. The login failed.
Login failed for user ‘sa’.
System.Data.SqlClient.SqlException (0x80131904): Cannot open database “vault” requested by the login. The login failed.
Login failed for user ‘sa’.
at System.Data.SqlClient.SqlInternalConnectionTds…ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.WaitForPendingOpen()
— End of stack trace from previous location where exception was thrown —
at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in C:\projects\dapper\Dapper\SqlMapper.Async.cs:line 419
at Bit.Core.Repositories.SqlServer.UserRepository.GetByEmailAsync(String email) in /Users/kyle/Projects/bitwarden/core/src/Core/Repositories/SqlServer/UserRepository.cs:line 31
at Bit.Core.Identity.UserStore.FindByEmailAsync(String normalizedEmail, CancellationToken cancellationToken) in /Users/kyle/Projects/bitwarden/core/src/Core/Identity/UserStore.cs:line 49
at Bit.Core.Identity.UserStore.FindByNameAsync(String normalizedUserName, CancellationToken cancellationToken) in /Users/kyle/Projects/bitwarden/core/src/Core/Identity/UserStore.cs:line 73
at Microsoft.AspNetCore.Identity.UserManager1.FindByNameAsync(String userName) at Microsoft.AspNetCore.Identity.UserValidator1.ValidateUserName(UserManager1 manager, TUser user, ICollection1 errors)
at Microsoft.AspNetCore.Identity.UserValidator1.ValidateAsync(UserManager1 manager, TUser user)
at Microsoft.AspNetCore.Identity.UserManager1.ValidateUserAsync(TUser user) at Microsoft.AspNetCore.Identity.UserManager1.CreateAsync(TUser user)
at Microsoft.AspNetCore.Identity.UserManager1.CreateAsync(TUser user, String password) at Bit.Core.Services.UserService.RegisterUserAsync(User user, String masterPassword, String token, Nullable1 orgUserId) in /Users/kyle/Projects/bitwarden/core/src/Core/Services/Implementations/UserService.cs:line 227
at Bit.Api.Controllers.AccountsController.PostRegister(RegisterRequestModel model) in /Users/kyle/Projects/bitwarden/core/src/Api/Controllers/AccountsController.cs:line 46
at lambda_method(Closure , Object )
at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at System.Threading.Tasks.ValueTask`1.get_Result()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()
ClientConnectionId:76c30661-d300-4588-b12b-8ec8635395e9
Error Number:4060,State:1,Class:11
2018-08-27 17:37:37.260 +00:00 [Error] Cannot open database “vault” requested by the login. The login failed.
Login failed for user ‘sa’.
System.Data.SqlClient.SqlException (0x80131904): Cannot open database “vault” requested by the login. The login failed.
Login failed for user ‘sa’.
[[email protected] logs]#


#9
  • here is the dokcer ps output screenshot.

  • Create account popup error panel

image


#10

Try a fresh installation again, except this time restart docker and delete existing images on the server. For example:

docker rmi $(docker images -q) -f

#11

For me it’s still the same error. Maybe I did something wrong?

  • ./bitwarden install and enter settings
  • delete all docker images from bitwarden and
  • ./bitwarden start --> docker images were downloaded again
  • still getting the same error

#12

I’m not sure. I just did a fresh installation myself and cannot reproduce.


#13

I documented my step-by-step installation notes using google doc at

“commenting” is opened for everyone.

I am still getting same error like @Michel_Munzert.

Also start up has one warning and one error messages
See https://docs.google.com/document/d/1uYJyWP7Y5tBmr_80TQhyNQ5qfBgbTBUgzmId0_lqyd4/edit#heading=h.uvi5j2dyij


#14

ONe thing I noticed is that your docker version shows 1.13. On my Ubuntu and macOS machines I have 18.06.0 with docker -v.


#15
  • Thanks for pointing out docker version issue. I switched over to use docker-ce.
    But I am still getting same issue of not able to create first admin user following is the same same error message.

[[email protected] logs]# head api/Api/20180828.txt
2018-08-28 15:05:42.198 +00:00 [Error] Cannot open database “vault” requested by the login. The login failed.
Login failed for user ‘sa’.
System.Data.SqlClient.SqlException (0x80131904): Cannot open database “vault” requested by the login. The login failed.
Login failed for user ‘sa’.
at System.Data.SqlClient.SqlInternalConnectionTds…ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
[[email protected] logs]#

  • Is it possible to make the package create the default admin user with password ?

#16

Finally, following commands were able to allow me to create first admin account.

./bitwarden.sh stop
./bitwarden.sh updateself
./bitwarden.sh update
./bitwarden.sh start 

#17

Seems you forgot the updatedb command during install?


#18

Hi,
for me it also worked out when doing the ./bitwarden.sh updatedb command. Before I tried to create the user account after I did the ./bitwarden.sh install command right away.

So, this is solved for me :slight_smile:

Next problems occur when trying to access the domain from Bitwarden App. I’ll create a separate forum topic for this.

Cheers,
Michel


#19

@Michel_Munzert, I have same issue.
Posted it here Not able to connect to slef-hosted BW Server


#20

I updated Bitwarden a few weeks ago (no access to exact version numbers now) and since then I have issues logging in :frowning: The login page appears without a problem, but logging in simply times out… Weird thing is, sometimes it works, sometimes it doesn’t.

In the app I can still login locally, but adding entries from there fail as well with error “An unhandled server error has occured”