[SOLVED] /var/lib/openhab2 gone

something is changing permissions into /var/lib/openhab2 befween reboots

openhabian@openhab:~ $ openhab-cli info

Version:     2.4.0 (Build)

User:        openhab (Active Process 589)
User Groups: openhab tty dialout audio bluetooth gpio

Directories: Folder Name      | Path                        | User:Group
             -----------      | ----                        | ----------
             OPENHAB_HOME     | /usr/share/openhab2         | openhab:openhab
             OPENHAB_RUNTIME  | /usr/share/openhab2/runtime | openhab:openhab
             OPENHAB_USERDATA | /var/lib/openhab2           | openhab:openhab
             OPENHAB_CONF     | /etc/openhab2               | openhab:openhab
             OPENHAB_LOGDIR   | /var/log/openhab2           | openhab:openhab

URLs:        http://10.10.1.5:8080
             https://10.10.1.5:8443

openhabian@openhab:~ $ hostnamectl
   Static hostname: openhab
         Icon name: computer
        Machine ID: 97be99ca7d444a6e947e00caf4b3e3f9
           Boot ID: 2c5f9cea647740869b96d7715c2ec676
  Operating System: Raspbian GNU/Linux 10 (buster)
            Kernel: Linux 4.19.58-v7+
      Architecture: arm
openhabian@openhab:~ $ sudo reboot
Connection to 10.10.1.5 closed by remote host.
Connection to 10.10.1.5 closed.
kriznik@GMNG:~$ tv
Linux openhab 4.19.58-v7+ #1245 SMP Fri Jul 12 17:25:51 BST 2019 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Aug  9 20:39:40 2019 from 10.10.1.100
openhabian@openhab:~ $ openhab-cli info

Version:     2.4.0 (Build)

User:        openhab (Active Process 590)
User Groups: openhab tty dialout audio bluetooth gpio

Directories: Folder Name      | Path                        | User:Group
             -----------      | ----                        | ----------
             OPENHAB_HOME     | /usr/share/openhab2         | openhab:openhab
             OPENHAB_RUNTIME  | /usr/share/openhab2/runtime | openhab:openhab
             OPENHAB_USERDATA | /var/lib/openhab2           | root:root
             OPENHAB_CONF     | /etc/openhab2               | openhab:openhab
             OPENHAB_LOGDIR   | /var/log/openhab2           | openhab:openhab

URLs:        http://10.10.1.5:8080
             https://10.10.1.5:8443

openhabian@openhab:~ $

edit: hmm it just looks like whole /var/lib/openhab2 is whiped out when reboot, so new folder is created empty by root after restart
because my test backup I’ve made on 2.5M2 after force reinstall is gone

11 posts were split to a new topic: Tempo

Hi, does anyone know why fresh install of openHABian v1.5 looses all settings and bindings after reboot?
E.g. I have a fresh installation of openHABian v1.5. After start it shows Dashboard with selection of installation type - standard, expert, Demo etc. I select standard, it starts PaperUI and works. I install binding - also works.
Now if I reboot RPi all seems to be gone. It starts again with Dashboard of installation type, PaperUI doesn’t start at all, bindings are absent. I install them again, but after reboot same situation. What can be the problem? I used openhabian-config to fix user permissions, but it seems not to help.

How are you shutting down the machine?
If just yanking the power on a Linux server, you are just ASKING for filesystem corruption.

Did you enable zram ?
How exactly do you reboot ? (and why?)

It is the Microsoft mentality :smiley:

actually on my other machine I do have exactly same issue when using zram and openhabian 1.5 on rpi3+
eventho I have had installed 2.5 m2, after reboot there is again 2.4 shown on webui, which is incorrect as system does have 2.5 M2 repo only

and reboot is performed from cmnd line indeed.

any ideas where to look?

bunch of errors in log as well

2019-08-10 00:03:17.704 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-package-standard': No matching features for openhab-package-standard/0
2019-08-10 00:10:17.638 [INFO ] [.dashboard.internal.DashboardService] - Stopped Dashboard
2019-08-10 00:11:04.658 [ERROR] [internal.service.FeaturesServiceImpl] - Error notifying listener about the current state
java.lang.RuntimeException: Error resolving artifact org.apache.karaf.features:framework:xml:features:4.2.1: [Could not find artifact org.apache.karaf.features:framework:xml:features:4.2.1 in openhab (https://dl.bintray.com/openhab/mvn/online-repo/2.4/)] : mvn:org.apache.karaf.features/framework/4.2.1/xml/features
        at org.apache.karaf.features.internal.service.RepositoryImpl.load(RepositoryImpl.java:116) ~[11:org.apache.karaf.features.core:4.2.1]
        at org.apache.karaf.features.internal.service.RepositoryImpl.<init>(RepositoryImpl.java:50) ~[11:org.apache.karaf.features.core:4.2.1]
        at org.apache.karaf.features.internal.service.RepositoryCacheImpl.create(RepositoryCacheImpl.java:51) ~[11:org.apache.karaf.features.core:4.2.1]
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl.registerListener(FeaturesServiceImpl.java:272) [11:org.apache.karaf.features.core:4.2.1]
        at org.apache.karaf.features.internal.osgi.Activator.doStart(Activator.java:176) [11:org.apache.karaf.features.core:4.2.1]
        at org.apache.karaf.util.tracker.BaseActivator.run(BaseActivator.java:275) [11:org.apache.karaf.features.core:4.2.1]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.io.IOException: Error resolving artifact org.apache.karaf.features:framework:xml:features:4.2.1: [Could not find artifact org.apache.karaf.features:framework:xml:features:4.2.1 in openhab (https://dl.bintray.com/openhab/mvn/online-repo/2.4/)]
        at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:720) ~[?:?]
        at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:659) ~[?:?]
        at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:600) ~[?:?]
        at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:567) ~[?:?]
        at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:557) ~[?:?]
        at org.ops4j.pax.url.mvn.internal.Connection.getInputStream(Connection.java:123) ~[?:?]
        at java.net.URL.openStream(URL.java:1057) ~[?:?]
        at org.apache.karaf.features.internal.service.RepositoryImpl.load(RepositoryImpl.java:113) ~[?:?]
        ... 10 more
        Suppressed: shaded.org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact org.apache.karaf.features:framework:xml:features:4.2.1 in openhab (https://dl.bintray.com/openhab/mvn/online-repo/2.4/)
                at shaded.org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:39) ~[?:?]
                at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355) ~[?:?]
                at shaded.org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67) ~[?:?]
                at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581) ~[?:?]
                at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249) ~[?:?]
                at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520) ~[?:?]
                at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421) ~[?:?]
...
....
...
2019-08-10 00:11:06.866 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-package-standard': No matching features for openhab-package-standard/0

2019-08-10 00:11:16.827 [INFO ] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007

2019-08-10 00:11:18.386 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at http://10.10.1.5:8080

2019-08-10 00:11:18.389 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at https://10.10.1.5:8443

2019-08-10 00:12:06.095 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-package-standard': No matching features for openhab-package-standard/0

2019-08-10 00:13:06.110 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-package-standard': No matching features for openhab-package-standard/0

2019-08-10 00:14:06.073 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-package-standard': No matching features for openhab-package-standard/0

2019-08-10 00:15:06.084 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-package-standard': No matching features for openhab-package-standard/0

2019-08-10 00:16:06.088 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-package-standard': No matching features for openhab-package-standard/0

2019-08-10 00:17:06.089 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-package-standard': No matching features for openhab-package-standard/0

2019-08-10 00:18:06.090 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-package-standard': No matching features for openhab-package-standard/0

2019-08-10 00:19:06.095 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-package-standard': No matching features for openhab-package-standard/0

2019-08-10 00:20:06.095 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-package-standard': No matching features for openhab-package-standard/0

2019-08-10 00:21:06.098 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-package-standard': No matching features for openhab-package-standard/0

2019-08-10 00:22:06.101 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-package-standard': No matching features for openhab-package-standard/0

2019-08-10 00:23:06.103 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-package-standard': No matching features for openhab-package-standard/0

2019-08-10 00:24:06.109 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-package-standard': No matching features for openhab-package-standard/0

The repo moved for milestone builds today.

yes I know

openhabian@openhab:~ $ cat /etc/apt/sources.list.d/openhab2.list
#deb https://dl.bintray.com/openhab/apt-repo2 stable main
deb https://openhab.jfrog.io/openhab/openhab-linuxpkg testing main
openhabian@openhab:

that really not answering why OH taking shit after reboot

If you hand edited the repo list I think you heed to do apt-get update first to update the cache before installing packages.

Your logs say openhab is still looking in the 2.4 repo.

I might be stupid in many cases, but not really in case of linux :wink:

yes OH is looking for something which should not exist, but doing so after reboot, after it was updated to 2.5m2 and running couple of hours, yes … correct, it’s error which should not appear because apt indeed does not have any information about 2.4 at all.

I am just trying to help. Try rebuilding the package cache?
https://sites.google.com/site/longphanwiki/basic-skills/ubuntu-linux

in the name of science I’ve done reinstall of 2.5M2 (sudo apt reinstall openhab2) which resulted in working gui which shown 2.5 M2 as well as openhab-cli info

and after restart it’s 2.4 again, failing to start

something is changing permissions into /var/lib/openhab2 befween reboots

openhabian@openhab:~ $ openhab-cli info

Version:     2.4.0 (Build)

User:        openhab (Active Process 589)
User Groups: openhab tty dialout audio bluetooth gpio

Directories: Folder Name      | Path                        | User:Group
             -----------      | ----                        | ----------
             OPENHAB_HOME     | /usr/share/openhab2         | openhab:openhab
             OPENHAB_RUNTIME  | /usr/share/openhab2/runtime | openhab:openhab
             OPENHAB_USERDATA | /var/lib/openhab2           | openhab:openhab
             OPENHAB_CONF     | /etc/openhab2               | openhab:openhab
             OPENHAB_LOGDIR   | /var/log/openhab2           | openhab:openhab

URLs:        http://10.10.1.5:8080
             https://10.10.1.5:8443

openhabian@openhab:~ $ hostnamectl
   Static hostname: openhab
         Icon name: computer
        Machine ID: 97be99ca7d444a6e947e00caf4b3e3f9
           Boot ID: 2c5f9cea647740869b96d7715c2ec676
  Operating System: Raspbian GNU/Linux 10 (buster)
            Kernel: Linux 4.19.58-v7+
      Architecture: arm
openhabian@openhab:~ $ sudo reboot
Connection to 10.10.1.5 closed by remote host.
Connection to 10.10.1.5 closed.
kriznik@GMNG:~$ tv
Linux openhab 4.19.58-v7+ #1245 SMP Fri Jul 12 17:25:51 BST 2019 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Aug  9 20:39:40 2019 from 10.10.1.100
openhabian@openhab:~ $ openhab-cli info

Version:     2.4.0 (Build)

User:        openhab (Active Process 590)
User Groups: openhab tty dialout audio bluetooth gpio

Directories: Folder Name      | Path                        | User:Group
             -----------      | ----                        | ----------
             OPENHAB_HOME     | /usr/share/openhab2         | openhab:openhab
             OPENHAB_RUNTIME  | /usr/share/openhab2/runtime | openhab:openhab
             OPENHAB_USERDATA | /var/lib/openhab2           | root:root
             OPENHAB_CONF     | /etc/openhab2               | openhab:openhab
             OPENHAB_LOGDIR   | /var/log/openhab2           | openhab:openhab

URLs:        http://10.10.1.5:8080
             https://10.10.1.5:8443

openhabian@openhab:~ $

edit: hmm it just looks like whole /var/lib/openhab2 is whiped out when reboot, so new folder is created empty by root after restart
because my test backup I’ve made on 2.5M2 after force reinstall is gone

If you enabled zram then /var/lib/openhab2 is in RAM.
You must properly shutdown your box in order for its contents to get synced to disk.
service zram-config stop
umount /var/lib/oepnhab2
(both of which should be executed if you properly shutdown instead of blindly typing “reboot”).

well reboot is standard server command which should not corrupt installed apps.
and which is executing proper restart sequence.

what if there will be power outage? which I believe time to time just happends and not always will UPS hold long enough. Then there will be corrupted /var/lib/openhab2 too?
:thinking:

That’s simply wrong. It skips properly shutting down the running services.

As zram dirs should be synced to disk when you properly shutdown this is the state you should find the dirs in.

… so what’s correct way then, when system command which reboots system is not the one?

for another round of science I’ve done another reinstall, verified that everything is 2.5M2
then i’ve stopped zram with sudo service zram-config stop
unfortunately there was nothing to umount as /var/lib/openhab2 was not mountpoint anywhere
and then rebooted

and after logging back 2.4 again :wink:

I know I’m just blindly rebooting system, but I would like to know how this should be done then

well… reboot uses shutdown -r , so what you are exactly pointing on?