-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Noninteractive frontend for apt-get #24
Conversation
…able DEBIAN_FRONTEND=noninteractive is used for disabling all interactions on frontends of commands like apt-get, dpkg, etc. https://bugs.launchpad.net/juju/+bug/2011637 reports that their upgrade was stuck in a grub prompt during an apt-get install. This change preceeds all apt-get commands with the DEBIAN_FRONTEND=noninteractive env variable to ensure no prompts or interactions happen during apt-get. According to the `man 7 debconf`, this env variable "makes the default answers be used for all questions".
0c78f8b
to
577e952
Compare
To test this I needed to: Downgrade distro-info
Upgrade the controller
But it said So I upgraded the controller again (this time to 3.4.5...)
Then I can see in debug-log it has upgraded the distro-info package
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please ensure to add more tests to the juju/juju PR.
#17483 This brings the `DEBIAN_FRONTEND=noninteractive` env variable to apt-get install (from juju/packaging#24), which is needed for https://bugs.launchpad.net/juju/+bug/2011637 for auto upgrades/restarts. <!-- Why this change is needed and what it does. --> ## QA steps This is a change in the dependency (and it's QAed when it landed [over there](juju/packaging#24) on 3.4), however, it should be QAed on 3.5 as well. This is for the lp bug https://bugs.launchpad.net/juju/+bug/2011637, and to QA this, we need to trigger an upgrade. `juju bootstrap localhost testme` After the controller is up, get in there and downgrade the `distro-info` (to be upgraded later by `juju upgrade-controller`: ``` $ juju ssh -m controller 0 ubuntu@juju-07b4a2-0:~$ apt list distro-info -a Listing... Done distro-info/jammy-updates,now 1.1ubuntu0.2 amd64 [installed,automatic] <------- 1.1ubuntu0.2 is installed distro-info/jammy 1.1build1 amd64 # manually downgrade to 1.1build1 ubuntu@juju-07b4a2-0:~$ sudo apt install distro-info=1.1build1 ubuntu@juju-07b4a2-0:~$ apt list distro-info -a Listing... Done distro-info/jammy-updates 1.1ubuntu0.2 amd64 [upgradable from: 1.1build1] distro-info/jammy,now 1.1build1 amd64 [installed,upgradable to: 1.1ubuntu0.2] ``` Now we need to trigger an upgrade on the Juju side, for this, edit the `version/version.go` with `3.5.3` (don't bump the minor, just the patch): ``` // The presence and format of this constant is very important. // The debian/rules build recipe uses this value for the version // number of the release package. const version = "3.5.3" ``` Build and run an upgrade: ``` $ make build && make install $ juju upgrade-controller --build-agent no prepackaged agent binaries available, using local agent binary 3.5.3.2 (built from source) best version: 3.5.3.2 started upgrade to 3.5.3.2 ``` Now take a look at the `juju debug-log -m controller` to see if you can spot that the `updating distro-info` succeeded: ``` ... machine-0: 22:05:01 INFO juju.worker.upgradesteps checking that upgrade can proceed machine-0: 22:05:01 INFO juju.upgrade updating distro-info machine-0: 22:05:01 INFO juju.packaging.manager Running: apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::Options::=--force-unsafe-io --assume-yes --quiet update machine-0: 22:05:04 INFO juju.packaging.manager Running: apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::Options::=--force-unsafe-io --assume-yes --quiet install distro-info machine-0: 22:05:08 INFO juju.worker.upgradesteps signalling that this controller is ready for upgrade machine-0: 22:05:08 INFO juju.worker.upgradesteps waiting for other controllers to be ready for upgrade machine-0: 22:05:08 INFO juju.worker.upgradesteps finished waiting - all controllers are ready to run upgrade steps machine-0: 22:05:08 INFO juju.worker.upgradesteps starting upgrade from 3.5.2.1 to 3.5.3.2 for "machine-0" machine-0: 22:05:08 INFO juju.upgrade All upgrade steps completed successfully machine-0: 22:05:08 INFO juju.worker.upgradesteps upgrade to 3.5.3.2 completed successfully. ... ``` ## Links <!-- Link to all relevant specification, documentation, bug, issue or JIRA card. --> **Launchpad bug:** https://bugs.launchpad.net/juju/+bug/2011637 **Jira card:** JUJU-6135
#17482 This brings the `DEBIAN_FRONTEND=noninteractive` env variable to apt-get install (from juju/packaging#24), which is needed for https://bugs.launchpad.net/juju/+bug/2011637 for auto upgrades/restarts. <!-- Why this change is needed and what it does. --> ## QA steps This is a change in the dependency (and it's QAed when it landed [over there](juju/packaging#24) on 3.4), however, 3.4 might have changed by then, so it should be QAed here as well. This is for the lp bug https://bugs.launchpad.net/juju/+bug/2011637, and to QA this, we need to trigger an upgrade. `juju bootstrap localhost testme` After the controller is up, get in there and downgrade the `distro-info` (to be upgraded later by `juju upgrade-controller`: ``` $ juju ssh -m controller 0 ubuntu@juju-085cfb-0:~$ apt list distro-info -a Listing... Done distro-info/jammy-updates,now 1.1ubuntu0.2 amd64 [installed,automatic] <------- 1.1ubuntu0.2 is installed distro-info/jammy 1.1build1 amd64 # manually downgrade to 1.1build1 ubuntu@juju-085cfb-0:~$ sudo apt install distro-info=1.1build1 ubuntu@juju-085cfb-0:~$ apt list distro-info -a Listing... Done distro-info/jammy-updates 1.1ubuntu0.2 amd64 [upgradable from: 1.1build1] distro-info/jammy,now 1.1build1 amd64 [installed,upgradable to: 1.1ubuntu0.2] ``` Now we need to trigger an upgrade on the Juju side, for this, edit the `version/version.go`: ``` // The presence and format of this constant is very important. // The debian/rules build recipe uses this value for the version // number of the release package. const version = "3.4.5" ``` Build and run an upgrade: ``` $ make build && make install $ juju upgrade-controller --build-agent no prepackaged agent binaries available, using local agent binary 3.4.5.3 (built from source) best version: 3.4.5.3 started upgrade to 3.4.5.3 ``` Now take a look at the `juju debug-log -m controller` to see if you can spot that the `updating distro-info` succeeded: ``` ... machine-0: 21:27:38 INFO juju.worker.upgradesteps checking that upgrade can proceed machine-0: 21:27:38 INFO juju.upgrade updating distro-info machine-0: 21:27:38 INFO juju.packaging.manager Running: apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::Options::=--force-unsafe-io --assume-yes --quiet update machine-0: 21:27:38 INFO juju.state.pool.txnwatcher txn watcher started machine-0: 21:27:40 INFO juju.state LogTailer starting oplog tailing: recent id count=10, lastTime=2024-06-06 21:27:35.982729989 +0000 UTC, minOplogTs=2024-06-06 21:26:35.982729989 +0000 UTC machine-0: 21:27:40 INFO juju.packaging.manager Running: apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::Options::=--force-unsafe-io --assume-yes --quiet install distro-info machine-0: 21:27:44 INFO juju.worker.upgradesteps signalling that this controller is ready for upgrade machine-0: 21:27:44 INFO juju.worker.upgradesteps waiting for other controllers to be ready for upgrade machine-0: 21:27:44 INFO juju.worker.upgradesteps finished waiting - all controllers are ready to run upgrade steps machine-0: 21:27:44 INFO juju.worker.upgradesteps starting upgrade from 3.4.4.1 to 3.4.5.3 for "machine-0" machine-0: 21:27:44 INFO juju.upgrade All upgrade steps completed successfully machine-0: 21:27:44 INFO juju.worker.upgradesteps upgrade to 3.4.5.3 completed successfully. ... ``` ## Links <!-- Link to all relevant specification, documentation, bug, issue or JIRA card. --> **Launchpad bug:** https://bugs.launchpad.net/juju/+bug/2011637 **Jira card:** JUJU-6135
DEBIAN_FRONTEND=noninteractive
is used for disabling all interactionson apt-get install.
https://bugs.launchpad.net/juju/+bug/2011637 reports that their
upgrade was stuck in a grub prompt during an apt-get install. This
change precedes apt-get install command with the
DEBIAN_FRONTEND=noninteractive
env variable to ensure no prompts orinteractions happen during apt-get.
According to the
man 7 debconf
, this env variable "makes the defaultanswers be used for all questions".
This also fixes some linter issues.
QA steps
For this package per se, run things like:
For testing the actual change:
Pull this change and point Juju's
packaging
package to your local path where you keep this change:Alternatively you can directly point to this change: (add the following to the go.mod in Juju):
After this, just build, bootstrap, deploy and play around to make sure nothing is broken (which means something's changed in the
apt-get install
andapt-get remove
stuff).