This question is similar to this one.

When installing package updates, it's easy to find out package dependencies with apt-cache depends, however, I don't know how to find out what services may be affected. This is a significant problem in some circumstances; answers in that other question suggest that service restarts only take a few seconds, but that's not always true, for example a big MySQL instance may take several hours to shut down! Say there's an update to php5-curl. This is dependent on libapache2-mod-php5, which in turn depends on apache2-mpm-prefork. That package has 'apache2' on its provides list in aptitude show, so that tells me it's related to that service, but not necessarily that it needs a restart. I suspect that package dependencies alone are not sufficient to resolve this - I can imagine similar dependency chains that do not require a service restart (for example if the service loads such externals dynamically).

When I do an aptitude full-upgrade, I get nice output in "The following packages will be upgraded...". What I'm after would be a section in that output saying "The following services will be restarted...". How can I get that?

  • just use your knowledge. if you have such big and important services, you shouldn't ask for this feature. – jojoo Sep 8 '11 at 14:41
  • Sorry, but that's a cop-out. Apt clearly knows which services need restarting, so it should be able to tell me ahead of time. That I have to use my knowledge simply means that the package manager is not good enough. It's academic anyway since I can generally guess what's going to happen, but my point is that I shouldn't have to. – Synchro Sep 9 '11 at 7:02

a way to find out definitively is to read the (pre/post) install scripts that come with the packages. maybe a grep "restart" is enough.

another way is to have a identical test system, where you could run your commands and see what happens.

  • That won't be enough because the services that need restarting may not be listed directly by the packages being upgraded - you'd need to crawl the entire dependency tree, not just those that are being changed. I guess the easiest thing would be to use the --simulate option in aptitude to dry-run the update. – Synchro Sep 9 '11 at 6:57

you will have to create a script which looks updates for your system and like jojo said search for string "restart"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.