Openhabian: Update to OH4 FAILED (fetching Java17)

Trying to upgrade to OH4 from 3.4 but failing. I’m running Openhabian and it fails via System Upgrade as well as via Install as via trying to install Java 17 via menu option 4* (whatever number that is).

Attempts via APT fails as well and attempts to manually install Java 17 w APT fails pointing at dependencies to ‘libc6’ >= 2.34, where I only have 2.28. Manual attempt at THAT package comes up empty.

Has something changed very recently causing a general issue with Openhabian and Java17-installation or is there something fishy with my system? Any ideas on how to get the correct Java onto the Pi? :slight_smile:

  • Platform information:
    • Hardware: RPi4
    • OS: OpenHABian
    • openHAB version: Prev 3.4
  • Issue of the topic: Trying to update OH 3.4 to 4 via ‘Openhabian-config’. Fails at “Fetching OpenJDK 17”

APPARENTLY I was still on Buster. I was absolutely sure I was on Bullseye since ages (I did a restore a while back and that backup was probably older than I thought). Will re-attempt post-upgrade, but feel pretty sure that this is related to Buster availability of packages.

Issue persists following upgrade to Bullseye. Neither myself nor Openhabian seems capable of getting Java17 on to the system. Trying to get it manually installed.

Having tried to get around this and failed in spectacular fashion, I surrendered and made a fresh install with Openhabian and then restored settings to it. Worked flawlessly and I am now running 4.0. Will mark as closed!

I was on the wrong train but using the stable and updating using the config tool worked for me. So for others out there with the same issue; reinstalling your whole OH instance is not your only option.

100% agree to try that first. Didn’t work for me though. :slight_smile:

I am having the same error on a similar setup. Rather not want to come up with a fresh setup. So even if the case is solved for you I am hoping that the real issue still will be tackled. ¯_(ツ)_/¯

That would mean that you are also still on buster and not yet on bullseye which is a prerequisite ?

I am having the same error on a similar setup. Rather not want to come up with a fresh setup. So even if the case is solved for you I am hoping that the real issue still will be tackled. ¯_(ツ)_/

There is a similar thread with a dude having made great progress in moving from Buster > Bullseye and thereafter getting Java 17 and then OH to run, so it might get figured out yet. :slightly_smiling_face:

That said, if you can afford it, I strongly advise to setup a clean install of Openhabian and then restore your settings. It’s easy, it’s fast and as long as you have the backup - it works. What you will lose is system side changes, like symlinks etc. I spent ~8h trying to get the system to work and it took less than 1.5 to get back to normal on OH4 after deciding to do a restore.

Good luck!

Check out the below; it’s the other discussion I was talking about.

Thanks to both of you! The keywords “bullseye” and “buster” helped me to google what I did not understand before. I don’t have any technical background and am more a proof that anyone can use Openhab if willing to accept a minimum of dedication. :wink: Having said this I rather accept having to reinstall the entire system than playing around on things I don’t understand well enough.

But maybe you can help me with another thing doing so:

When migrating from OH2 to OH3 I already had to reinstall the system. But since I had the possibility to reuse old files (rules, things etc.) copied through a Windows connection to openHAB-conf this was rather easy at the end and only a matter of time.

By now I am using a combination of those old files and “native” OH3 things/rules/etc. Is there any way I can save and reuse those information or do I have to come up with everything from scratch? This is actually my main concern as there are some hours of work in there already.

And no - I don’t have a backup as I never understood how to do this. I tried once but gave up as this ended soon in a state where I had no clue anymore what I was doing.

Sounds familiar. Although it’s not recommended by Raspberry it possible to do an upgrade from buster to bullseye. That’s what I did. With in mind, if it succeeds I’m saving myself a lot of trouble. If it fails … well you have to do the recommended clean install anyway. So nothing to lose by the attempt. But I would try to make a backup to avoid rebuilding all your OH thing/items/rules/gui. It does require putty and a lot of commandline actions. If that’s too much this is no help.

Below the preparation/ notes I took (again no guarantees, it worked for me but could fail for others)

Prevent (premature) openHAB upgrade:
Stopped openHAB service: sudo systemctl stop openhab.service 
Backup openHAB : sudo openhab-cli backup /home/pi/backup34 (copy file somewhere safe like USB)
Upgraded buster to bullseye:
Kept all configuration files, all changes seemed to be made by openHAB installation or myself (so replied N = Default)
Samba died, fixed with: uninstall & install : sudo apt-get install samba samba-common-bin (configuration/accounts are not affected)
Java remains 11. 
Stop openhab again
sudo apt install openjdk-17-jdk
sudo update-alternatives --config java

check prerequisites (bullseye/java17)
java -version
lsb_release -a

enable openhab upgrade packages:
sudo apt-mark unhold openhab
sudo apt-mark unhold openhab-addons

upgrade to OH 4.01
sudo apt update
sudo apt upgrade

Great topic on post install fixes:
=> JavaScript Scripting (Nashorn) & Change in rulecode:
=> More memory

@supersjel, that looks awesome, thanks! I think, I’ll give it a shot. Did your backup through openhab-cli really save all your individual stuff? And at what point (and how) did you restore it?

@Icho : Well since the upgrade succeeded I didn’t need it to restore things. It’s just in case, if the upgrade fails and you have to restart from a clean install than you need it. That’s why the suggestion is … put it on an USB or somewhere outside the raspberry you’re upgrading. There’s documentation somewhere here, I think if you replace in the command the word “backup” with “restore” it will put the backup back in the system. But you only need to do that if you have to make a clean install.

As I understand from the documentation it stores all your openHAB stuff. But not the things you do “extra” on the raspberry outside openHAB. So in my case … I have some nodejs programs for stuff openHAB doesn’t support. That’s something you have to do separately.

If you use a raspberry with an SD card, you can use a tool on your laptop/computer to create an backup-image of the entire card. That takes also the “extra” things.

1 Like

Anyone about to upgrade should have a look at the OH4 release notes before trying:

Actually, if you haven’t set up automated backups, you can perform a VERY simple backup using OH’s standard scripts: Head into Openhabian and choose menu 50, you should get a dump/backup of all your Openhab-specific files (i.e. things, items, rules etc as well as the json-db) - default location is /var/lib/openhab/backups, which is also by default mapped by SMB to “openHAB-userdata” under “backups”.

The easiest way to perform an upgrade is thus (as per my humble opinion):
NOTE: There ARE some breaking changes in OH4 which may or may not impact you; most were easily fixed for me.

  1. Make a copy of the SD-card
  2. Run Openhabian-config menu item 50
  3. Verify that you have the file available in above mentioned locations and copy it to your windows machine
  4. Install a fresh Openhabian on a second SD-card
  5. Setup SMB
  6. Enter the backups-location from your Windows machine via SMB and copy the previously exported file to the Pi
  7. Ensure that the ownerships of the backup file looks correct on the Pi-side (not sure if necessary, but suspect so)
  8. Run Openhabian-config item 51 (restore)

Note the breaking changes and fix those, re-do any system side changes manually (such as mounts, symlinks etc). :slight_smile:

1 Like

See also openHAB 4 migration FAQ question #1.

Thanks all! Just finished the last todos on my upgrade today and am now running on OH4. A first attempt ended in a complete desaster, so had to do a fresh install. But that did turn out to be not too challenging since I found out how to do a backup and was able to restore most of the individual settings. OH really came a long way and became by now an easy to use system - very impressive! Thank you all so much for your thoughts and help on this!