Cubic appends characters to /etc/os-release and /etc/lsb-release breaking the new automated installation method for Ubuntu

Bug #1910408 reported by Dan John Cook
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cubic
Fix Released
Low
Cubic PPA
cloud-init
Won't Fix
Undecided
Unassigned

Bug Description

During the automated installation of an iso, if cloud-init uses the DataSourceNoCloud, then it will check for block devices and read the /etc/os-release and /etc/lsb-release files, parsing them for distribution specific information. However, Cubic appends its own information onto the PRETTY_NAME and DISTRIB_DESCRIPTION lines for those two files, causing cloud-init to break, and any automated provisioning to fail. This can be fixed in cloud-init by using proper os.path.join, or os.sep, etc., but this is unlikely to happen soon. Cubic should provided better documentation about any cute characters it writes into the distribution.

Revision history for this message
Ron Cococcia (cococr) wrote :

I had similar issues with a recent update that modified PRETTY_NAME in os-release. The format of the file is a list of environment-like shell-compatible variable assignments. The value of PRETTY_NAME after being modified was not double-quoted but included spaces which is not compatible with that format. This prevented certain packages from being configured properly during installation and temporarily broke an image I was working with:

PRETTY_NAME=TEST_20210106 customized using Cubic on {date}

until I fixed the value:

PRETTY_NAME="TEST_20210106 customized using Cubic on {date}"

The package was able to successfully install with a properly-formatted value.

Revision history for this message
Cubic PPA (cubic-wizard) wrote :

Please see Bug #1907873. You'll be interested in comment number 2 (https://bugs.launchpad.net/cubic/+bug/1907873/comments/2).

In summary, Cubic will update /etc/os-release and /etc/lsb-release **if** the user changes the Version ID on the Project page (and for new projects, of course).

If you edit /etc/os-release and /etc/lsb-release manually, Cubic will not overwrite it (unless you change the Version ID again in the future).

Ron, thanks for pointing that out that excluding the quotes has a negative impact. This was done because there are bash limitations that make including the quotes ~extremely~ challenging. However, I will re-investigate this and see if there is an alternative or other fix I can apply.

Changed in cubic:
status: New → Triaged
importance: Undecided → Low
assignee: nobody → Cubic PPA (cubic-wizard)
Revision history for this message
Cubic PPA (cubic-wizard) wrote :

Just to clarify, I will use this bug report to add quotes to the DISTRIB_DESCRIPTION and PRETTY_NAME values.

Unfortunately, I can not promise a fix very soon, so you will need to use the manual work-around proposed in comment number 1 (https://bugs.launchpad.net/cubic/+bug/1910408/comments/1) until then.

Revision history for this message
Paride Legovini (paride) wrote :

Hi,

If I understand correctly the issue here is with the missing quotes. Without quotes the os-release syntax is not valid, see os-release(5):

  Variable assignment values must be enclosed in double
  or single quotes if they include spaces, semicolons or
  other special characters outside of A–Z, a–z, 0–9.

so I don't think there's anything to be fixed on the cloud-init side. As far as I can tell cloud-init isn't doing anything relevant with PRETTY_NAME or DISTRIB_DESCRIPTION.

I'm setting the status of the cloud-init task to Incomplete. If you agree that cloud-init isn't really involved in this issue please set the bug status to Invalid, otherwise comment back, set the task status back to New and we'll look at it again. Thanks!

Revision history for this message
Dan John Cook (dnck) wrote :

@paride - "As far as I can tell cloud-init isn't doing anything relevant with PRETTY_NAME or DISTRIB_DESCRIPTION."

You're somewhat right. cloud-init DOES NOT do anything with PRETTY_NAME or with DISTRIB_DESCRIPTION, but it DOES attempt to parse the two mentioned files.

Here's the func that breaks in cloud-init when there aren't double-quotes around vals that have spaces in them for /etc/os-release, /etc/lsb-release:

https://github.com/canonical/cloud-init/blob/75eb007f68d3a75c094f0daccd66eb412359e78e/cloudinit/util.py#L2518

Anyway, this is not a cloud-init thing to fix. It's cubic that should really follow the rules for those files.

Revision history for this message
Cubic PPA (cubic-wizard) wrote :

@dnck, Agreed.

@paride, Thanks for the info. on os-release format requirements.

Changed in cubic:
status: Triaged → In Progress
Revision history for this message
Dan John Cook (dnck) wrote :

Sorry if I sounded rude above. Dit was deinitely not my intention. Anyway, thank you for the great work with cubic. It's a really great peice of software. It's improved my workflow the last week.

Revision history for this message
Cubic PPA (cubic-wizard) wrote :

In addition to fixing the double quote issue, a new option will be added to the Project page to allow the user to select whether or not to automatically update the OS release description.

The release description value will be a double quoted (") string containing the Volume ID and the project time-stamp. To ensure the release description can be parsed without error, all double quote characters inside the release description will be removed and will not be escaped. Note that other special characters will not be explicitly handled but should be acceptable, since the entire string will be enclosed in matching double quotes.

The option to update the OS release description will be enabled by default in Cubic.
The user may disable this option on a per-project basis.
Changing the project's Volume ID on the Project page will re-enable this option.

The following values will be updated when this option is enabled:
1. DISTRIB_DESCRIPTION in /etc/lsb-release
2. PRETTY_NAME in /etc/os-release (if not a link to /usr/lib/os-release)
3. PRETTY_NAME in /usr/lib/os-release

These files will be updated upon entry to the Terminal page from the Project page or the Extract page. As a result, the user can execute `lsb_release --all` or `lab_release -d` on the Terminal page to view the release description while customizing the OS.

To prevent package updates from overwriting the release description, the above files will also be updated upon leaving the Terminal page to navigate to the Prepare page. As a consequence, manual updates will be overwritten whenever this option is enabled.

Revision history for this message
Cubic PPA (cubic-wizard) wrote :

Fix released in version 2021.01-40.

Changed in cubic:
status: In Progress → Fix Released
Revision history for this message
Dan Watkins (oddbloke) wrote :

Sounds like there's nothing for cloud-init here; thanks all!

Changed in cloud-init:
status: New → Won't Fix
Revision history for this message
James Falcon (falcojr) wrote :
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.