Upkeep

Command line

Library

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.

  • RuntimeError – If grub-mkconfig fails

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.

See also

rebuild_kernel

Indices and tables