How To: Easily Install Openhab2 on Odroid C2 ARM64

SOLVED, The hotfix message kept appearing until after I had done a reboot. I’m sure when I have done it in the past with the PI, the moment the tool gets updated the message stops.

Fantastic news, but I’m guessing it will leave the root user account alone and not check that the user has changed the password? The openhabian tool already does password checks, hopefully just a matter of adding “root” and “odroid” to that script if C2?

Also I take it that to setup an unattended install you would need to create a modified IMG setup to do that? Is there a way to do something like

sudo openhabian-config unattended C2

EDIT: answered part of my question unattended is used in /opt/openhabian/openhabian-setup.sh so the $1 works, just can not see $2

Correct, I looked pretty much everywhere and could not find a repo that would work, perhaps next week they may change this or I am blind, but for now it appears manual install only. Downside is the version gets hard coded in.

Correct and that would be easy to do with the only hurdle I do not know how openhabian knows what device you own. If you already know the framework of openhabian and the best way to implement the device check, then great it will take you a fraction of the time it would take me.

I just checked the file /opt/openhabian/functions/java-jre.sh
It already has a section that is marked as unused at the bottom and it is a manual install method very similar to what I am doing.

Well yes if you want to install your C2 like your Pi then the updated script would need to be put into a (C2 specific) image, but I think it would be out of scope for the openHABian project to maintain various images
(these would need to contain the base OS as well which I think is pretty different for Odroids).

But you used a different method to install openHABian, and if we were to update the openHABian scripts to support C2, it’s these updated ones you or a user would download and start your install based upon.

Once up and running, you can also call /opt/openhabian/openhabian-setup.sh with option either “unattended” or “unattended_debug” (just look at the beginning of that script). Eventually you need to comment out parts that you already executed during your unattended run.
Not sure if that works or has side effects. Maybe @ThomDietrich you can comment on this.

I don’t have any C2 available to test against so it’s up to you.
See definition of is_pithree() in functions/helpers.sh, it’s essentially parsing the contents of /proc/cpuinfo.
According to some quick google responses, a C2 would show ‘Hardware : ODROID-C2’, so grep for the Hardware line in your check.

Thanks for the info, very helpful. Here is some code…

grep line with the result underneath if I leave out the -q quiet option…

grep -q "^Revision\s*:\s*[ ][0-9][0-9][0-9][a-z]" /proc/cpuinfo
Revision        : 020c
grep -q "^Hardware\s*:\s* ODROID-C2" /proc/cpuinfo
Hardware        : ODROID-C2

Guessing it needs to be return 0 if TRUE?

is_odroidc2() {
  if grep -q "^Hardware\s*:\s* ODROID-C2" /proc/cpuinfo; then
    return 0
  else
    return 1
  fi
}

@mstormi

OK, I have it working and can do a PR on github after some feedback as some changes are probably still needed… Work done so far is forked here

Issue raised on openhabian github here.

If I try on a clean system to run unattended mode it complains I am missing a conf file, yet no message telling me what to do to create one. Recommend a nicer message to guide users.

So i launched the tool and ran manual/fresh setup (option 60) which did not trigger the archive method of installing zulu. Possible ways forward are to offer the manual archive method as a 3rd Java option, or to do a simple re-direct if it detects is_odroidc2. Thoughts? I probably prefer offering it as a 3rd option that way if other devices like odroid C1+, XU4 or other arm64 devices are used, the coding is already done.

After exiting I tried to run unattended and this time it worked all the way through with all steps giving OK output. The java_zulu_embedded_archive() ran instead.

1 Like

Well it’s usually not meant to be run like that. Just a wild guess is it looking for /etc/openhabian.conf ? If so, try copying your existing one. Well or read the script source what file it is looking for. You can also insert “set -x” after its first line.

Nah, I’d rather replace the zulu option because that wouldn’t work on the C2. See what routine that’s calling and insert if (is_odroidc2()) then <your install routine>. Maybe the person to review your PR (probably @ThomDietrich) will request you to change that but that’s how I would proceed.

And of course replace the zulu line of /opt/openhabian/openhabian-setup with another if (is_odroidc2()) then <your install_routine> if you haven’t done so yet.

Yes that is the one. Bottom line is as you say, it is not setup to install this way and hence it is far harder then simply using my script which now has the ability to install openhabian as part of the process.

Openhabian is in the middle of changing things to make it easier (great news), so any further changes until the framework is re-written is a waste of time.

@matt1 I am almost beaten trying to get Zulu onto my Android box.

I have a Beelink mxiii v2. Uses the S905X chipset and is fairly close to the Odroid C2 in spec. It has been running Debian Stretch with Home Assistant beautifully for a few months but I want to make the jump to Openhab.
I tried to load Zulu onto Debian and failed in every way. After seeing your troubles with ARM64 I tried Ubuntu 18.04 and had a bit more success but still cannot get it to work.
I tried your script with a couple of tweaks and it appears to get to the end but still Java gives “illegal instruction” when I check the version (java -version).
If I try running openhab the service keeps failing with illegal instruction errors. I have tried various versions of Zulu and all give the same result.

Do you have any ideas for how I can get a working Zulu installation on the thing please?

A. Pay Zulu for support and they probably know why and how to get it going.
B. Just buy an Odroid C2 as they have a big community to ask and also fix bugs in the base images they supply.
C. Try another java like Oracle or openjava, but since they are not the recommended ones to use you do raise the odds you will hit a unique bug in Openhab that no one else has seen.

Sorry I do not have any troubles, it took me a day to work out how to do a manual install of Zulu as there were no guides anywhere on how to do it step by step. My setup is working great for almost 6 months now and used daily…

I posted this guide here as it takes you through the steps with more info on getting the java sorted. If java is not running right, then dont bother trying openhab.

Uploaded an updated version of the script today. It now uses a newer version of zulu java and fixed some issues with frontail loading. Steps are in the first post of this thread on how to find and use the script.

Updated and tested the script again as the key for a repo had expired in the ubuntu images created by Odroid and also now using newer Zulu JVM.

1 Like

Will the script also update key and java on an running Odroid C2 with Ubuntu ?
(maybe @MDAR got some interest in this).

The script will work omly on a new empty image, however the commands are easy to grab in any text editor as it is a bash script. Very easy to grab the steps you need out of it to use manually or you could create a java updating script from it.

I always setup from scratch to renew the entire sd cards contents with new reliable data.

1 Like

@matt1

Tried to install Zulu following your script on Odroid C4 running Ubuntu 20.04 (clean system) :

sudo dpkg --add-architecture armhf
sudo apt-get update && sudo apt-get dist-upgrade -y

This reports 2 errors :
N: Skipping acquire of configured file ‘main/binary-arm64/Packages’ as repository ‘http://repos.azulsystems.com/ubuntu stable InRelease’ doesn’t support architecture ‘arm64’
N: Skipping acquire of configured file ‘main/binary-armhf/Packages’ as repository ‘http://deb.odroid.in/c4 bionic InRelease’ doesn’t support architecture ‘armhf’

The rest of the installation seems to go well, except that all files are owned by kernoops and if I try to do
/usr/lib/jvm/zulu8.46.0.225-ca-jdk8.0.252-linux_aarch32hf/bin/java
it will return :
-bash: java: command not found
even though java clearly exists …

I suppose this somewhat curious bash error message is the result of the arm32hf architecture not being recognized - and as a result it won´t run the java arm32hf binary …

Any ideas of how to get around this - or is this just a matter of wait & pray that Hardkernel will add support for the arm32hf architecture to the C4 repositories ?

Thx for any input you may provide !

Are you using Ubuntu mate, minimal, or server?

Ubuntu Mate desktop image (=only version shipped on the C4 at the moment)

http://ppa.linuxfactory.or.kr/images/raw/arm64/focal/ for Ubuntu minimal 20-04 LTS.

Did you try using Matt’s script or just trying to install Zulu?

I tried the Zulu installation part of Matt´s script … (by simply copying the commands and changing the zulu version to the current one)

No point in continuing with Openhab installation if I can´t even do ´java -version´ :cry:

Flash the minimal image I linked above and try the script again but without changing the java version and adding the openhabian-config option. Then after OH installs use openhabian-config tool to update java.

Kinda odd I just flashed Ubuntu Mate desktop on eMMC to give it a try. :upside_down_face:

Thkx for giving that a try …

I´d like to stick to the std Ubuntu image, because I may want to run other stuff next to Openhab as well …
(also I am new to this sort of board, only did some stuff on arduino in the past. I therefor wouldn´t like to make major platform changes - haven´t got eMMC lying around (yet) either - am still discovering the Odroid world. Ubuntu Mate seems ok, although I am used to Linux Mint)

I understand, I just recently got my Odriod and installed Debian to test with the script. It worked well so I thought I would give Ubuntu Desktop a try but will most likely change to minimal version as it will run headless.

I haven’t powered up the image yet but I will let you know if I get it working. Meantime try to install openhabian-config tool and see if that will resolve the Zulu issue.

# install git
sudo apt-get update
sudo apt-get install git

# download and link
sudo git clone https://github.com/openhab/openhabian.git /opt/openhabian
sudo ln -s /opt/openhabian/openhabian-setup.sh /usr/local/bin/openhabian-config

# execute
sudo openhabian-config