salt.modules.kernelpkg_linux_apt

Manage Linux kernel packages on APT-based systems

salt.modules.kernelpkg_linux_apt.active()

Return the version of the running kernel.

CLI Example:

salt '*' kernelpkg.active
salt.modules.kernelpkg_linux_apt.cleanup(keep_latest=True)

Remove all unused kernel packages from the system.

keep_latest
: True
In the event that the active kernel is not the latest one installed, setting this to True will retain the latest kernel package, in addition to the active one. If False, all kernel packages other than the active one will be removed.

CLI Example:

salt '*' kernelpkg.cleanup
salt.modules.kernelpkg_linux_apt.latest_available()

Return the version of the latest kernel from the package repositories.

CLI Example:

salt '*' kernelpkg.latest_available
salt.modules.kernelpkg_linux_apt.latest_installed()

Return the version of the latest installed kernel.

CLI Example:

salt '*' kernelpkg.latest_installed

Note

This function may not return the same value as active() if a new kernel has been installed and the system has not yet been rebooted. The needs_reboot() function exists to detect this condition.

salt.modules.kernelpkg_linux_apt.list_installed()

Return a list of all installed kernels.

CLI Example:

salt '*' kernelpkg.list_installed
salt.modules.kernelpkg_linux_apt.needs_reboot()

Detect if a new kernel version has been installed but is not running. Returns True if a new kernel is installed, False otherwise.

CLI Example:

salt '*' kernelpkg.needs_reboot
salt.modules.kernelpkg_linux_apt.remove(release)

Remove a specific version of the kernel.

release
The release number of an installed kernel. This must be the entire release number as returned by list_installed(), not the package name.

CLI Example:

salt '*' kernelpkg.remove 4.4.0-70-generic
salt.modules.kernelpkg_linux_apt.upgrade(reboot=False, at_time=None)

Upgrade the kernel and optionally reboot the system.

reboot
: False
Request a reboot if a new kernel is available.
at_time
: immediate
Schedule the reboot at some point in the future. This argument is ignored if reboot=False. See reboot() for more details on this argument.

CLI Example:

salt '*' kernelpkg.upgrade
salt '*' kernelpkg.upgrade reboot=True at_time=1

An immediate reboot often shuts down the system before the minion has a chance to return, resulting in errors. A minimal delay (1 minute) is useful to ensure the result is delivered to the master.

salt.modules.kernelpkg_linux_apt.upgrade_available()

Detect if a new kernel version is available in the repositories. Returns True if a new kernel is avaliable, False otherwise.

CLI Example:

salt '*' kernelpkg.upgrade_available