Smoothly update OH2

I have OH2 on my Raspi3

                          __  _____    ____
  ____  ____  ___  ____  / / / /   |  / __ )
 / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  |
/ /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ /
\____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/
    /_/                        2.0.0-SNAPSHOT
                               Build #650

here some more info about installed packages

pi@raspberrypi:~/www $ sudo apt-get purge openhab2*
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'openhab2' for regex 'openhab2*'
Note, selecting 'openhab2-addons' for regex 'openhab2*'
Note, selecting 'openhab2-offline' for regex 'openhab2*'
Note, selecting 'openhab2-online' for regex 'openhab2*'
Note, selecting 'openhab2-addons-legacy' for regex 'openhab2*'
Package 'openhab2-online' is not installed, so not removed
Package 'openhab2-addons' is not installed, so not removed
Package 'openhab2-addons-legacy' is not installed, so not removed
Package 'openhab2' is not installed, so not removed
The following packages will be REMOVED:
  openhab2-offline*

And here is the problem:

pi@raspberrypi:~/www $ sudo apt-get install openhab2-offline
Reading package lists... Done
Building dependency tree
Reading state information... Done
openhab2-offline is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

And here is my concern regarding the remove current version

pi@raspberrypi:~/www $ sudo apt-get install openhab2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  openhab2-offline
The following NEW packages will be installed:
  openhab2
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.

So the question is how to smoothly update my current OH2? And save ALL settings?

If you sudo apt-get install openhab2, it will retain your existing configs and do a smooth installation over the existing openhab2-offline version (it will remove it).

apt-get remove openhab2-offline will keep your files and directories (this is what the installation script is doing)
apt-get purge openhab2-offline will remove everything (don’t do purge :slight_smile:)

Take a backup anyway… better safe than sorry.

1 Like

Update completed! UI show only two things, seems it’s “new DB” issue, but how resolve it?
All files .items .sitemap .rules etc. is OK!

Hm… seems all is OK right now!

I used this command to update OH2

pi@raspberrypi:~ $ sudo apt-get install openhab2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  openhab2-offline
The following NEW packages will be installed:
  openhab2
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
Need to get 53.2 MB of archives.
After this operation, 129 MB disk space will be freed.
Do you want to continue? [Y/n] Y
Get:1 http://dl.bintray.com/openhab/apt-repo2/ unstable/main openhab2 all 2.1.0~20170129232652-1 [53.2 MB]
Fetched 53.2 MB in 36s (1,454 kB/s)
(Reading database ... 35190 files and directories currently installed.)
Removing openhab2-offline (2.0.0~20161218105629) ...
Processing triggers for systemd (215-17+deb8u6) ...
Selecting previously unselected package openhab2.
(Reading database ... 33262 files and directories currently installed.)
Preparing to unpack .../openhab2_2.1.0~20170129232652-1_all.deb ...
Unpacking openhab2 (2.1.0~20170129232652-1) ...
Processing triggers for systemd (215-17+deb8u6) ...
Setting up openhab2 (2.1.0~20170129232652-1) ...

Do I need update addons?

I don’t think so… In theory, the new openhab2 package deployed the new versions of the addons that you were using and had defined in the /etc/openhab2/services/addons.cfg file.

You can check their version from the console:

openhab> bundle:list