openhab / openhabian

openHABian - empowering the smart home, for Raspberry Pi and Debian systems
https://community.openhab.org/t/13379
ISC License
821 stars 252 forks source link

Default install OH2 #1594

Closed mstormi closed 2 years ago

mstormi commented 2 years ago

After getting word that installing with clonebranch=stable does NOT install OH2 but 3, I'd think this might be because the image is based on the main branch and /opt/openhabian/openhabian-setup.sh actually is being executed BEFORE it is being overwritten with the stable code. Fix this by evaluating if to install OH2 or OH3 then pass this as $1 of the openhab_setup call in openhabian-setup.sh

mstormi commented 2 years ago

@ecdye I think we need to build a new image for this to take effect, don't we ?

ecdye commented 2 years ago

I actually don't think so, and looking at the code it would appear that it is not necessary. If we don't need to do a new image I would prefer not to that way we can wait until the bullseye image becomes available for RPi.

mstormi commented 2 years ago

too late ;) a new image was due anyway, Bullseye seems to still be far out See https://github.com/openhab/openhabian/issues/1595

mstormi commented 2 years ago

did you try with clonebranch=stable ?

mstormi commented 2 years ago

Just did with v1.6.6 image and it failed, I get sed: can't read /var/lib/openhab2/etc/version.properties: No such file or directory and openhab is not installed (neither 2 nor 3).

mstormi commented 2 years ago

first-boot.log

ecdye commented 2 years ago

Found the issue, in first-boot.bash line 220 we currently run

if [[ $(eval "$(openhabian_update &> /dev/null)") -eq 0 ]]; then

when it should be

if [[ $(eval "$(openhabian_update "${clonebranch:-openHAB3}" &> /dev/null)") -eq 0 ]]; then

to ensure that we update openhabian and checkout the right branch.

mstormi commented 2 years ago

See https://community.openhab.org/t/migrate-old-openhabian-instance-jessie-rpi3-to-oh3-on-rpi4/127149/8 User seeing clonebranch=o2fix seems weird to me, pls investigateand respond there when fixed, too.

ecdye commented 2 years ago

He is using the image that was built when I created the PR that's why it is not working correctly. Why he Is dining that I don't know.

ecdye commented 2 years ago

We should probably rerelease 1.6.6 to make the changes effictive

mstormi commented 2 years ago

Yep, Ouch, the o2fix is in the v1.6.6 image. Likely a mistake of mine when handling the images for release. Just started another image build to make sure, will replace the image as soon as that is built

mstormi commented 2 years ago

released new build, checked that o2fix is gone, it is

mstormi commented 2 years ago

Original problem is not solved, even with clonebranch=stable it installs OH3 (main branch). Haven't analysed yet but I'd think that regardless of your last fix we also need the code that explicitly installs oh2 whenever clonebranch=(=)stable. In my orig PR I had put that into main's openhabian-setup.sh but you removed it.

mstormi commented 2 years ago

I changed openhabian-setup.sh now at least it tries to install OH2 but fails, see line 2260ff of log. first-boot.log

@BClark09 I don't fully get why it fails but see below (executed on the machine that failed to complete installing OH2 package).

Could it be because you've added the repo to the openhab2 package, too ? If so, please revert here too as you did with OH3.

[13:39:54] root@openhabian:/opt# cd /etc/apt/sources.list.d/
[13:39:59] root@openhabian:/etc/apt/sources.list.d# ls
comitup.list  nodesource.list  openhab2.list  openhab.list  raspi.list  vscode.list
[13:40:00] root@openhabian:/etc/apt/sources.list.d# more openhab2.list
deb https://openhab.jfrog.io/artifactory/openhab-linuxpkg stable main
[13:40:12] root@openhabian:/etc/apt/sources.list.d# more openhab.list
deb [signed-by=/usr/share/keyrings/openhab.gpg] https://openhab.jfrog.io/artifactory/openhab-linuxpkg stable main
[13:40:15] root@openhabian:/etc/apt/sources.list.d# apt-get update
E: Conflicting values set for option Signed-By regarding source https://openhab.jfrog.io/artifactory/openhab-linuxpkg/ stable: /usr/share/keyrings/openhab.gpg !=
E: The list of sources could not be read.
[13:40:49] root@openhabian:/etc/apt/sources.list.d# mv openhab2.list /var/tmp
[13:40:56] root@openhabian:/etc/apt/sources.list.d# apt-get update
Hit:1 http://davesteele.github.io/comitup/repo comitup InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian buster InRelease
Hit:3 http://archive.raspberrypi.org/debian buster InRelease
Get:4 https://deb.nodesource.com/node_12.x buster InRelease [4,584 B]
Hit:5 https://openhab.jfrog.io/artifactory/openhab-linuxpkg stable InRelease
Get:6 https://deb.nodesource.com/node_12.x buster/main armhf Packages [780 B]
Fetched 5,364 B in 4s (1,489 B/s)
Reading package lists... Done
BClark09 commented 2 years ago

@BClark09 I don't fully get why it fails but see below (executed on the machine that failed to complete installing OH2 package).

I think it's happening because you can't have the same source with different public key pointers.

openhab2.list also needs to contain [signed-by=/usr/share/keyrings/openhab.gpg]

mstormi commented 2 years ago

it's duplicate anyway so I'll delete it

mstormi commented 2 years ago

Fixed-by: #1601