I'm currently building a router using Ubuntu Server 18.04 (bionic) and am stepping through various configuration tasks. The advent of Systemd and Netplan mean I'm breaking some new ground and having to synthesize multiple sources, and discerning deprecation is nontrivial.
I'm currently roughing out my kernel and other configuration via /etc/sysctl.conf. A distinction seems to exist between (a) kernel parameters or variables, which are read from /etc/sysctl.conf and /etc/sysctl.d/*.conf at runtime; and (b) kernel options.
Specifically, the documentation for several kernel variables make reference to various CONFIG_* settings/options but with no guidance about how or where to enable them. E.g., the documentation for kernel.hung_task_panic at https://sysctl-explorer.net/kernel/hung_task_panic/ states:
Controls the kernel’s behavior when a hung task is detected. This file shows up if CONFIG_DETECT_HUNG_TASK is enabled.
[Note: This particular file happens to appear in 18.04.2 but I'm using it as an example because it's handy.]
THE QUESTION is how and where to enable kernel options like the CONFIG_DETECT_HUNG_TASK option from above, on modern Linux systems and Ubuntu 18.04 in particular. No definitive guidance seems to exist and the few references I've found are years old and with a nontrivial risk of deprecation given intervening years and releases.
The current hypotheses are:
Add a line with the option in /etc/sysctl.conf, similar to how one might add TCP_NODELAY to /etc/smb.conf.
Add a line with the option to the bootloader configuration file /etc/default/grub.
Add a line with the option to whichever other configuration file (which?) is read at runtime to write /boot/config-*-generic.
Build and recompile the kernel from scratch using
and related steps, which themselves are poorly and anciently, or at least inconspicuously, documented besides seeming unnecessarily complex.
Thanks in advance for any thoughts.