OH 4.1.1 startup takes more than an hour

After removing xmx and xms from EXTRA_JAVA_OPTS, Zwave was not working any more after approx 1 day, so I added it again - now everything is fine again except the 1h startup.

Agree, it looks clear to me as well, writes are going to sda which should be fine with it. The iowait% is also small.

Now, as disk is not an issue, can you enable trace logging for WatchServiceImpl?
You can do this by calling log:set TRACE org.openhab.core.internal.service.WatchServiceImpl within openhab shell (ssh -p 8101 openhab@localhost after you are logged into raspberry shell). There is not much logging there, but you can shall see which directories are start to be monitored.

All of services which you miss to complete openHAB service start are depending on filesystem monitoring. Once you get directories printed in the logs have a look on them and check any of them happen to have too many files - by too many I mean more than 1000. Command for that is ls -R /path/to/some/directory/from/logs | wc -l.

Great that your positive and smiling still :slight_smile:
Whilst it is great to find the root cause I do not see anyone else with the issue, so the value in finding it is not great unless you reload and the fault remains.

I have seen users go through this kind of thing only to work out it was corruption in a system file from perhaps a bad power supply not giving enough power.

Is it possible to take a backup from this system, create a fresh system and load the backup? Can you do that without touching this system by using another pi or server that is the same or swapping out sd cards. If this solves the problem it would be a quick solution and we can write it off as a system issue not part of openhab.

I thought filesystem could be a trouble marker (its always filesystem!), but with what I see I am in big doubts. If all what was changed between now and then is openHAB version and debian version then power supply is rather not source of troubles. The watch service refactoring happened between 3.4 and 4.0 milestones so at least that part of story, of why issue didn’t exist with OH 3.4, do align.

@J-N-K have you seen the directory watcher having any hiccups while refactoring?

No.

The mounted ssd with the camera images will have 1000 or more files…
I will test with WatchServiceImpl