Upkeep

Python versions PyPI - Version GitHub tag (with filter) License GitHub commits since latest release (by SemVer including pre-releases) CodeQL QA Tests Coverage Status Dependabot Documentation Status mypy uv pytest Ruff Downloads Stargazers pre-commit Prettier Follow @Tatsh Mastodon Follow

Command line

Library

Kernel-related utilities.

upkeep.utils.kernel.rebuild_kernel(num_cpus: int | None = None) None

Rebuilds the kernel.

Runs the following steps:

  • Checks for a kernel configuration in /usr/src/linux/.config or /proc/config.gz

  • make oldconfig

  • make

  • make modules_install

  • make install

  • emerge --usepkg=n @module-rebuild @x11-module-rebuild

The expectation is that your configuration for installkernel will set up booting from the new kernel (updating systemd-boot, etc).

Parameters:
num_cpus : int

Number of CPUs (or threads) to pass to make -j.... If not passed, defaults to getting the value from multiprocessing.cpu_count().

Raises:

KernelConfigMissing – If a kernel configuration cannot be found.

See also

upgrade_kernel

upkeep.utils.kernel.upgrade_kernel(num_cpus: int | None = None, *, fatal: bool | None = True) None

Upgrades the kernel.

The logic used here is to check the eselect kernel output for two kernel lines, where one is selected and the newest kernel is not. The newest kernel then gets picked and upgrade_kernel() takes care of the rest.

Parameters:
num_cpus : int

Number of CPUs (or threads) to pass to make -j.... If not passed, defaults to getting the value from multiprocessing.cpu_count().

fatal : Optional[bool]

If True, raises certain exceptions or returns 1. If False, always returns 0.

Raises:
  • NoKernelToUpgradeTo – If there is no newer kernel to upgrade to.

  • TooManyLinesFromEselect – If there are too many lines in the output from eselect kernel list.

  • NoValueIsUnselected – If no value is unselected in the output from eselect kernel list.

  • KernelConfigMissing – If a kernel configuration cannot be found.

See also

rebuild_kernel

Indices and tables