shatteredsilicon / ssm-submodules

GNU Affero General Public License v3.0
0 stars 2 forks source link

System Summary: cmd 'Summary' for subsystem 'os' failed: exit status 1 #299

Closed gordan-bobic closed 1 month ago

gordan-bobic commented 1 month ago
root@ssp-boss:/home/gordan# pt-summary >/dev/null
/usr/bin/pt-summary: line 2352: STATUS_THP_SYSTEM: unbound variable
oblitorum commented 1 month ago

This seems to be a bug of pt-summary, according to these lines (https://github.com/percona/percona-toolkit/blob/3.x/bin/pt-summary#L2346-L2358):

report_transparent_huge_pages () {

  if [ -f /sys/kernel/mm/transparent_hugepage/enabled ]; then
    CONTENT_TRANSHP=$(</sys/kernel/mm/transparent_hugepage/enabled)
    STATUS_THP_SYSTEM=$(echo $CONTENT_TRANSHP | grep -cv '\[never\]')
  fi
  if [ $STATUS_THP_SYSTEM = 0 ]; then
    echo "Transparent huge pages are currently disabled on the system."
  else
    echo "Transparent huge pages are enabled."
  fi

}

Variable STATUS_THP_SYSTEM is only set when file /sys/kernel/mm/transparent_hugepage/enabled exists, and it has set -u set on the top of pt-summary (https://github.com/percona/percona-toolkit/blob/3.x/bin/pt-summary#L7), hence it exited with an error.

I think there are 2 cases that could cause this:

  1. the THP module is disabled, there is no /sys/kernel/mm/transparent_hugepage/enabled. Adding a default STATUS_THP_SYSTEM=0 before if condition should fix this.
  2. There are /sys/kernel/mm/transparent_hugepage/hugepages-<size>kB/enabled files, but not /sys/kernel/mm/transparent_hugepage/enabled, is that possible? If so, it should also check the existence of hugepages-<size>kB/enabled files.

I think I'm gonna create a PR to upstream for this, and add a patch to our builds in the mean time.

gordan-bobic commented 1 month ago

Yes, I just checked and this is exactly what is happening - it turns out that on Xen hypervisor kernels, /sys/kernel/mm/transparent_hugepage does not exist, so your analysis is spot on.

And yes, please raise a pull request for percona-toolkit here: https://github.com/percona/percona-toolkit and raise a ticket referencing it on: [https://perconadev.atlassian.net/](https://perconadev.atlassian.net/ against the PT project.

And until they accept/merge/tag/release it, include a patch to be applied in the .spec file for our own builds.

oblitorum commented 1 month ago

upstream PR -> https://github.com/percona/percona-toolkit/pull/848 upstream ticket -> https://perconadev.atlassian.net/browse/PT-2371