openhab / openhab-linuxpkg

Repo for Linux packages
Eclipse Public License 2.0
18 stars 33 forks source link

On upgrades only restart the service it is already running. #17

Closed theoweiss closed 7 years ago

theoweiss commented 7 years ago

Hopefully fixes #13. I've not tested these changes yet. @BClark09 could you please review this PR.

BClark09 commented 7 years ago

Upgrading from before this change (using old rm scripts) to after this change (new inst scripts) will need the user to start the service manually after, do you think this would be okay?

Tested on Debian 8 (systemd) and on Ubuntu 14 (sysVinit), on both (and only occasionally) openHAB refuses to stop after the upgrade completes with the following error:

Exception in thread "main" java.lang.NullPointerException
    at org.apache.karaf.main.Stop.main(Stop.java:58)

On Ubuntu 14 openHAB can't access it's own files while running, after this happens, openHAB refuses to start fully until it is killed and then force reinstalled. Unlike the above error, this happens on every upgrade if the process is already running.

2017-01-09 11:01:25.235 [ERROR] [org.eclipse.smarthome.ui            ] - Component descriptor entry 'OSGI-INF/proxy.xml' not found
2017-01-09 11:01:25.235 [ERROR] [org.eclipse.smarthome.ui            ] - Component descriptor entry 'OSGI-INF/chartservlet.xml' not found
2017-01-09 11:01:25.236 [ERROR] [org.eclipse.smarthome.ui            ] - Component descriptor entry 'OSGI-INF/chartprovider.xml' not found

I'd get the impression that stopping the service before an upgrade is essential.

theoweiss commented 7 years ago

Thanks for testing this! I will try to use a flag file for IPC between prerm and postinst.

abedwardsw commented 7 years ago

hi @theoweiss @BClark09 , wanted to ensure you saw my comment on https://github.com/openhab/openhab-distro/issues/327 , it appears to me at least that stop does not wait for the process to finish, therefore the "restart" command passed to the init.d scripts doesn't work as it doesn't fully wait for the process to stop before issuing a start.

My thought is we need to add in logic that does not return control from the "/etc/init.d/openhab stop" until the process finishes/stops or a set timeout period in which we would issue a kill command.

I think it's related to this ticket as well, so wanted to bring it up.

BClark09 commented 7 years ago

Hi @abedwardsw! Apologies, I meant to reply to you in that issue. Thanks for bringing it up here too! It could indeed be related to the extended problem that Ubuntu 14 has with this PR.

theoweiss commented 7 years ago

Hi @BClark09, thanks for testing. I've removed the line. I've no plans for more updates if all works well.

BClark09 commented 7 years ago

I couldn't get sysVinit systems to start at all after this change. There's no log currently so can't be sure what's going wrong yet.

theoweiss commented 7 years ago

Does it start without these changes?

BClark09 commented 7 years ago

@theoweiss with the recent changes, conflicts need to be resolved, but your solution should still be valid for both sysVinit and systemd.

theoweiss commented 7 years ago

Thanks. I will rework it as soon as possible.