Mainline kernel causes extra output in `pro status`

Bug #2036256 reported by Rudra Trivedi
10
This bug affects 2 people
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/version_signature`.
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_signature.
SERVICE ENTITLED STATUS DESCRIPTION
esm-apps yes enabled Expanded Security Maintenance for Applications
(...)
NOTICES
The current kernel (5.19.17-051917-generic, x86_64) is not supported by livepatch.
...
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_signature.
{"_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_override": null, "entitled": "yes", "name": "usg", "status": "enabled", "status_details": "Ubuntu Security Guide is active", "warning": null}], "simulated": false, "version": "28.1~22.04", "warnings": []}

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-advantage-tools
ubuntu-advantage-tools:
  Installed: 28.1~22.04
  Candidate: 28.1~22.04
  Version table:
 *** 28.1~22.04 500
        500 http://gb.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     27.7~22.04.1 500
        500 http://gb.archive.ubuntu.com/ubuntu jammy/main amd64 Packages

rudra@pro_test:~$ uname -a
Linux pro_test 5.19.17-051917-generic #202210240939 SMP PREEMPT_DYNAMIC Mon Oct 24 09:43:01 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

For testing, I installed 5.19.17-051917-generic using the mainline ppa.

description: updated
description: updated
Revision history for this message
Grant Orndorff (orndorffgrant) wrote (last edit ):

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.

Revision history for this message
Rudra Trivedi (rudratrivedi) wrote :

Hi Grant,

This came through a support case, 368573 if you have access.

I haven't recreated their exact setup, but they're using Jinja do extract some data and claim it's causing errors in their template. I can get more information and add here if it would help. They may be using a method that jams stderr and stdout together which may be causing the problem.

In any case, since this is something that's already planned to be fixed and included in the next version, I don't believe this needs any further action from a development perspective.

Revision history for this message
Volodymyr Dutchak (vdutch) wrote :

Issue also reproduced in Ubuntu 2004 too.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ubuntu-advantage-tools (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.