ubuntu advantage tools enable esm-infra gets killed
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-advantage-tools (Ubuntu) |
Fix Released
|
High
|
Unassigned | ||
Xenial |
Fix Released
|
Undecided
|
Unassigned | ||
Bionic |
Fix Released
|
Undecided
|
Unassigned | ||
Focal |
Fix Released
|
Undecided
|
Unassigned | ||
Jammy |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[Impact]
This bug impacts any user which, for any reason, enables/disables a service several times. It was initially reported because an automation script, misled by another bug in esm, (now fixed) has enabled a service many times in a row, causing /etc/apt/
The growth happened because the client incorrectly appends to the auth file many times when it should not.
The fix to the function makes sure the auth information for a service only gets inserted in the auth file once.
[Test Case]
To reproduce the bug, using `ubuntu-
Doing the same in `27.11` will leave the file with the same size after the first enablement for any subsequent amount of calls.
An automated test was added in `27.11` to cover this case, and its execution using the package in `-proposed` will be appended to this bug.
* Automated Test Results
Our integration test suite has now a test to cover this behavior.
The output of that test, executed using the package from -proposed, was added to the bug as a comment.
The automated test is executed on Xenial, and the behavior can be reproduced in any LTS alike.
I am marking this bug as verified.
[Regression Potential]
There is no expected risk of regression, as the change was validated and covered by an integration test.
[Original Description]
On some clients ubuntu advantage enable has stopped working
When running with --debug flag we only get "Killed" as last output
$ sudo ua --debug enable esm-infra --assume-yes
DEBUG: Executed with sys.argv: ['/usr/bin/ua', '--debug', 'enable', 'esm-infra', '--assume-yes']
DEBUG: Reading file: /var/lib/
Removing stale lock file previously held by 668502:ua enable
DEBUG: Reading file: /var/lib/
DEBUG: Writing file: /var/lib/
DEBUG: Reading file: /var/lib/
One moment, checking your subscription first
DEBUG: Ran cmd: apt-cache policy, rc: 0 stderr: b''
DEBUG: Reading file: /var/lib/
DEBUG: Writing file: /var/lib/
DEBUG: Reading file: /var/lib/
DEBUG: File does not exist: /var/lib/
DEBUG: Reading file: /var/lib/
DEBUG: Writing file: /var/lib/
DEBUG: Reading file: /var/lib/
DEBUG: Writing file: /var/lib/
DEBUG: Reading file: /var/lib/
DEBUG: Writing file: /var/lib/
DEBUG: URL [POST]:
REDACTED
DEBUG: Writing file: /var/lib/
DEBUG: Writing file: /var/lib/
DEBUG: Reading file: /var/lib/
DEBUG: Ran cmd: apt-cache policy, rc: 0 stderr: b''
DEBUG: Writing file: /etc/apt/
DEBUG: Reading file: /etc/apt/
Killed
Changed in ubuntu-advantage-tools (Ubuntu): | |
status: | In Progress → Fix Released |
Changed in ubuntu-advantage-tools (Ubuntu): | |
status: | Fix Released → Confirmed |
description: | updated |
description: | updated |
Found the issue, the /etc/apt/ auth.conf. d/90ubuntu- advantage file had grown to 40Gb, causing ua to crash
What caused it to grow to 40Gb?
We automated the enabling of the ua services with puppet
We check the status to determine if we need to enable/disable a service
There seems to be something wrong there:
$ sudo ua enable esm-infra
One moment, checking your subscription first
Updating package lists
UA Infra: ESM enabled
$ ua status
SERVICE ENTITLED STATUS DESCRIPTION
esm-infra yes disabled UA Infra: Extended Security Maintenance (ESM)
Each time the enable runs, it will add line to /etc/apt/ auth.conf. d/90ubuntu- advantage
But the status command keeps showing not enabled, so it keeps trying
So, we have 2 related bugs: auth.conf. d/90ubuntu- advantage, but I think it need to overwrite that file
1) enable seems to work, but status does not pick this up
2) each enable appends to /etc/apt/