Bitwarden On-Premise not Starting after recent reboot of server

Following is the error:

ERROR: The Compose file is invalid because: Service portal has neither an image nor a build context specified. At least one must be provided.

Following is my bitwarden.sh file:

#!/usr/bin/env bash
set -e

cat << “EOF”


| |__ () |__ ____ _ _ __ _| | ___ _ __
| ’
| | \ \ /\ / / | '__/ _ |/ _ \ ’ \
| |) | | | \ V V / (| | | | (| | / | | |
|_.
/||_| _/_/ _,|| _,_|_
|| ||

EOF

cat << EOF
Open source password management solutions
Copyright 2015-$(date +‘%Y’), 8bit Solutions LLC
https://bitwarden.com, Bitwarden · GitHub

===================================================

EOF

Setup

DIR=“$( cd “$( dirname “${BASH_SOURCE[0]}” )” && pwd )”
SCRIPT_NAME=basename "$0"
SCRIPT_PATH=“$DIR/$SCRIPT_NAME”
OUTPUT=“$DIR/bwdata”
if [ $# -eq 2 ]
then
OUTPUT=$2
fi

SCRIPTS_DIR=“$OUTPUT/scripts”
GITHUB_BASE_URL=“https://raw.githubusercontent.com/bitwarden/server/master

Please do not create pull requests modifying the version numbers.

COREVERSION=“1.44.0”
WEBVERSION=“2.24.0”

echo “bitwarden.sh version $COREVERSION”
docker --version
docker-compose --version

echo “”

Functions

function downloadSelf() {
if curl -s -w “http_code %{http_code}” -o $SCRIPT_PATH.1 $GITHUB_BASE_URL/scripts/bitwarden.sh | grep -q “^http_code 20[0-9]”
then
mv $SCRIPT_PATH.1 $SCRIPT_PATH
chmod u+x $SCRIPT_PATH
else
rm -f $SCRIPT_PATH.1
fi
}

function downloadRunFile() {
if [ ! -d “$SCRIPTS_DIR” ]
then
mkdir $SCRIPTS_DIR
fi
curl -s -o $SCRIPTS_DIR/run.sh $GITHUB_BASE_URL/scripts/run.sh
chmod u+x $SCRIPTS_DIR/run.sh
rm -f $SCRIPTS_DIR/install.sh
}

function checkOutputDirExists() {
if [ ! -d “$OUTPUT” ]
then
echo “Cannot find a Bitwarden installation at $OUTPUT.”
exit 1
fi
}

function checkOutputDirNotExists() {
if [ -d “$OUTPUT/docker” ]
then
echo “Looks like Bitwarden is already installed at $OUTPUT.”
exit 1
fi
}

function listCommands() {
cat << EOT
Available commands:

install
start
restart
stop
update
updatedb
updaterun
updateself
updateconf
renewcert
rebuild
help

See more at Install and Deploy - Linux | Bitwarden Help Center

EOT
}

Commands

case $1 in
“install”)
checkOutputDirNotExists
mkdir -p $OUTPUT
downloadRunFile
$SCRIPTS_DIR/run.sh install $OUTPUT $COREVERSION $WEBVERSION
;;
“start” | “restart”)
checkOutputDirExists
$SCRIPTS_DIR/run.sh restart $OUTPUT $COREVERSION $WEBVERSION
;;
“update”)
checkOutputDirExists
downloadRunFile
$SCRIPTS_DIR/run.sh update $OUTPUT $COREVERSION $WEBVERSION
;;
“rebuild”)
checkOutputDirExists
$SCRIPTS_DIR/run.sh rebuild $OUTPUT $COREVERSION $WEBVERSION
;;
“updateconf”)
checkOutputDirExists
$SCRIPTS_DIR/run.sh updateconf $OUTPUT $COREVERSION $WEBVERSION
;;
“updatedb”)
checkOutputDirExists
$SCRIPTS_DIR/run.sh updatedb $OUTPUT $COREVERSION $WEBVERSION
;;
“stop”)
checkOutputDirExists
$SCRIPTS_DIR/run.sh stop $OUTPUT $COREVERSION $WEBVERSION
;;
“renewcert”)
checkOutputDirExists
$SCRIPTS_DIR/run.sh renewcert $OUTPUT $COREVERSION $WEBVERSION
;;
“updaterun”)
checkOutputDirExists
downloadRunFile
;;
“updateself”)
downloadSelf && echo “Updated self.” && exit
;;
“help”)
listCommands
;;
*)
echo “No command found.”
echo
listCommands
esac

@ghaisasadvait Version 1.44.0 has not been released yet for self-hosted users, I would advice downgrading to the latest versions from bitwarden.sh, server/bitwarden.sh at master · bitwarden/server · GitHub. (Might require a database restore, depending on if the migrations has run)

The issue is most likely the removal of the business portal, and we are looking into if we need to make adjustments to our scripts to handle this.

Edit: My machine upgraded fine from 1.43.0 to 1.44.0, so I don’t think we need to adjust the scripts after all.

Which version would you suggest to downgrade?

@ghaisasadvait The still official self-hosted version:
COREVERSION=“1.43.0”
WEBVERSION=“2.23.0”

@djsmith85 @Hinton

I tried using the following version, yet im getting the same error.

Sounds like the docker-compose file is invalid. Did you run ./bitwarden.sh update after modifying the script? Otherwise it won’t re-run the setup wizard to re-build the docker-compose files.

I also tested upgrading from 1.43.0 to 1.44.0 using ./bitwarden.sh update and everything started correctly.

Edit: Could you give some more details to what you were doing since the script doesn’t match what’s available when running updateself? A server restart wouldn’t edit the versions.

1 Like

@Hinton

Yes, this error is coming when im running ‘update’ as well as ‘start’ . The ‘updateself’ command is working perfectly.

The error started coming when I manually edited the server version from ‘1.43.1’ to ‘1.44.0’ in the ‘bitwarden.sh’ file and ran the update.

Here is my docker compose file:

Useful references:

Compose file | Docker Documentation

Redirecting…

Compose CLI environment variables | Docker Documentation

#########################################################################

WARNING: This file is generated. Do not make changes to this file.

They will be overwritten on update. If you want to make additions to

this file, you can create a docker-compose.override.yml file in the

same directory and it will be merged into this file at runtime. You

can also manage various settings used in this file from the

./bwdata/config.yml file for your installation.

#########################################################################

version: ‘3’

services:
mssql:
image: bitwarden/mssql:1.44.0
container_name: bitwarden-mssql
restart: always
stop_grace_period: 60s
volumes:
- …/mssql/data:/var/opt/mssql/data
- …/logs/mssql:/var/opt/mssql/log
- …/mssql/backups:/etc/bitwarden/mssql/backups
env_file:
- mssql.env
- …/env/uid.env
- …/env/mssql.override.env

web:
image: bitwarden/web:2.24.0
container_name: bitwarden-web
restart: always
volumes:
- …/web:/etc/bitwarden/web
env_file:
- global.env
- …/env/uid.env

attachments:
image: bitwarden/attachments:1.44.0
container_name: bitwarden-attachments
restart: always
volumes:
- …/core/attachments:/etc/bitwarden/core/attachments
env_file:
- global.env
- …/env/uid.env

api:
image: bitwarden/api:1.44.0
container_name: bitwarden-api
restart: always
volumes:
- …/core:/etc/bitwarden/core
- …/ca-certificates:/etc/bitwarden/ca-certificates
- …/logs/api:/etc/bitwarden/logs
env_file:
- global.env
- …/env/uid.env
- …/env/global.override.env
networks:
- default
- public

identity:
image: bitwarden/identity:1.44.0
container_name: bitwarden-identity
restart: always
volumes:
- …/identity:/etc/bitwarden/identity
- …/core:/etc/bitwarden/core
- …/ca-certificates:/etc/bitwarden/ca-certificates
- …/logs/identity:/etc/bitwarden/logs
env_file:
- global.env
- …/env/uid.env
- …/env/global.override.env
networks:
- default
- public

sso:
image: bitwarden/sso:1.44.0
container_name: bitwarden-sso
restart: always
volumes:
- …/identity:/etc/bitwarden/identity
- …/core:/etc/bitwarden/core
- …/ca-certificates:/etc/bitwarden/ca-certificates
- …/logs/sso:/etc/bitwarden/logs
env_file:
- global.env
- …/env/uid.env
- …/env/global.override.env
networks:
- default
- public

admin:
image: bitwarden/admin:1.44.0
container_name: bitwarden-admin
restart: always
depends_on:
- mssql
volumes:
- …/core:/etc/bitwarden/core
- …/ca-certificates:/etc/bitwarden/ca-certificates
- …/logs/admin:/etc/bitwarden/logs
env_file:
- global.env
- …/env/uid.env
- …/env/global.override.env
networks:
- default
- public

icons:
image: bitwarden/icons:1.44.0
container_name: bitwarden-icons
restart: always
volumes:
- …/ca-certificates:/etc/bitwarden/ca-certificates
- …/logs/icons:/etc/bitwarden/logs
env_file:
- global.env
- …/env/uid.env
networks:
- default
- public

notifications:
image: bitwarden/notifications:1.44.0
container_name: bitwarden-notifications
restart: always
volumes:
- …/ca-certificates:/etc/bitwarden/ca-certificates
- …/logs/notifications:/etc/bitwarden/logs
env_file:
- global.env
- …/env/uid.env
- …/env/global.override.env
networks:
- default
- public

events:
image: bitwarden/events:1.44.0
container_name: bitwarden-events
restart: always
volumes:
- …/ca-certificates:/etc/bitwarden/ca-certificates
- …/logs/events:/etc/bitwarden/logs
env_file:
- global.env
- …/env/uid.env
- …/env/global.override.env
networks:
- default
- public

nginx:
image: bitwarden/nginx:1.44.0
container_name: bitwarden-nginx
restart: always
depends_on:
- web
- admin
- api
- identity
ports:
- ‘80:8080’
- ‘443:8443’
volumes:
- …/nginx:/etc/bitwarden/nginx
- …/letsencrypt:/etc/letsencrypt
- …/ssl:/etc/ssl
- …/logs/nginx:/var/log/nginx
env_file:
- …/env/uid.env
networks:
- default
- public

networks:
default:
internal: true
public:
internal: false

I ran the updateself command and now the server/core version is ‘1.43.0’ and still im facing the issue now.

@Hinton @djsmith85

I ran the rebuild command using earlier version and it seems that the rebuild worked and the server is up now. It would be great if you could shed some light on why this issue occurred when I used the latest Server/Core Version.
I also noticed that some of bitwarden’s earlier builds are not directly published to on-premise users. So if that’s the case here, is there a way to find out whether the build is allowed on self hosted users so that I won’t manually download those builds. The whole point is that since the actual ‘updateself’ command has builds which are 1 or 2 builds earlier than the latest one and hence I the manual updation.

@ghaisasadvait Good to hear the issue resolved itself. We don’t recommend manually editing the versions in the bitwarden.sh scripts, and instead use the selfupdate. As for versions lagging behind, 1.43.1 contained bugfixes only for the cloud version, and 1.44 was just released and will be pushed to bitwarden.sh in a couple of days.

As for why it didn’t work, I’m not sure, when I ran update it successfully ran the setup instance which rebuilt my docker-container.yml file.

1 Like

@Hinton
Oh okay.

Thanks for helping me out!

1 Like