shutdown-scripts service is restarted on package upgrade - causing any configured shutdown scripts to be run
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
google-guest-agent (Ubuntu) | Status tracked in Mantic | |||||
Bionic |
Fix Released
|
Undecided
|
Unassigned | |||
Focal |
Fix Released
|
Undecided
|
Unassigned | |||
Jammy |
Fix Released
|
Undecided
|
Unassigned | |||
Kinetic |
Fix Released
|
Undecided
|
Unassigned | |||
Lunar |
Fix Released
|
Undecided
|
Unassigned | |||
Mantic |
Fix Released
|
Undecided
|
Philip Roche |
Bug Description
[Impact]
========
Initially reported @ https:/
Basically anytime the google-guest-agent package is updated, these services are restarted which means the customer scripts are run at a time they are not supposed to be. This caused an outage for one customer who had some logic in their shutdown script that basically turned off their services.
The issue is most certainly in the autogenerated preinst script which should not be there. Stopping the shutdown service will invoke the shutdown script. This wasn't there in previous Ubuntu versions.
Ubuntu 22.04 preinst script
```
#!/bin/sh
set -e
# Automatically added by dh_installdeb/
dpkg-maintscrip
# End automatically added section
# Automatically added by dh_installsyste
if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = upgrade ] && [ -d /run/systemd/system ] ; then
deb-systemd-invoke stop 'google-
fi
# End automatically added section
```
Ubuntu 20.04 preinst script
```
root@ubu2004:
#!/bin/sh
set -e
# Automatically added by dh_installdeb/
dpkg-maintscrip
# End automatically added section
```
One reason this issue was of concern as the latest google-guest-agent update was a rebuild promoted by golang-1.18 being updated to address CVEs prompting a rebuild of all packages dependant on golang-1.18 and publication of those rebuilds to the -security pocket. unattended-upgrades then upgraded google-guest-agent in the background which restarted the shutdown-scripts.
We do want the services to be enabled on initial installation and to be started on instance start but they should not be restarted/stopped during the lifetime of the instance.
[Test Plan]
===========
After having the fixes in, we'll run the reproducer and the test script mentioned in the first comment: https:/
This will help us validate that the fix is indeed working as it should.
A demonstration of that reproducer script is shown in the 2nd comment:
https:/
Further, we'll also build the images and run the CTF tests (internal tests) on them on our side and then ask Google to validate these images to make sure they also confirm that the bug is indeed fix and there's no regression or fallout with this update.
Once Google comes back with the validation, we'll assume enough testing and verification has been done and will mark the bug with the same.
[Where Problems Could Occur]
=======
The patch just adds "--no-stop-
Related branches
- Christian Ehrhardt (community): Needs Information
- Ubuntu Sponsors: Pending requested
- git-ubuntu import: Pending requested
-
Diff: 31 lines (+11/-1)2 files modifieddebian/changelog (+10/-0)
debian/rules (+1/-1)
description: | updated |
I have a patched google-guest-agent for Ubuntu 22.04 in PPA https:/ /launchpad. net/~philroche/ +archive/ ubuntu/ google- guest-agent/
And reproducer script and logs @ https:/ /people. canonical. com/~philroche/ 20230508- google- guest-agent- regression/
The reproducer confirms that the shutdown script is no longer run on upgrade.
The patch was as follows:
``` 13.6ubuntu1 t-helper rm_conffile /etc/defaults/ instance_ configs. cfg 20200617. 00-0ubuntu2\ ~ -- "$@" md/13.6ubuntu1 shutdown- scripts. service' 'google- startup- scripts. service' >/dev/null || true
--- control/preinst
+++ control/preinst
@@ -3,8 +3,3 @@
# Automatically added by dh_installdeb/
dpkg-maintscrip
# End automatically added section
-# Automatically added by dh_installsyste
-if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = upgrade ] && [ -d /run/systemd/system ] ; then
- deb-systemd-invoke stop 'google-
-fi
-# End automatically added section
```
This was achieved by updating the `debian/rules` files
```
--- debian/rules
+++ debian/rules
@@ -17,7 +17,7 @@
override_ dh_installsyste md: guest-agent. service after-upgrade google- startup- scripts. service google- shutdown- scripts. service after-upgrade --no-restart- on-upgrade google- startup- scripts. service google- shutdown- scripts. service
dh_installsystemd google-
- dh_installsystemd --no-start --no-restart-
+ dh_installsystemd --no-start --no-restart-
override_dh_clean:
dh_clean vendor/
```