For example, if I run sudo apt-get -y upgrade if there is a package that requires a restart to upgrade, will the yes flag cause the system to reboot after the command finishes upgrading everything? Or, will it still require a manual reboot?

OS and Software:

  • Debian Buster 10 -> kernel version 4.19 on a Raspbian HW

  • apt 1.8.2 (armhf)


2 Answers 2


No, apt on its own won’t reboot.

You can check whether the file /var/run/reboot-required exists after running apt to see if a reboot is required. If you use unattended-upgrades, you can configure that to reboot for you.

  • If the file /var/run/reboot-required exists, then it's necessary to reboot? Is it normal that the file is empty?
    – A.L
    Mar 2, 2020 at 14:41
  • 1
    @A.L it means that a package has requested that the system be rebooted; whether a reboot is necessary is up to the system administrator. Typical occurrences involve kernel upgrades: the kernel upgrade isn’t effective until the system has been rebooted (ignoring live kernel patching techniques). The file is supposed to be empty, yes. Mar 2, 2020 at 15:12

No, apt-get will not reboot by itself, but if you want your system to reboot automatically after an update if necessary then add [ -e /var/run/reboot-required ] && sudo reboot to your command:

sudo apt-get -y upgrade; [ -e /var/run/reboot-required ] && sudo reboot
  • Thanks, I already know how to do scripting, but this does save me some time. Mar 2, 2020 at 23:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .