Clear the Cache

@rlkoshak I cannot delete files in my cache because they are read only for what ever reason. Even with the help of google and this forum I am not able to solve the issue. Can you please help?

rm: cannot remove 'cache/org.eclipse.osgi/198/0/bundleFile': Read-only file system                                         
rm: cannot remove 'cache/org.eclipse.osgi/156/0/bundleFile': Read-only file system                                         
rm: cannot remove 'cache/org.eclipse.osgi/91/0/bundleFile': Read-only file system                                          
rm: cannot remove 'cache/org.eclipse.osgi/114/0/bundleFile': Read-only file system

Try this first :
openhab-cli reset-ownership

And then clear the cache

Thanks @vzorglub - unfortunately same result.

Well it tells you what the problem is: Read-only file system.
There’s many potential reasons for this and as-many remedies, but evaluating and fixing this is a Linux issue and beyond scope of this forum. Try rebooting your system. If your system is a RPi your SD card may be corrupted and best is to reinstall.

Makes sense. Installed the last backup. Thanks

Consider moving to ZRAM to avoid this to happen again.

Thanks @mstormi for the hint. Done.
BTW: rpi-clone saved another time my ä** with having a second SD card and a full backup. All I lost was some log and influxdb data.

this solved all bunch of permission issues:
java.io.FileNotFoundException: /var/lib/openhab2/tmp/karaf.pid (Permission denied)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.(FileOutputStream.java:213)
at java.io.FileOutputStream.(FileOutputStream.java:101)
at org.apache.karaf.main.InstanceHelper.writePid(InstanceHelper.java:127)
at org.apache.karaf.main.Main.launch(Main.java:243)
at org.apache.karaf.main.Main.main(Main.java:178)
java.lang.RuntimeException: /var/log/openhab2/openhab.log (Permission denied)
at org.apache.karaf.main.util.BootstrapLogManager.getDefaultHandlerInternal(BootstrapLogManager.java:102)
at org.apache.karaf.main.util.BootstrapLogManager.getDefaultHandlersInternal(BootstrapLogManager.java:137)
at org.apache.karaf.main.util.BootstrapLogManager.getDefaultHandlers(BootstrapLogManager.java:70)
at org.apache.karaf.main.util.BootstrapLogManager.configureLogger(BootstrapLogManager.java:75)
at org.apache.karaf.main.Main.launch(Main.java:244)
at org.apache.karaf.main.Main.main(Main.java:178)
Caused by: java.io.FileNotFoundException: /var/log/openhab2/openhab.log (Permission denied)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.(FileOutputStream.java:213)
at org.apache.karaf.main.util.BootstrapLogManager$SimpleFileHandler.open(BootstrapLogManager.java:193)
at org.apache.karaf.main.util.BootstrapLogManager$SimpleFileHandler.(BootstrapLogManager.java:182)
at org.apache.karaf.main.util.BootstrapLogManager.getDefaultHandlerInternal(BootstrapLogManager.java:100)
… 5 more
!SESSION 2019-12-26 23:03:36.571 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_152
java.vendor=Azul Systems, Inc.
BootLoader constants: OS=linux, ARCH=arm, WS=gtk, NL=en_US

!ENTRY org.eclipse.osgi 4 0 2019-12-26 23:03:36.573
!MESSAGE Error reading configuration: /var/lib/openhab2/cache/org.eclipse.osgi/.manager/.fileTableLock (Permission denied)
!STACK 0
java.io.FileNotFoundException: /var/lib/openhab2/cache/org.eclipse.osgi/.manager/.fileTableLock (Permission denied)
at java.io.RandomAccessFile.open0(Native Method)
at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
at java.io.RandomAccessFile.(RandomAccessFile.java:243)
at org.eclipse.osgi.internal.location.Locker_JavaNio.lock(Locker_JavaNio.java:36)
at org.eclipse.osgi.storagemanager.StorageManager.lock(StorageManager.java:388)
at org.eclipse.osgi.storagemanager.StorageManager.open(StorageManager.java:701)
at org.eclipse.osgi.storage.Storage.getChildStorageManager(Storage.java:1776)
at org.eclipse.osgi.storage.Storage.getInfoInputStream(Storage.java:1793)
at org.eclipse.osgi.storage.Storage.(Storage.java:132)
at org.eclipse.osgi.storage.Storage.createStorage(Storage.java:85)
at org.eclipse.osgi.internal.framework.EquinoxContainer.(EquinoxContainer.java:68)
at org.eclipse.osgi.launch.Equinox.(Equinox.java:31)
at org.eclipse.osgi.launch.EquinoxFactory.newFramework(EquinoxFactory.java:24)
at org.apache.karaf.main.Main.launch(Main.java:256)
at org.apache.karaf.main.Main.main(Main.java:178)

Hello
I’m new user to openhab.
I have a problem , it stopped working
and I don’t know what to do.
my English not good
thank you

Raspberry pi 4
sdcard 32gb

Linux openhab 4.19.75-v7l+ #1270 SMP Tue Sep 24 18:51:41 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: Tue Jan 7 22:27:07 2020 from 192.168.0.3

2020-01-08 01:18:44,920: FireMotD: Info: No FireMotD ExportFile detected. Please generate with “sudo ./FireMotD -S”

          Welcome to            __  _____    ____  _
        ____  ____  ___  ____  / / / /   |  / __ )(_)___ _____
       / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  / / __ `/ __ \
      / /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ / / /_/ / / / /
      \____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/_/\__,_/_/ /_/
          /_/
              openHAB 2.5.0-1 (Release Build)

Looking for a place to get started? Check out ‘sudo openhabian-config’ and the
documentation at openHABian | openHAB
The openHAB dashboard can be reached at http://openhab:8080
To interact with openHAB on the command line, execute: ‘openhab-cli --help’

[01:44:30] openhabian@openhab:~$ sudo du -xh / | grep -P “G\t”
[sudo] password for openhabian:
25G /var/log
26G /var
1.7G /usr
29G /
[01:44:59] openhabian@openhab:~$

[01:45:06] openhabian@openhab:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 30G 29G 0 100% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 2.0G 488K 2.0G 1% /run
tmpfs 5.0M 8.0K 5.0M 1% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
tmpfs 5.0M 0 5.0M 0% /var/cache/samba
tmpfs 5.0M 0 5.0M 0% /var/lib/samba
tmpfs 50M 32K 50M 1% /tmp
/dev/mmcblk0p1 253M 52M 201M 21% /boot
tmpfs 396M 0 396M 0% /run/user/1000
[01:47:06] openhabian@openhab:~$

Okay?
What exactly is not working?
You postet the output of df -h, is there a problem with space on the device?
I will just assume your openHAB is not working correctly.
Please provide the openHAB logs. See openHAB doc logs and or more about logging

And please try to describe what is not working and what was the last thing you did before it stopped working.

I have left behind the card that had stop working which did not open the saitmap due Limited space on the card and because I do not know How to function it I started on a new card and built from start the openhab. I have ordered a new raspberry Pi 4 and when I am going to have it on my hands I will try to put the card back to locate my mistake. Thank you I will write again when I am going to be ready if you are willing to help me. Chris

OMG. What did I do? I killed my openhab, please help.

I wanted to clean the cache, as reaction times of my mqtt stuff got a litlle bit slow.

So I cleaned the cache by using “openhab-cli clean-cache”.

But after a reboot nothing is working anymore. I get the following error message:

2020-02-02 13:44:35.739 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-misc-openhabcloud, openhab-binding-darksky, openhab-ui-habpanel, openhab-binding-chromecast, openhab-binding-mqtt, openhab-transformation-map, openhab-ui-habmin, openhab-binding-dmx, openhab-ui-paper, openhab-transformation-scale, openhab-binding-http1, openhab-ui-homebuilder, openhab-binding-tado, openhab-voice-googletts, openhab-binding-plclogo, openhab-transformation-javascript, openhab-transformation-jsonpath, openhab-binding-mihome, openhab-misc-mqttbroker, openhab-binding-wifiled, openhab-persistence-rrd4j, openhab-ui-basic, openhab-binding-openweathermap, openhab-binding-astro, openhab-binding-expire1': Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-voice-googletts; type=karaf.feature; version="[2.5.0.SNAPSHOT,2.5.0.SNAPSHOT]"; filter:="(&(osgi.identity=openhab-voice-googletts)(type=karaf.feature)(version>=2.5.0.SNAPSHOT)(version<=2.5.0.SNAPSHOT))" [caused by: Unable to resolve openhab-voice-googletts/2.5.0.SNAPSHOT: missing requirement [openhab-voice-googletts/2.5.0.SNAPSHOT] osgi.identity; osgi.identity=org.openhab.voice.googletts; type=osgi.bundle; version="[2.5.0.201912151153,2.5.0.201912151153]"; resolution:=mandatory [caused by: Unable to resolve org.openhab.voice.googletts/2.5.0.201912151153: missing requirement [org.openhab.voice.googletts/2.5.0.201912151153] osgi.wiring.package; filter:="(&(osgi.wiring.package=com.google.api.gax.core)(version>=1.42.0)(!(version>=2.0.0)))"]]

What can I do? . I cant even get access to myopenhab, as it is offline and paper.ui isnt running either…

I read that deleting the addon config could solve the problem. but how do i do that?

3:59:30] openhabian@openHABianPi:~$ /var/lib/openhab2/config/org/openhab/addon s.config
-bash: /var/lib/openhab2/config/org/openhab/addons.config: Permission denied
[14:00:18] openhabian@openHABianPi:~$ sudo /var/lib/openhab2/config/org/openhab/ addons.config
[sudo] password for openhabian:
sudo: /var/lib/openhab2/config/org/openhab/addons.config: command not found
[14:00:37] openhabian@openHABianPi:~$ /var/lib/openhab2/config/org/openhab/addons.config
-bash: /var/lib/openhab2/config/org/openhab/addons.config: Permission denied

How do I get to that folder and how do I delete it?

Sorry for my total linux noobness.

EDIT: After 2h research of how to delete a folder in linux i can say: Deleting the addons.conf folder didn’t solve any problems. I dont see the error message anymore in my log, but still nothing works. No openHab app, no paper.ui, and myopenhab is offline.
.
I am literally crying.

you can try
sudo openhab-cli reset-ownership

Not sure you want to start deleting files at this moment. The question of course would be: why would the ownership have changed? There is also a chance that your SD card is corrupted (assuming you are using a raspberry). But you are not giving a lot of information, so it will be difficult to help.

Thank you for the support. But I think ownership isn’t an issue. I only did the few steps from post no1 and from there on nothing worked, because openhabcloud,and all other bindings couldn’t be installed as seen in the error I posted above.
But after deleting that addon.config file (I read in another thread that this should help) openhab doesnt even try to install those addons. I dont get any error messages in the logs.
SD card isnt corrupted, as I can still see my items, things sitemap and rules folders.

When was the last time you restarted OH/Pi before clearing the cache? If it has been a while, lot’s of things could have happened in between that caused this situation. Which makes it harder to find the root cause.

Did you check the logs of the Raspbian system, like syslog? Are there any errors there?
Also, I recommend a few steps to try:

  1. Stop OH.
  2. Remove all bindings from addon.cfg (and addon.config just to be sure).
  3. Clear temp and cache directories (you can just delete the content of these two directories - not the directories themselves).
  4. Start OH and let it settle for 5 minutes.
  5. Restart OH and see if it comes up without issues.
  6. If so, start adding the bindings again.

Thank you noppes.
Last time the system was restarted was about 3 month ago.
I never cleared the cache before and the system has been running for about 18 month.
How do you clear temp?
Is it: sudo openhab-cli clear-temp ?

Well, I already started with a new SD card.
At least I made a backup of my sitemap, items, rules folder but still will be a lot of work.

I believe this is a dangerous advice. I hosed my OH couple hours ago by deleting contents of cache and tmp. I’ve now tried getting it back, but no luck. This is container install, everything in volume mounts for config. After I deleted the cache and tmp, OpenHAB gui is not reachable, and some felix complains about missing bundle dirs. It looks for nonexistent directories, probably something from the times this was not container based install yet.

Need to sleep now, and try fixing it tomorrow evening. Let’s see how many hours it takes to get it back. I have backup from 2.3, from which I just spent an evening converting it all to 2.5.1 with new MQTT rules, before doing this cleanup and hosing the install. Do’h.

You can use rm -rf <openhab-dir>/userdata/tmp/*

It’s worth noting that deleting the contents of the cache and tmp folders is exactly what the Linux installation scripts (apt and yum) do every time you upgrade. It is also exactly what the entrypoint.sh script does in the Docker container when it detects that your mounted userdata folder is for a version of OH different from the version of OH that will run in the container. They are also part of the steps for those using a manual install of OH to upgrade/downgrade their OH instance.

Clear the cache must be done in these situations to force OH to download and install the version of the binding that corresponds with that instance of OH. When you’ve upgraded or when you encounter certain types of errors, clearing the cache will force OH to reinstall all the add-ons, just like it does when upgrading. Consequently it can solve some types of errors.

It is not something you do periodically as a maintenance step. It should only be performed when you are experiencing certain types of errors that might be corrected by reinstalling all the add-ons again.

2 Likes

I’m sorry I caused useless noise here. It wasn’t that catastrophic now that I look at it with fresh eyes at the morning. I just had shit luck with two failures at the same time while I was bouncing the container up and down frequently.

So first of all the fenix error is likely due that I have some years back moved OH from native install to container. So there was a file:

openhab_userdata/config/org/apache/felix/fileinstall/a3d26444-7239-4cf1-841b-375af82a5901.config

which had wrong paths for felix.fileinstall.dir and felix.fileinstall.tmpdir, pointing to some legacy place in /var/lib… which is not valid for container any longer. So finding those and adding the necessary dirs fixed the error.

At the same time, I was hit a weird occurence of cruft in iptables. For some reason there were double NAT rules for the container, which the old ones took precedence. That lead me not to reach the container. Perhaps I had pressed ctrl-c or something in middle of container creation or something, but it made it look like openhab didn’t run gui.

So my bad, I apologize the false claim of this being bad advice.

FYI, if you are interested, this was the iptables problem:

grep '8083\|8101\|5007' iptables-save.txt 
-A CNI-DN-c8003dd990a68ae51b1c9 -s 10.88.7.54/32 -p tcp -m tcp --dport 8101 -j CNI-HOSTPORT-SETMARK
-A CNI-DN-c8003dd990a68ae51b1c9 -s 127.0.0.1/32 -p tcp -m tcp --dport 8101 -j CNI-HOSTPORT-SETMARK
-A CNI-DN-c8003dd990a68ae51b1c9 -p tcp -m tcp --dport 8101 -j DNAT --to-destination 10.88.7.54:8101
-A CNI-DN-c8003dd990a68ae51b1c9 -s 10.88.7.54/32 -p tcp -m tcp --dport 5007 -j CNI-HOSTPORT-SETMARK
-A CNI-DN-c8003dd990a68ae51b1c9 -s 127.0.0.1/32 -p tcp -m tcp --dport 5007 -j CNI-HOSTPORT-SETMARK
-A CNI-DN-c8003dd990a68ae51b1c9 -p tcp -m tcp --dport 5007 -j DNAT --to-destination 10.88.7.54:5007
-A CNI-DN-c8003dd990a68ae51b1c9 -s 10.88.7.54/32 -p tcp -m tcp --dport 8083 -j CNI-HOSTPORT-SETMARK
-A CNI-DN-c8003dd990a68ae51b1c9 -s 127.0.0.1/32 -p tcp -m tcp --dport 8083 -j CNI-HOSTPORT-SETMARK
-A CNI-DN-c8003dd990a68ae51b1c9 -p tcp -m tcp --dport 8083 -j DNAT --to-destination 10.88.7.54:8080
-A CNI-DN-ee918de3a9eecddcdd1f6 -s 10.88.7.42/32 -p tcp -m tcp --dport 8083 -j CNI-HOSTPORT-SETMARK
-A CNI-DN-ee918de3a9eecddcdd1f6 -s 127.0.0.1/32 -p tcp -m tcp --dport 8083 -j CNI-HOSTPORT-SETMARK
-A CNI-DN-ee918de3a9eecddcdd1f6 -p tcp -m tcp --dport 8083 -j DNAT --to-destination 10.88.7.42:8080
-A CNI-DN-ee918de3a9eecddcdd1f6 -s 10.88.7.42/32 -p tcp -m tcp --dport 8101 -j CNI-HOSTPORT-SETMARK
-A CNI-DN-ee918de3a9eecddcdd1f6 -s 127.0.0.1/32 -p tcp -m tcp --dport 8101 -j CNI-HOSTPORT-SETMARK
-A CNI-DN-ee918de3a9eecddcdd1f6 -p tcp -m tcp --dport 8101 -j DNAT --to-destination 10.88.7.42:8101
-A CNI-DN-ee918de3a9eecddcdd1f6 -s 10.88.7.42/32 -p tcp -m tcp --dport 5007 -j CNI-HOSTPORT-SETMARK
-A CNI-DN-ee918de3a9eecddcdd1f6 -s 127.0.0.1/32 -p tcp -m tcp --dport 5007 -j CNI-HOSTPORT-SETMARK
-A CNI-DN-ee918de3a9eecddcdd1f6 -p tcp -m tcp --dport 5007 -j DNAT --to-destination 10.88.7.42:5007
-A CNI-HOSTPORT-DNAT -p tcp -m comment --comment "dnat name: \"podman\" id: \"dd23bf1a31d0f36d19e6b1590d09d2b0918f255e98589ff1b50517530ed161a6\"" -m multiport --dports 8083,8101,5007 -j CNI-DN-ee918de3a9eecddcdd1f6
-A CNI-HOSTPORT-DNAT -p tcp -m comment --comment "dnat name: \"podman\" id: \"dd0e4c0ccff270c05f731de2934dc338fc9ee738cdc9f6d08364bffb6c9811ff\"" -m multiport --dports 8101,5007,8083 -j CNI-DN-c8003dd990a68ae51b1c9

but that’s off topic.