1

Looking about, I see that the standard fix is to add this to the kernel boot parameters.

Using systemd-boot, my arch.conf looks like this :

 title   Arch Linux
 linux   /vmlinuz-linux
 initrd  /intel-ucode.img
 initrd  /initramfs-linux.img
 options root=PARTUUID="98b3b4f7-e7f9-6f49-be81-a2ee709c7a3e" rw

How do I add CONFIG_TASK_DELAY_ACCT to the options entry?

Another line?

Or by using some delimeter, add it to the existing line?

What value should I be setting it to?

Stephen Boston
  • 1,928
  • 3
  • 25
  • 50

2 Answers2

2

Actually, there is a simple fix for the iotop error you have encountered but getting there from here is roundabout.

[TL;DR: If using systemd-boot, simply add a new line reading options delayacct to the end of your sd-boot entry configuration file. GRUB has corresponding syntax. Alternative, non-boot-manager config options also exist that may be preferable.]

@Artem is correct that CONFIG_TASK_DELAY_ACCT is a kernel configuration, or build, option. He also is correct that, as such, it bears on how the kernel is compiled and can't be added at runtime, i.e., at boot.

Still, iotop often throws this error even when CONFIG_TASK_DELAY_ACCT is set to "y" because many distributions compile the kernel with this option but disable it by default.

This means that recompiling the kernel probably is a waste of time notwithstanding the literal meaning of the iotop error message. To confirm, just check the kernel config file. This file (config-kernel-version) typically is in the same directory as the kernel (vmlinuz-kernel-version) and initrd (initrd.img-kernel-version) files, e.g., /boot or perhaps /efi depending on where the EFI system partition is mounted. So, do, e.g.:

grep TASK_DELAY_ACCT /boot/config*

This may return something like:

/boot/config-5.15.0-41-generic:CONFIG_TASK_DELAY_ACCT=y
/boot/config-5.15.0-43-generic:CONFIG_TASK_DELAY_ACCT=y

The =y tells us that the kernel was compiled with this option. This doesn't make the iotop error message any less enigmatic but it does confirm that the kernel is OK. If so, then check the corresponding kernel parameter, kernel.task_delayacct, because enabling it should fix the iotop error. To check the parameter, do:

cat /proc/sys/kernel/task_delayacct

If this returns 0, it's disabled; 1, enabled. To enable the parameter, do one of:

  • For the current session:

    echo 1 > /proc/sys/kernel/task_delayacct

    This should have immediate effect without reboot.

  • More persistently, add the following on a new line in either /etc/sysctl.conf or a .conf drop-in file in /etc/sysctl.d:

    kernel.task_delayacct=1

    or just do:

    # echo "kernel.task_delayacct=1" >> /etc/sysctl.d/20-kernel-task-delayacct.conf

    Reboot to take effect.

  • Add delayacct to the kernel command line, depending on boot manager. This is the approach you were pursuing in asking about systemd-boot.

    For GRUB2, add or edit the following line in /etc/default/grub to read: GRUB_CMDLINE_LINUX_DEFAULT="delayacct"

    then save and close the file and do:

    # update-grub

    Reboot to take effect.

    For systemd-boot, edit your entry.conf file and simply add a new line reading:

    options delayacct

    Systemd-boot permits the options key to appear in a boot loader entry file more than once, so simply adding an additional line, instead of editing an existing options key, should be fine.

    Reboot to take effect.

ebsf
  • 271
  • 2
  • 11
1

This is a kernel build option, so you cannot "add" it at runtime.

Either build your own kernel, or ask your maintainer to build the kernel with this option which they may or may not do because some kernel options depend on others and those dependencies might be very undesirable, e.g. they could slow down the kernel considerably.

Artem S. Tashkinov
  • 26,392
  • 4
  • 33
  • 64