sysstat service enablement state mismatches debconf and /etc/default/sysstat setting

Bug #2073284 reported by Robie Basak
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Release Notes for Ubuntu
New
Undecided
Unassigned
sysstat (Debian)
New
Unknown
sysstat (Ubuntu)
Fix Released
Undecided
Robie Basak
Noble
Triaged
Undecided
Robie Basak

Bug Description

[Impact]

When the sysstat package is pre-installed, for example on a fresh Ubuntu 24.04 installation in any cloud image, systemd presets activate the various sysstat systemd services, even when /etc/default/sysstat sets ENABLED="false".

This causes a divergence between users upgrading to 24.04 from a previous release and fresh installations of 24.04. On upgrade, systemd presets do not get "re"-preset, so sysstat services are disabled. On a fresh installation, systemd presets get "re"-preset on first boot, causing the sysstat services to be enabled despite the default ENABLED="false" package setting.

This results in inconsistent behaviour for users.

Thanks to hideou aoi and Athos Ribeiro for finding and identifying this issue.

[Fix]

Instead of having packaging change the service state of the various sysstat systemd services, we use the systemd ExecCondition directive to run the services only after dynamically consulting /etc/default/sysstat. As well as the collision with systemd presets, this also resolves issues around stepping on possible user customisation in /etc/systemd/system and policy-rc.d.

[Test Plan]

Covered by new dep8 test d/t/enablement

[Where problems could occur]

See the corresponding section in bug 2073285 for details, since risks are best considered with the two changes we’re making together.

Tags: server-todo

Related branches

Robie Basak (racb)
Changed in sysstat (Ubuntu):
status: New → Incomplete
assignee: nobody → Robie Basak (racb)
Robie Basak (racb)
description: updated
Changed in sysstat (Debian):
status: Unknown → New
Revision history for this message
Robie Basak (racb) wrote :

Testing the Oracular upload:

dep8 tests are added, which check the default, that preset-all no longer
disrupts things, and that service conditions match /etc/default/sysstat

For upgrade testing within Oracular:

Launch Oracular, ENABLED=false, but sysstat-collect.timer is enabled.
Upgrade to PPA, ENABLED=true, sysstat-collect.timer remains enabled.

Launch Oracular, ENABLED=false, but sysstat-collect.timer is enabled.
apt install --reinstall sysstat, sysstat-collect.timer becomes disabled.
Upgrade to PPA, ENABLED=true, sysstat-collect.timer becomes enabled.

Robie Basak (racb)
Changed in sysstat (Ubuntu):
status: Incomplete → In Progress
Revision history for this message
Robie Basak (racb) wrote :

I did the following to check behaviour on a "golden image", where /etc/machine-id is expected to be recreated on boot, thus testing the underlying "systemctl preset-all" behaviour more directly. I think this is close enough to testing a future ISO built from this new package for the fresh installation case.

wget https://cloud-images.ubuntu.com/oracular/current/oracular-server-cloudimg-amd64.img
cp oracular-server-cloudimg-amd64.{,mod.}img

sudo -s
http_proxy=http://<REDACTED>:3128/ https_proxy=http://<REDACTED>:3128/ mount-image-callback oracular-server-cloudimg-amd64.mod.img -- mchroot sh -c 'add-apt-repository -y ppa:racb/experimental3 && apt install -y sysstat'
exit

uvt-kvm create --backing-image-file=oracular-server-cloudimg-amd64.img rbasak-sysstat-o
uvt-kvm wait rbasak-sysstat-o
uvt-kvm ssh rbasak-sysstat-o 'cat /etc/default/sysstat; systemctl status sysstat-collect.timer'
# ENABLED="false" yet sysstat-collect.timer is enabled and active
uvt-kvm destroy rbasak-sysstat-o

uvt-kvm create --backing-image-file=oracular-server-cloudimg-amd64.mod.img rbasak-sysstat-o
uvt-kvm wait rbasak-sysstat-o
uvt-kvm ssh rbasak-sysstat-o 'cat /etc/default/sysstat; systemctl status sysstat-collect.timer'
# ENABLED="true" and sysstat-collect.timer is enabled and active
uvt-kvm ssh rbasak-sysstat-o 'sudo systemctl restart sysstat-collect.service; systemctl show --property=ConditionResult sysstat-collect.service'
# ConditionResult=yes
uvt-kvm destroy rbasak-sysstat-o

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package sysstat - 12.7.5-2ubuntu1

---------------
sysstat (12.7.5-2ubuntu1) oracular; urgency=medium

  * d/sysstat.templates: enable services by default (LP: #2073285).
  * d/p/service-conditional-on-setting, d/sysstat.postinst: replace
    maintainer script management of systemd service enablement state
    with ExecCondition= systemd directives instead to avoid state
    conflict with systemd presets (LP: #2073284).
  * d/t/control, d/t/enablement: add dep8 tests to cover expected
    behaviour following the above changes.

 -- Robie Basak <email address hidden> Thu, 15 Aug 2024 11:32:23 +0000

Changed in sysstat (Ubuntu):
status: In Progress → Fix Released
Robie Basak (racb)
tags: added: server-todo
Changed in sysstat (Ubuntu Noble):
assignee: nobody → Robie Basak (racb)
status: New → Triaged
Revision history for this message
Skia (hyask) wrote :

This bug was mentioned as a known issue in Noble 24.04.0 release note. We're approaching 24.04.2, scheduled for Feb 13th. Is there any progress on this issue regarding Noble?

Robie Basak (racb)
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.