Hello,
I decided to install the last bitbucket version to my personal VM LAB running on virtualbox and a rockylinux 9.2
I installed without big issues bitbucket and can connect to the web interface on localhost:7990
Because I often turn off this lab and for best practice I decided to run bitbucket as a service as I already did for the Confluence and Jira already install on my VM.
So I created /usr/lib/systemd/system/bitbucket.service
Added this in my file (note that the path is a symbolic link)
[Unit]
Description=Atlassian Bitbucket Server Service
After=syslog.target network.target
[Service]
Type=forking
User=bitb
ExecStart=/opt/atlassian/bitbucket/bin/start-bitbucket.sh
ExecStop=/opt/atlassian/bitbucket/bin/stop-bitbucket.sh
[Install]
WantedBy=multi-user.target
did a systemctl daemon-reload after
systemctl start bitbucket.service gave me the result below
Job for bitbucket.service failed because the control process exited with error code.
See "systemctl status bitbucket.service" and "journalctl -xeu bitbucket.service" for details.
systemctl status bitbucket.service gave me this error
× bitbucket.service - Atlassian Bitbucket Server Service
Loaded: loaded (/usr/lib/systemd/system/bitbucket.service; enabled; preset: disabled)
Active: failed (Result: exit-code) since Wed 2023-08-30 11:53:53 CEST; 6s ago
Process: 5392 ExecStart=/opt/atlassian/bitbucket/bin/start-bitbucket.sh (code=exited, status=1/FAILURE)
CPU: 152ms
Aug 30 11:53:53 localhost.localdomain start-bitbucket.sh[5396]: --enable-preview
Aug 30 11:53:53 localhost.localdomain start-bitbucket.sh[5396]: allow classes to depend on preview features of this >
Aug 30 11:53:53 localhost.localdomain start-bitbucket.sh[5396]: To specify an argument for a long option, you can use --<name>=<value>>
Aug 30 11:53:53 localhost.localdomain start-bitbucket.sh[5396]: --<name> <value>.
Aug 30 11:53:53 localhost.localdomain start-bitbucket.sh[5392]: Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
Aug 30 11:53:53 localhost.localdomain start-bitbucket.sh[5392]: Edit set-jre-home.sh and define JRE_HOME
Aug 30 11:53:53 localhost.localdomain start-bitbucket.sh[5392]: Startup has been aborted
Aug 30 11:53:53 localhost.localdomain systemd[1]: bitbucket.service: Control process exited, code=exited, status=1/FAILURE
Aug 30 11:53:53 localhost.localdomain systemd[1]: bitbucket.service: Failed with result 'exit-code'.
Aug 30 11:53:53 localhost.localdomain systemd[1]: Failed to start Atlassian Bitbucket Server Service.
Despite having this line JRE_HOME= /usr/lib/jvm/jre-11-openjdk/bin/java
in the file /opt/atlassian/bitbucket/bin/set-jre-home.sh
I defined my JAVA_HOME variable in /etc/profile with thoses lines
export JAVA_HOME=/usr/lib/jvm/jre-11-openjdk
export PATH=$PATH:$JAVA_HOME/bin
echo $JAVA_HOME return this
/usr/lib/jvm/jre-11-openjdk
java --version return this
openjdk 11.0.19 2023-04-18 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.19.0.7-2) (build 11.0.19+7-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.19.0.7-2) (build 11.0.19+7-LTS, mixed mode, sharing)
But when I switch manually to my bitucket user "bitb" and run the starting script /opt/atlassian/bitbucket/bin/start-bitbucket.sh bitbucket will start normally
Which I don't undertstand as my service start the same script with the same user
I tried to
- reboot the VM
- check access right to directories is correct where owner is bitbucket user
- comment and uncomment the JRE_HOME variable in the set-jre-home.sh
- Modify JAVA_HOME variable and set it to bitbucket user profile
Since the error I get is from thoses line of the set-jre-home.sh script there I guess there is something to do around there
# Uncomment and edit the line below to define JRE_HOME.
# If you use the Bitbucket installer, this value will be automatically set to point to the bundled JRE.
# Once a value is set here, existing JRE_HOME and JAVA_HOME values set in the environment will be overridden and ignored.
JRE_HOME= /usr/lib/jvm/jre-11-openjdk/bin/java
# Otherwise, use an existing installed JDK defined by JAVA_HOME
if [ -z "$JRE_HOME" ]; then
if [ -n "$JAVA_HOME" ] && [ -x "$JAVA_HOME/jre/bin/java" ]; then
# If JAVA_HOME points to a valid JDK, use its JRE
JRE_HOME="$JAVA_HOME/jre"
elif [ -n "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then
# If JAVA_HOME appears to point to a JRE and not a JDK use this anyway
JRE_HOME="$JAVA_HOME"
fi
fi
# By this line, JRE_HOME should be defined
if [ -z "$JRE_HOME" ]; then
echo "Neither the JAVA_HOME nor the JRE_HOME environment variable is defined"
echo "Edit set-jre-home.sh and define JRE_HOME"
return 1
fi
In advance thanks for any help in this troubleshooting