Initial setup failed on RasPi3B+ due to a Java - Zulu path error

Tags: #<Tag:0x00007f74531dfb40>
  • Platform information:
  • Issue of the topic: After flashing the new micro sd card with the latest image downloaded today, the initial setup on a RaspberryPI 3B+ failed during installation of the embedded Zulu OpenJDK. Most likely due to a path error?
    I tried to do the setup again, with no effect. Since I am new to openhab, is there anything I could do better? I found several installation issues in this community but none with the error below.

I would appreciate any advice! Thank you so much in advance!

the complete installation log is as follows (first-boot.log):
2018-03-13_22:53:35_UTC [openHABian] Starting the openHABian initial setup.
2018-03-13_22:53:35_UTC [openHABian] Storing configuration… OK
2018-03-13_22:53:35_UTC [openHABian] Changing default username and password… OK
2018-03-13_22:53:36_UTC [openHABian] Setting up Ethernet connection… OK
2018-03-13_22:53:36_UTC [openHABian] Ensuring network connectivity… OK
2018-03-13_22:53:38_UTC [openHABian] Waiting for dpkg/apt to get ready… OK
2018-03-13_22:53:52_UTC [openHABian] Updating repositories and upgrading installed packages… OK
2019-03-20_15:24:46_UTC [openHABian] Installing git package… OK
2019-03-20_15:25:18_UTC [openHABian] Cloning myself… OK
2019-03-20_15:25:20_UTC [openHABian] Executing ‘openhabian-setup.sh unattended’…
2019-03-20_15:25:20_UTC [openHABian] Checking for root privileges… OK
2019-03-20_15:25:20_UTC [openHABian] Loading configuration file ‘/etc/openhabian.conf’… OK
2019-03-20_15:25:20_UTC [openHABian] Setting timezone based on IP geolocation… OK (Europe/Berlin)
2019-03-20_16:26:28_CET [openHABian] Setting locale based on openhabian.conf… OK
2019-03-20_16:26:53_CET [openHABian] Setting hostname of the base system… OK
2019-03-20_16:26:53_CET [openHABian] Setting the GPU memory split down to 16MB for headless system… OK
2019-03-20_16:26:53_CET [openHABian] Enabling Audio output… OK
2019-03-20_16:26:53_CET [openHABian] Installing basic can’t-be-wrong packages (screen, vim, …)… OK
2019-03-20_16:27:44_CET [openHABian] Installing additional needed packages… OK
2019-03-20_16:27:57_CET [openHABian] Installing additional bluetooth packages… OK
2019-03-20_16:28:02_CET [openHABian] Adding slightly tuned bash config files to system… OK
2019-03-20_16:28:02_CET [openHABian] Adding slightly tuned vim config file to system… OK
2019-03-20_16:28:02_CET [openHABian] Downloading and setting up FireMotD… OK
2019-03-20_16:28:26_CET [openHABian] Installing Zulu Embedded OpenJDK… FAILED
rm: cannot remove ‘exit’: No such file or directory
rm: cannot remove ‘1’: No such file or directory
mv: cannot stat ‘/var/tmp/jdk-new/*’: No such file or directory
FAILED
2019-03-20_16:28:27_CET [openHABian] Initial setup exiting with an error!

2019-03-20_16:42:17_CET [openHABian] Starting the openHABian initial setup.
2019-03-20_16:42:17_CET [openHABian] Storing configuration… OK
2019-03-20_16:42:17_CET [openHABian] Changing default username and password… SKIPPED
2019-03-20_16:42:17_CET [openHABian] Setting up Ethernet connection… OK
2019-03-20_16:42:17_CET [openHABian] Ensuring network connectivity… OK
2019-03-20_16:42:21_CET [openHABian] Waiting for dpkg/apt to get ready… OK
2019-03-20_16:42:28_CET [openHABian] Updating repositories and upgrading installed packages… OK
2019-03-20_16:42:35_CET [openHABian] Installing git package… OK
2019-03-20_16:42:43_CET [openHABian] Cloning myself… FAILED
2019-03-20_16:42:43_CET [openHABian] Initial setup exiting with an error!

Hi @Werner_12, sorry to hear you’re having trouble, I’d like to narrow down exactly where you’re getting the issue.

Are you able to connect to http://cdn.azul.com/zulu-embedded/bin/zulu8.36.0.152-ca-jdk1.8.0_202-linux_aarch32hf.tar.gz?

If you are, would you be able to try again but edit first-boot.sh on the SD card first so that:

Comment the line:

if (/bin/bash /opt/openhabian/openhabian-setup.sh unattended); then

and then uncomment the line:

#if (/bin/bash /opt/openhabian/openhabian-setup.sh unattended_debug); then

If it fails, could you copy and paste the results of the log again, starting from “Installing Zulu Embedded OpenJDK” and finishing on FAILED.

Note to self: We should make this debugging process easier to start.

Hi Benjy,

thank you for your response and your suggestions!
Indeed I could connect to http://cdn.azul.com/zulu-embedded/bin/zulu8.36.0.152-ca-jdk1.8.0_202-linux_aarch32hf.tar.gz

Therefore, I have flashed the sd card again and made the changes to the first-boot.sh as you requested. The installation of Java seems to be successful this time. Could have been a temporary network issue?

Nevertheless, there is some strange behaviour at the very end of the installation: openhab is starting and stopping within an endless cycle. I stopped that after about 10 Minutes. Did you ever experience a similar behaviour?

Thanks again for all your help!

Werner

#######################################
–> log-snippet-1:
#######################################
e[90;01m$ tar -xpzf /var/tmp/.zulu.15438 -C /var/tmp/jdk-new e[39;49;00m

e[90;01m$ update-alternatives --remove-all java e[39;49;00m
update-alternatives: error: no alternatives for java

e[90;01m$ update-alternatives --remove-all javac e[39;49;00m
update-alternatives: error: no alternatives for javac

e[90;01m$ update-alternatives --install /usr/bin/java java /opt/jdk/zulu8.36.0.152-ca-jdk1.8.0_202-linux_aarch32hf/bin/java 1083000 e[39;49;00m
update-alternatives: using /opt/jdk/zulu8.36.0.152-ca-jdk1.8.0_202-linux_aarch32hf/bin/java to provide /usr/bin/java (java) in auto mode

e[90;01m$ update-alternatives --install /usr/bin/javac javac /opt/jdk/zulu8.36.0.152-ca-jdk1.8.0_202-linux_aarch32hf/bin/javac 1083000 e[39;49;00m
update-alternatives: using /opt/jdk/zulu8.36.0.152-ca-jdk1.8.0_202-linux_aarch32hf/bin/javac to provide /usr/bin/javac (javac) in auto mode
OK

e[90;01m$ systemctl start openhab2.service e[39;49;00m
Failed to start openhab2.service: Unit openhab2.service not found.

e[90;01m$ apt -y install apt-transport-https e[39;49;00m

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

#######################################
–> log-snippet-2:
#######################################
2019-03-20 20:57:43 (5.47 MB/s) - ‘/tmp/nodejs-arm.tar.gz’ saved [17398229/17398229]

e[90;01m$ tar -zxf /tmp/nodejs-arm.tar.gz --strip-components=1 -C /usr e[39;49;00m

e[90;01m$ rm /tmp/nodejs-arm.tar.gz e[39;49;00m
OK
2019-03-20_20:57:46_CET [openHABian] Installing the openHAB Log Viewer (frontail)…
e[90;01m$ npm install -g frontail e[39;49;00m
/usr/bin/frontail -> /usr/lib/node_modules/frontail/bin/frontail

  • frontail@4.5.4
    added 146 packages from 117 contributors in 16.089s

e[90;01m$ npm update -g frontail e[39;49;00m

e[90;01m$ systemctl daemon-reload e[39;49;00m

e[90;01m$ systemctl enable frontail.service e[39;49;00m
Created symlink /etc/systemd/system/multi-user.target.wants/frontail.service → /etc/systemd/system/frontail.service.

e[90;01m$ systemctl restart frontail.service e[39;49;00m
OK
2019-03-20_20:58:13_CET [openHABian] Adding an openHAB dashboard tile for ‘frontail’… OK
2019-03-20_20:58:14_CET [openHABian] Execution of ‘openhabian-setup.sh unattended’ completed.
2019-03-20_20:58:14_CET [openHABian] Waiting for openHAB to become ready…

Hi all,

seems, that my issue starting and stopping in endless cycle is identical to the error mentioned here: Infinite loop on clean install

Werner

Solved!

The issues described above do not longer occur. Thanks for the great support !!

Werner

1 Like

Hi all,

I just stumbled upon the same problem and followed @Benjy advice and uncommented the line
#if (/bin/bash /opt/openhabian/openhabian-setup.sh unattended_debug); then

I received the following results from the log file:

$ wget -nv -O /tmp/openhabian.3OSoK/zulu8.tar.gz
http://: Invalid host name.

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
FAILED
2019-10-17_22:00:43_CEST [openHABian] Initial setup exiting with an error!

My setup: Raspberry 2b with the latest version of openHABian (v1.5).

Any suggestions on how to proceed would be appreciated.

Best 4flixt

3 Likes

I have a workaround:
1: when install fails, open /opt/openhabian/functions/java-jre.bash

change the middle line. this will skip the java selection

 # Fetch and copy new JAVA runtime
  cond_redirect wget -nv -O "$jdkTempLocation"/zulu8.tar.gz https://cdn.azul.com/zulu-embedded/bin/zulu8.40.0.178-ca-jdk1.8.0_222-linux_aarch32hf.tar.gz
  tar -xpzf "$jdkTempLocation"/zulu8.tar.gz -C "${jdkTempLocation}"

2: open /boot/first-boot.bash
and comment these 3 lines. this wil prevent the previous file from being overwritten

# echo -n "$(timestamp) [openHABian] Cloning myself... "
# [ -d /opt/openhabian/ ] && rm -rf /opt/openhabian/ # check if we have remnants of a previous installation attempt.
# git clone -b master https://github.com/openhab/openhabian.git /opt/openhabian &>/dev/null

I had to reboot twice, the first time even if completed, openhab did not start.
second was fine

10 Likes

Dear @4est,
thank you for the suggestion. Where and when exactly do I change these lines?

Best, 4flixt

well, it’s written in the how to.

just edit those files

I guess there is no opt folder when you try to auto install openhabian with the sd card …
at least there is none for me …
i can see the first-boot.bash in the root of my sd card after creating the image but i think your solution does only work for upgrading java on a system that’s already set up. correct me if i am wrong.

/opt/openhabian is created when “Cloning myself” starts
That is before install fails because of the java

I did a fresh install with a openhabian sdcard

i will try again.
EDIT: My mac and my pc both do only see the “boot” volume. I’ll try flashing again …
EditEdit: Okay, waste of time. I do only see the boot partition and the only folder inside there is “overlays”.

2019-07-10_01:21:35_BST [openHABian] Starting the openHABian initial setup.
2019-07-10_01:21:35_BST [openHABian] Storing configuration... OK
2019-07-10_01:21:35_BST [openHABian] Starting webserver with installation log... OK
2019-07-10_01:21:42_BST [openHABian] Changing default username and password... OK
2019-10-18_17:24:32_BST [openHABian] Setting up Ethernet connection... OK
2019-10-18_17:24:32_BST [openHABian] Ensuring network connectivity... OK
2019-10-18_17:24:32_BST [openHABian] Waiting for dpkg/apt to get ready... OK
2019-10-18_17:24:59_BST [openHABian] Updating repositories and upgrading installed packages... OK
2019-10-18_17:29:47_BST [openHABian] Installing git package... OK
2019-10-18_17:30:07_BST [openHABian] Cloning myself... OK
2019-10-18_17:30:10_BST [openHABian] Executing 'openhabian-setup.sh unattended'... 
2019-10-18_17:30:10_BST [openHABian] Checking for root privileges... OK
Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease
Hit:2 http://archive.raspberrypi.org/debian buster InRelease
Reading package lists...
2019-10-18_17:30:16_BST [openHABian] Loading configuration file '/etc/openhabian.conf'... OK
2019-10-18_17:30:16_BST [openHABian] Setting timezone based on IP geolocation... OK (Europe/Berlin)
2019-10-18_18:31:18_CEST [openHABian] Setting locale based on openhabian.conf... OK
2019-10-18_18:32:45_CEST [openHABian] Setting hostname of the base system... OK
2019-10-18_18:32:46_CEST [openHABian] Setting the GPU memory split down to 16MB for headless system... OK
2019-10-18_18:32:46_CEST [openHABian] Enabling Audio output... OK
2019-10-18_18:32:46_CEST [openHABian] Installing basic can't-be-wrong packages (screen, vim, ...)... OK
2019-10-18_18:33:36_CEST [openHABian] Installing additional needed packages... OK
2019-10-18_18:33:58_CEST [openHABian] Installing additional bluetooth packages... OK
2019-10-18_18:34:05_CEST [openHABian] Adding slightly tuned bash config files to system... OK
2019-10-18_18:34:05_CEST [openHABian] Adding slightly tuned vim config file to system... OK
2019-10-18_18:34:05_CEST [openHABian] Downloading and setting up FireMotD... 

After the installation got stuck i cut the power to the raspberry and put the sd card into a reader because i was not able to connect via samba yet (or is this the only way i can see the opt folder?)
i am stuck here …

1 Like

Stick the SD card back in, boot and use putty to SSH into you raspi.
Then type:
sudo nano /opt/openhabian/functions/java-jre.bash
Comment the line under # Fetch and copy new JAVA runtime
and paste the line cond_redirect wget -nv -O "$jdkTempLocation"/zulu8.tar.gz https://cdn.azul.com/zulu-embedded/bin/zulu8.40.0.178-ca-jdk1.8.0_222-linux_aarch32hf.tar.gz
(Or simply replace it).
Press CTRL+X, Y to save

Then sudo nano /boot/first-boot.bash
Comment the lines as @4est explained
CTRL+X, Y to save

then to restart the first boot script:
sudo bash /boot/first-boot.bash

I’m currently running it, will update when done

2 Likes

`Seems to be working:
2019-10-18_20:45:42_CEST [openHABian] Downloading and setting up FireMotD… OK
openjdk version “1.8.0_222”
OpenJDK Runtime Environment (Zulu8.40.0.178-CA-linux_aarch32hf) (build 1.8.0_222-b178)
OpenJDK Client VM (Zulu8.40.0.178-CA-linux_aarch32hf) (build 25.222-b178, mixed mode, Evaluation)
openjdk version “1.8.0_222”
OpenJDK Runtime Environment (Zulu8.40.0.178-CA-linux_aarch32hf) (build 1.8.0_222-b178)
OpenJDK Client VM (Zulu8.40.0.178-CA-linux_aarch32hf) (build 25.222-b178, mixed mode, Evaluation)
2019-10-18_20:46:57_CEST [openHABian] Installing Java Zulu 32-Bit OpenJDK… OK
2019-10-18_20:47:58_CEST [openHABian] Installing or upgrading to latest openHAB release (stable)… OK
2019-10-18_20:48:45_CEST [openHABian] Adding an openHAB dashboard tile for ‘openhabiandocs’… OK
2019-10-18_20:48:46_CEST [openHABian] Adding openHAB syntax to vim editor… OK
2019-10-18_20:48:46_CEST [openHABian] Adding openHAB syntax to nano editor… OK
2019-10-18_20:48:47_CEST [openHABian] Adding openHAB scheme to multitail… OK
2019-10-18_20:48:47_CEST [openHABian] Preparing openHAB folder mounts under /srv/… OK
2019-10-18_20:48:47_CEST [openHABian] Applying file permissions recommendations… OK
2019-10-18_20:48:50_CEST [openHABian] Applying miscellaneous system settings… OK
2019-10-18_20:48:50_CEST [openHABian] Setting up Samba network shares… OK
2019-10-18_20:49:59_CEST [openHABian] Installing Node.js for arm (prerequisite for other packages)… OK
2019-10-18_20:50:07_CEST [openHABian] Installing the openHAB Log Viewer (frontail)… OK
2019-10-18_20:50:37_CEST [openHABian] Adding an openHAB dashboard tile for ‘frontail’… OK
2019-10-18_20:50:38_CEST [openHABian] Execution of ‘openhabian-setup.sh unattended’ completed.
2019-10-18_20:50:38_CEST [openHABian] Waiting for openHAB to become ready…1…2…3…4…OK
2019-10-18_20:51:18_CEST [openHABian] Visit the openHAB dashboard now: http://big_openhab:8080
2019-10-18_20:51:18_CEST [openHABian] To gain access to a console, simply reconnect.
2019-10-18_20:51:18_CEST [openHABian] First time setup successfully finished.

1 Like

Works like a charm, thanks!

2 Likes

well, it took me a while to figure out where to apply the fix, but in the end it’s an easy workaround and this way openhab installs can continue until the developers implement the new zulu java api

happy to help you and thanks for explaining the fix for everyone to understand (you missed creating the ssh file on the sdcard to enable ssh though)

1 Like

thanks it worked.
forgot that i also have to use the ssh command in the terminal when connecting to the raspberry. tried with smb and obviously it did not work.

Hey all, thank you again @4est! Everything worked now for me.
What really confused me was that I couldn’t see any files or folders on my raspberry (while beeing connected via ssh).
So it seemed like there was no /opt/openhabian/functions/java-jre.bashfile.
But as @TomP said typing sudo nano /opt/openhabian/functions/java-jre.bash opened the file and I was able to make the changes.
After a reboot (sudo reboot) the first-boot routine started again and everything finished succesfully on the first try.

Thanks all for you help!

new solution after error
enter in sudo nano /opt/openhabian/functions/java-jre.bash instert the line after filter like this

| jq -r "$filter"`

downloadlink=“https://cdn.azul.com/zulu-embedded/bin/zulu8.40.0.178-ca-jdk1.8.0_222-linux_aarch32hf.tar.gz
if [ -z “$downloadlink” ]; then return 1; fi

Worked like a charm @4est , many thanks!!

1 Like