Используйте утилиту needrestart, чтобы определить, какие службы необходимо перезапустить после обновления.
Установим утилиту needrestart.
$ sudo apt install needrestart
Отобразим сводку с использованием командной строки.
$ sudo needrestart --help
needrestart 3.4 - Restart daemons after library updates. Authors: Thomas Liske <thomas@fiasko-nw.net> Copyright Holder: 2013 - 2018 (C) Thomas Liske [http://fiasko-nw.net/~thomas/] Upstream: https://github.com/liske/needrestart This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Usage: needrestart [-vn] [-c <cfg>] [-r <mode>] [-f <fe>] [-u <ui>] [-bkl] -v be more verbose -q be quiet -m <mode> set detail level e (e)asy mode a (a)dvanced mode -n set default answer to 'no' -c <cfg> config filename -r <mode> set restart mode l (l)ist only i (i)nteractive restart a (a)utomatically restart -b enable batch mode -p enable nagios plugin mode -f <fe> overwrite debconf frontend (DEBIAN_FRONTEND, debconf(7)) -u <ui> use preferred UI package (-u ? shows available packages) By using the following options only the specified checks are performed: -k check for obsolete kernel -l check for obsolete libraries -w check for obsolete CPU microcode --help show this help --version show version information
Проверьте, что нужно перезапустить, используя удобный вывод:
$ sudo needrestart -b
NEEDRESTART-VER: 3.4 NEEDRESTART-KCUR: 4.19.0-8-amd64 NEEDRESTART-KEXP: 4.19.0-9-amd64 NEEDRESTART-KSTA: 3 NEEDRESTART-SVC: exim4.service NEEDRESTART-SVC: postgresql@11-main.service
Существует разница между текущим и ожидаемым ядром со статусом, указывающим на ожидаемое обновление версии. Возможные статусы: неизвестно (0), нет ожидающего обновления (1), ожидается ABI-совместимое обновление (2), ожидает обновления версии (3).
Проверьте, что нужно перезапустить, используя понятный для человека вывод (требуется взаимодействие с пользователем).
$ sudo needrestart -u NeedRestart::UI::stdio -r l
Scanning processes... Scanning candidates... Scanning linux images... Pending kernel upgrade! Running kernel version: 4.19.0-8-amd64 Diagnostics: The currently running kernel version is not the expected kernel version 4.19.0-9-amd64. Restarting the system to load the new kernel will not be handled automatically, so you should consider rebooting. [Return] Services to be restarted: systemctl restart exim4.service systemctl restart postgresql@11-main.service No containers need to be restarted. No user sessions are running outdated binaries.
Перезапустите сервисы.
$ sudo needrestart -u NeedRestart::UI::stdio -r a
Scanning processes... Scanning candidates... Scanning linux images... Pending kernel upgrade! Running kernel version: 4.19.0-8-amd64 Diagnostics: The currently running kernel version is not the expected kernel version 4.19.0-9-amd64. Restarting the system to load the new kernel will not be handled automatically, so you should consider rebooting. [Return] Restarting services... systemctl restart exim4.service postgresql@11-main.service No containers need to be restarted. No user sessions are running outdated binaries.
Опять же, проверьте, что нужно перезапустить.
$ sudo needrestart -b
NEEDRESTART-VER: 3.4 NEEDRESTART-KCUR: 4.19.0-8-amd64 NEEDRESTART-KEXP: 4.19.0-9-amd64 NEEDRESTART-KSTA: 3
Перезагрузите операционную систему и проверьте, что нужно перезапустить.
$ sudo needrestart -b
NEEDRESTART-VER: 3.4 NEEDRESTART-KCUR: 4.19.0-9-amd64 NEEDRESTART-KEXP: 4.19.0-9-amd64 NEEDRESTART-KSTA: 1
$ sudo needrestart -u NeedRestart::UI::stdio -r l
Scanning processes... Scanning linux images... Running kernel seems to be up-to-date. No services need to be restarted. No containers need to be restarted. No user sessions are running outdated binaries.