2017-02-27 16:37:43 |
Philip Roche |
bug |
|
|
added bug |
2017-02-27 16:42:08 |
Philip Roche |
gce-compute-image-packages (Ubuntu): assignee |
|
Philip Roche (philroche) |
|
2017-02-27 16:42:18 |
Philip Roche |
gce-compute-image-packages (Ubuntu): status |
New |
Confirmed |
|
2017-03-20 15:29:24 |
Philip Roche |
description |
A user reported (https://github.com/GoogleCloudPlatform/compute-image-packages/issues/376) that startup scripts are running when the guest packages get updated on Ubuntu. This can of course have very unexpected consequences.
I did some digging and found that the postinst you are using is not the same as ours and appears to start all the systemd services including startup and shutdown scripts when it runs.
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
deb-systemd-invoke start google-accounts-daemon.service google-clock-skew-daemon.service google-instance-setup.service google-ip-forwarding-daemon.service google-network-setup.service google-shutdown-scripts.service google-startup-scripts.service >/dev/null || true
We have a postinst that works on other systemd platforms which you are welcome to use or mimic here: https://github.com/GoogleCloudPlatform/compute-image-packages/blob/master/google_compute_engine_init/systemd/postinst.sh |
[Impact]
* This bug affects: Zesty, Yakkety, Xenial and Trusty
* When a user upgrades to a newer version of gce-cimpute-image-packages
then the google-startup-scripts service is run which causes any configured
startup scripts to be executed.
* Running these scripts more than once on a running instance is not exptected
behaviour and depending on the contents of the user's scripts could have
disastrous consequences.
* The fix tis to use override_dh_systemd_start in the debian/rules to alter the
generated postinst, prerm and postrm files to not restart the startup or
shutdown scripts on upgrade or install.
[Test Case]
* Start instance with shutdown script and startup script
gcloud compute instances create ubuntu-1604-xenial-v20170224 --image-project ubuntu-os-cloud
--image "ubuntu-1604-xenial-v20170224" --metadata shutdown-script="#! /bin/bash
touch /home/ubuntu/shutdown.txt",startup-script="#! /bin/bash
touch /home/ubuntu/startup.txt"
# Run the following on the running instance
# clean up instance ready for testing
rm -f ~/startup.txt
# Add new PPA with fixed package
sudo add-apt-repository -y ppa:philroche/gce-compute-image-packages
sudo apt-get update
sudo apt-get install --only-upgrade gce-compute-image-packages
# Note that the first upgrade will always result in shutdown
# scripts being run as the initial gce-compute-image-packages postrm script are still in use.
# verify that the bug still exists
if [ -f ~/shutdown.txt ]; then
echo "Shutdown File found! Bug still present"
rm -f ~/shutdown.txt
fi
[Regression Potential]
* Possible regressions are that the startup and shutdown script services never start and user's scripts to not get
executed. This has been tested and is not the case.
[Original bug description]
A user reported (https://github.com/GoogleCloudPlatform/compute-image-packages/issues/376) that startup scripts are running when the guest packages get updated on Ubuntu. This can of course have very unexpected consequences.
I did some digging and found that the postinst you are using is not the same as ours and appears to start all the systemd services including startup and shutdown scripts when it runs.
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
deb-systemd-invoke start google-accounts-daemon.service google-clock-skew-daemon.service google-instance-setup.service google-ip-forwarding-daemon.service google-network-setup.service google-shutdown-scripts.service google-startup-scripts.service >/dev/null || true
We have a postinst that works on other systemd platforms which you are welcome to use or mimic here: https://github.com/GoogleCloudPlatform/compute-image-packages/blob/master/google_compute_engine_init/systemd/postinst.sh |
|
2017-03-20 15:39:48 |
Philip Roche |
attachment added |
|
lp1668327-no-restart-of-startup-shutdown-scripts-on-upgrade-zesty.debdiff https://bugs.launchpad.net/ubuntu/+source/gce-compute-image-packages/+bug/1668327/+attachment/4841033/+files/lp1668327-no-restart-of-startup-shutdown-scripts-on-upgrade-zesty.debdiff |
|
2017-03-20 15:40:30 |
Philip Roche |
attachment added |
|
lp1668327-no-restart-of-startup-shutdown-scripts-on-upgrade-yakkety.debdiff https://bugs.launchpad.net/ubuntu/+source/gce-compute-image-packages/+bug/1668327/+attachment/4841035/+files/lp1668327-no-restart-of-startup-shutdown-scripts-on-upgrade-yakkety.debdiff |
|
2017-03-20 15:41:23 |
Philip Roche |
attachment added |
|
lp1668327-no-restart-of-startup-shutdown-scripts-on-upgrade-xenial.debdiff https://bugs.launchpad.net/ubuntu/+source/gce-compute-image-packages/+bug/1668327/+attachment/4841037/+files/lp1668327-no-restart-of-startup-shutdown-scripts-on-upgrade-xenial.debdiff |
|
2017-03-20 15:42:32 |
Philip Roche |
bug |
|
|
added subscriber Ubuntu Sponsors Team |
2017-03-20 19:11:14 |
Philip Roche |
attachment added |
|
lp1668327-no-restart-of-startup-shutdown-scripts-on-upgrade-xenial.debdiff https://bugs.launchpad.net/ubuntu/+source/gce-compute-image-packages/+bug/1668327/+attachment/4841148/+files/lp1668327-no-restart-of-startup-shutdown-scripts-on-upgrade-xenial.debdiff |
|
2017-03-21 22:59:34 |
Mathew Hodson |
tags |
|
patch trusty xenial yakkety zesty |
|
2017-03-21 23:00:47 |
Mathew Hodson |
gce-compute-image-packages (Ubuntu): importance |
Undecided |
Medium |
|
2017-03-22 12:11:27 |
Philip Roche |
attachment added |
|
lp1668327-no-restart-of-startup-shutdown-scripts-on-upgrade-trusty.debdiff https://bugs.launchpad.net/ubuntu/+source/gce-compute-image-packages/+bug/1668327/+attachment/4842264/+files/lp1668327-no-restart-of-startup-shutdown-scripts-on-upgrade-trusty.debdiff |
|
2017-03-22 13:43:46 |
Gianfranco Costamagna |
nominated for series |
|
Ubuntu Xenial |
|
2017-03-22 13:43:46 |
Gianfranco Costamagna |
bug task added |
|
gce-compute-image-packages (Ubuntu Xenial) |
|
2017-03-22 13:43:46 |
Gianfranco Costamagna |
nominated for series |
|
Ubuntu Zesty |
|
2017-03-22 13:43:46 |
Gianfranco Costamagna |
bug task added |
|
gce-compute-image-packages (Ubuntu Zesty) |
|
2017-03-22 13:43:46 |
Gianfranco Costamagna |
nominated for series |
|
Ubuntu Yakkety |
|
2017-03-22 13:43:46 |
Gianfranco Costamagna |
bug task added |
|
gce-compute-image-packages (Ubuntu Yakkety) |
|
2017-03-22 13:44:43 |
Gianfranco Costamagna |
gce-compute-image-packages (Ubuntu Yakkety): status |
New |
Fix Committed |
|
2017-03-22 13:44:45 |
Gianfranco Costamagna |
gce-compute-image-packages (Ubuntu Zesty): status |
Confirmed |
Fix Committed |
|
2017-03-22 13:44:48 |
Gianfranco Costamagna |
gce-compute-image-packages (Ubuntu Xenial): status |
New |
Fix Committed |
|
2017-03-22 14:08:12 |
Gianfranco Costamagna |
nominated for series |
|
Ubuntu Trusty |
|
2017-03-22 14:08:12 |
Gianfranco Costamagna |
bug task added |
|
gce-compute-image-packages (Ubuntu Trusty) |
|
2017-03-22 14:08:18 |
Gianfranco Costamagna |
gce-compute-image-packages (Ubuntu Trusty): status |
New |
Fix Committed |
|
2017-03-22 14:10:02 |
Gianfranco Costamagna |
gce-compute-image-packages (Ubuntu Trusty): assignee |
|
Philip Roche (philroche) |
|
2017-03-22 14:10:09 |
Gianfranco Costamagna |
gce-compute-image-packages (Ubuntu Xenial): assignee |
|
Philip Roche (philroche) |
|
2017-03-22 14:10:20 |
Gianfranco Costamagna |
gce-compute-image-packages (Ubuntu Yakkety): assignee |
|
Philip Roche (philroche) |
|
2017-03-22 16:03:44 |
Andy Whitcroft |
gce-compute-image-packages (Ubuntu Zesty): status |
Fix Committed |
In Progress |
|
2017-03-22 16:03:46 |
Andy Whitcroft |
gce-compute-image-packages (Ubuntu Yakkety): status |
Fix Committed |
In Progress |
|
2017-03-22 16:03:48 |
Andy Whitcroft |
gce-compute-image-packages (Ubuntu Xenial): status |
Fix Committed |
In Progress |
|
2017-03-22 16:03:50 |
Andy Whitcroft |
gce-compute-image-packages (Ubuntu Trusty): status |
Fix Committed |
In Progress |
|
2017-03-22 16:12:52 |
Andy Whitcroft |
gce-compute-image-packages (Ubuntu Zesty): status |
In Progress |
Fix Committed |
|
2017-03-22 16:12:54 |
Andy Whitcroft |
bug |
|
|
added subscriber Ubuntu Stable Release Updates Team |
2017-03-22 16:12:55 |
Andy Whitcroft |
bug |
|
|
added subscriber SRU Verification |
2017-03-22 16:13:00 |
Andy Whitcroft |
tags |
patch trusty xenial yakkety zesty |
patch trusty verification-needed xenial yakkety zesty |
|
2017-03-22 16:39:17 |
Launchpad Janitor |
gce-compute-image-packages (Ubuntu Zesty): status |
Fix Committed |
Fix Released |
|
2017-03-22 17:05:30 |
Philip Roche |
attachment added |
|
gce-compute-image-packages-zesty-testplan-proposed.txt https://bugs.launchpad.net/ubuntu/+source/gce-compute-image-packages/+bug/1668327/+attachment/4842491/+files/gce-compute-image-packages-zesty-testplan-proposed.txt |
|
2017-03-22 17:06:38 |
Philip Roche |
tags |
patch trusty verification-needed xenial yakkety zesty |
patch trusty verification-done verification-needed xenial yakkety zesty |
|
2017-03-22 17:07:40 |
Philip Roche |
tags |
patch trusty verification-done verification-needed xenial yakkety zesty |
patch trusty verification-done xenial yakkety zesty |
|
2017-03-22 19:56:07 |
Andy Whitcroft |
gce-compute-image-packages (Ubuntu Yakkety): status |
In Progress |
Fix Committed |
|
2017-03-22 19:56:15 |
Andy Whitcroft |
tags |
patch trusty verification-done xenial yakkety zesty |
patch trusty xenial yakkety zesty |
|
2017-03-22 19:56:16 |
Andy Whitcroft |
tags |
patch trusty xenial yakkety zesty |
patch trusty verification-needed xenial yakkety zesty |
|
2017-03-22 19:57:11 |
Andy Whitcroft |
gce-compute-image-packages (Ubuntu Xenial): status |
In Progress |
Fix Committed |
|
2017-03-22 20:17:15 |
Andy Whitcroft |
gce-compute-image-packages (Ubuntu Trusty): status |
In Progress |
Fix Committed |
|
2017-03-23 16:19:19 |
Philip Roche |
attachment added |
|
gce-compute-image-packages-xenial-testplan-proposed.txt https://bugs.launchpad.net/ubuntu/+source/gce-compute-image-packages/+bug/1668327/+attachment/4843449/+files/gce-compute-image-packages-xenial-testplan-proposed.txt |
|
2017-03-23 16:20:11 |
Philip Roche |
attachment added |
|
gce-compute-image-packages-yakkety-testplan-proposed.txt https://bugs.launchpad.net/ubuntu/+source/gce-compute-image-packages/+bug/1668327/+attachment/4843450/+files/gce-compute-image-packages-yakkety-testplan-proposed.txt |
|
2017-03-23 16:21:10 |
Philip Roche |
attachment added |
|
gce-compute-image-packages-trusty-testplan-proposed.txt https://bugs.launchpad.net/ubuntu/+source/gce-compute-image-packages/+bug/1668327/+attachment/4843451/+files/gce-compute-image-packages-trusty-testplan-proposed.txt |
|
2017-03-23 16:21:44 |
Philip Roche |
tags |
patch trusty verification-needed xenial yakkety zesty |
patch trusty verification-done xenial yakkety zesty |
|
2017-03-23 16:34:05 |
Gianfranco Costamagna |
tags |
patch trusty verification-done xenial yakkety zesty |
patch trusty verification-done verification-done-trusty verification-done-xenial verification-done-yakkety xenial yakkety zesty |
|
2017-03-23 22:31:43 |
Mathew Hodson |
gce-compute-image-packages (Ubuntu Trusty): importance |
Undecided |
Medium |
|
2017-03-23 22:31:45 |
Mathew Hodson |
gce-compute-image-packages (Ubuntu Xenial): importance |
Undecided |
Medium |
|
2017-03-23 22:31:47 |
Mathew Hodson |
gce-compute-image-packages (Ubuntu Yakkety): importance |
Undecided |
Medium |
|
2017-03-27 14:23:58 |
Launchpad Janitor |
gce-compute-image-packages (Ubuntu Trusty): status |
Fix Committed |
Fix Released |
|
2017-03-27 14:24:06 |
Adam Conrad |
removed subscriber Ubuntu Stable Release Updates Team |
|
|
|
2017-03-27 14:24:14 |
Launchpad Janitor |
gce-compute-image-packages (Ubuntu Xenial): status |
Fix Committed |
Fix Released |
|
2017-03-27 14:24:22 |
Launchpad Janitor |
gce-compute-image-packages (Ubuntu Yakkety): status |
Fix Committed |
Fix Released |
|
2017-04-27 21:32:40 |
Launchpad Janitor |
merge proposal linked |
|
https://code.launchpad.net/~daniel-thewatkins/ubuntu/+source/gce-compute-image-packages/+git/gce-compute-image-packages-1/+merge/323353 |
|
2017-04-28 13:22:44 |
Launchpad Janitor |
merge proposal linked |
|
https://code.launchpad.net/~daniel-thewatkins/ubuntu/+source/gce-compute-image-packages/+git/gce-compute-image-packages-1/+merge/323387 |
|