Mainline kernel causes extra output in `pro status`
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-advantage-tools (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Mainline kernels do not set the same paramters in /proc as official Ubuntu kernels, specifically `/proc/
On a system with such a kernel installed, checking the status of Ubuntu Pro using `pro status` results in unexpected extra output:
rudra@pro_test:~$ sudo pro status
[sudo] password for rudra:
failed to process /proc/version_
SERVICE ENTITLED STATUS DESCRIPTION
esm-apps yes enabled Expanded Security Maintenance for Applications
(...)
NOTICES
The current kernel (5.19.17-
...
Either switch to a supported kernel or `pro disable livepatch` to dismiss this warning.
...
rudra@pro_test:~$ canonical-livepatch status
last check: 30 seconds ago
kernel: (unsupported)
server check-in: succeeded
kernel state: kernel not supported by Canonical
This is more problematic in the json output:
rudra@pro_test:~$ sudo pro status --format json
failed to process /proc/version_
{"_doc": "Content provided in json response is currently considered Experimental and may change", "_schema_version": "0.1", "account"
(...)
"description": "Security compliance and audit tools", "description_
While the output does suggest to disable Livepatch (and I can confirm that the error does go away in this case), I believe that such an error should still give a valid json.
In its current state, pgograms like jinja or jq would refuse to process this output.
rudra@pro_test:~$ lsb_release -rd
Description: Ubuntu 22.04.2 LTS
Release: 22.04
rudra@pro_test:~$ apt-cache policy ubuntu-
ubuntu-
Installed: 28.1~22.04
Candidate: 28.1~22.04
Version table:
*** 28.1~22.04 500
500 http://
100 /var/lib/
27.7~22.04.1 500
500 http://
rudra@pro_test:~$ uname -a
Linux pro_test 5.19.17-
For testing, I installed 5.19.17-
description: | updated |
description: | updated |
Hello and thank you for the bug report rudratrivedi!
Is your concern mostly about the "failed to process..." text interfering with the json format? That message is printed to stderr, so it won't interfere with parsing the json as long as you don't purposefully combine stderr and stdout before trying to parse it.
I've recreated the situation and `pro status --format json | jq .` works as expected even though that warning is there on stderr.
So if that is the concern, I'd like to mark this as Invalid, but please confirm that this works for you as well.
Also, for what it's worth, the message was only intended to go into the logs, not to stderr, since it's not important or relevant to the user. There is already a commit in our main branch that ensures that the message only goes to the logs, but that commit didn't make the cutoff for version 29, and so it won't be released until v30 in November.