See all Debian/Ubuntu Linux related FAQ
The files /var/run/reboot-required (/run/reboot-required) and /var/run/reboot-required.pkgs (/run/reboot-required.pkgs) are created on Debian-based Linux distributions such as Debian, Ubuntu, and Linux Mint. They indicate whether the system requires a restart and which packages triggered the request.

Tutorial details
Difficulty level Easy
Root privileges No
Requirements Linux terminal
Category System Management
OS compatibility Debian Linux Mint Pop!_OS Ubuntu
Est. reading time 2 minutes

The /var/run/reboot-required (/run/reboot-required) file

If this file exists, you need to reboot the system using the reboot command or shutdown command. Typically this file is empty. You can use the ls command to see if the file exists:
$ ls -l /var/run/reboot-required
$ ls -l /run/reboot-required

If the file is found, reboot the Linux system using any one of the following commands:
$ sudo reboot
## OR ##
$ sudo shutdown -r now
## OR ##
$ sudo systemctl reboot

However, sometime distros like Ubuntu add text to these files. Use the “cat,” “more,” “less,“, or “bat,” to view it:
$ cat /var/run/reboot-required
Here is what I see under Ubuntu Linux version 22.04 LTS:

*** System restart required ***

The /var/run/reboot-required.pkgs (/run/reboot-required.pkgs) file

The /var/run/reboot-required.pkgs (/run/reboot-required.pkgs) files contain the name of the package(s) requiring the reboot. Again you can view them as follows:
$ cat /var/run/reboot-required.pkgs
## OR ##
$ cat /run/reboot-required.pkgs

Sample outputs from Debian Linux version 11.x:

Who creates the file Linux var run reboot-required or var run reboot-required.pkgs files in Linux

Click to enlarge

Who creates the file Linux /var/run/reboot-required (/run/reboot-required) or /var/run/reboot-required.pkgs (/run/reboot-required.pkgs) files in Linux?

The apt command or apt-get command creates those files using hooks and configurations.

Signaling that a reboot is required

From the Debian Linux policy manual book:

Programs can signal that a reboot is required by touching /run/reboot-required. It is conventional to add the name of the package(s) requiring the reboot to /run/reboot-required.pkgs. Programs should not add a package name to /run/reboot-required.pkgs if it is already present there.

The /run/reboot-required mechanism is used when a reboot is needed to fully apply the changes introduced by package installation or upgrade. Typically it is the postinst maintainer script that touches /run/reboot-required, at the end of a successful configuration of the package.

There are no guarantees provided by the /run/reboot-required convention as to when or whether the requested reboot will occur.

You can write your own hooks to take action when these files are found when running the apt command. See the following page for example:

Getting notification when you login over the ssh or terminal session

Edit your ~/.bashrc or ~/.bash_profile or other shell startup config file and add the following shell scripting code:

if [ -f /var/run/reboot-required ]
	echo '***'
	echo "ATTENTION ${USER}: Reboot required for the ${HOSTNAME}. The following files will not load without rebooting:"
	cat /var/run/reboot-required.pkgs
	echo '***'

You will see notification as follows:

Reboot notification provided by my system

Click to enlarge

Summing up

The /run/reboot-required file is used to indicate when a system reboot is necessary to apply package changes fully. Typically, the postinst maintainer script creates /run/reboot-required upon successful package configuration. Conventionally, the name(s) of the package(s) that need the system to reboot should be added to /run/reboot-required.pkgs. See the following manual pages for more info using the man command or pass --help option. For example:
$ man 5 apt.conf
$ man 8 apt
$ man 8 apt-get
$ man reboot

See also

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

0 comments… add one

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.