Skip to content
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

cc_timezone fails on Ubuntu Bionic and Xenial minimal #3761

Closed
ubuntu-server-builder opened this issue May 12, 2023 · 9 comments
Closed

cc_timezone fails on Ubuntu Bionic and Xenial minimal #3761

ubuntu-server-builder opened this issue May 12, 2023 · 9 comments
Labels
incomplete Action required by submitter launchpad Migrated from Launchpad

Comments

@ubuntu-server-builder
Copy link
Collaborator

This bug was originally filed in Launchpad as LP: #1888298

Launchpad details
affected_projects = ['cloud-images']
assignee = None
assignee_name = None
date_closed = None
date_created = 2020-07-20T18:33:03.381252+00:00
date_fix_committed = 2020-08-04T20:48:02.695218+00:00
date_fix_released = 2020-08-04T20:48:02.695218+00:00
id = 1888298
importance = undecided
is_complete = False
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1888298
milestone = None
owner = powersj
owner_name = Joshua Powers
private = False
status = incomplete
submitter = powersj
submitter_name = Joshua Powers
tags = []
duplicates = []

Launchpad user Joshua Powers(powersj) wrote on 2020-07-20T18:33:03.381252+00:00

Summary

On Ubuntu Bionic and Xenial minimal images, there is no tzdata package. As a result, when cloud-init tries to set the timezone it will fail and produce a stack trace.

Expected Result

No trace and no failure of the cloud-config.service :)

Actual result

2020-07-20 18:13:22,515 - util.py[DEBUG]: Running module timezone (<module 'cloudinit.config.cc_timezone' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_timezone.py'>) failed
  File "/usr/lib/python3/dist-packages/cloudinit/config/cc_timezone.py", line 47, in handle
    cloud.distro.set_timezone(timezone)
  File "/usr/lib/python3/dist-packages/cloudinit/distros/debian.py", line 165, in set_timezone
    distros.set_etc_timezone(tz=tz, tz_file=self._find_tz_file(tz))
OSError: Invalid timezone America/Vancouver, no file found at /usr/share/zoneinfo/America/Vancouver

Steps to reproduce

$ wget https://cloud-images.ubuntu.com/daily/server/minimal/releases/bionic/release/ubuntu-18.04-minimal-cloudimg-amd64.img
$ multipass launch file:///$(pwd)/ubuntu-18.04-minimal-cloudimg-amd64.img --name=bionic-minimal
$ multipass exec bionic-minimal -- sudo systemctl list-units --failed --no-legend

note that cloud-config.service fails

$ multipass exec bionic-minimal -- sudo cat /var/log/cloud-init.log | grep timezone

@ubuntu-server-builder ubuntu-server-builder added incomplete Action required by submitter launchpad Migrated from Launchpad labels May 12, 2023
@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Ryan Harper(raharper) wrote on 2020-07-20T21:12:31.641696+00:00

What happens on Focal?

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Ryan Harper(raharper) wrote on 2020-07-20T21:14:18.174212+00:00

https://cloud-images.ubuntu.com/daily/server/minimal/daily/focal/current/focal-minimal-cloudimg-amd64.manifest

Has tzdata ...

This looks like a cloudimg issue, not cloud-init.

https://cloud-images.ubuntu.com/daily/server/minimal/daily/bionic/current/bionic-minimal-cloudimg-amd64.manifest

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Ryan Harper(raharper) wrote on 2020-07-20T21:16:26.653398+00:00

Let's get a comment w.r.t whether minimal images are required to support setting TIMEZONE;

It appears like they should since focal has tzdata; so I'd lean on not doing anything in cloud-init; it seems like a valid failure (you wanted to set a timezone, but we cannot without tzdata).

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Joshua Powers(powersj) wrote on 2020-07-24T16:43:45.297339+00:00

Based on discussions with foundations, it is unintentional that it's been pulled in on focal. The reason it is in focal is due to libicu is pulling it in.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Dan Watkins(oddbloke) wrote on 2020-07-28T17:31:33.713529+00:00

OK, so this is not an issue with cloud-init or the minimal cloud images in their default configuration. The issue we're running into here is that multipass will include timezone: <your tz> in the user-data it passes to guests, but it does not include config to ensure that tzdata is installed. I've chatted to the multipass folks in IRC, and will be filing an issue with them shortly.

There is a broader question about cloud-init's behaviour: what should it do if it can't find the specified timezone definition? It seems to me there are two options: (a) treat this as a configuration error and fail, or (b) attempt to ensure that zone files are installed (by installing tzdata in the Ubuntu case) and retry timezone configuration.

I would lean towards (a) for a couple of reasons. Firstly, the only case we know of missing tzdata is on intentionally minimal images; if a user is choosing to use the stripped-down images then they probably want to be involved in the decisions about what software is installed on the system, and may be surprised by cloud-init silently installing a package. In a sense, we should let them be explicit in their decision on the trade-off between "setting a timezone" and "having as few packages as possible". Secondly, we cannot easily determine from within the image why the specified timezone is unavailable: is "no file found at /usr/share/zoneinfo/America/Chcagio" because we don't have timezone definitions installed, or because there is no such timezone?

Any thoughts from other folks?

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Dan Watkins(oddbloke) wrote on 2020-07-28T17:40:08.945331+00:00

(canonical/multipass#1665 is the multipass issue.)

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Paride Legovini(paride) wrote on 2020-07-31T09:10:10.797268+00:00

I'd also prefer (a) for the reasons stated by Dan and for one more: we already have a way to declare dependencies/relationships between packages, and that's dpkg and the d/control file. If cloud-init depends on tzdata, then I think it should declare the dependency, and not try to "manually" install the package, a process that can go wrong or get stuck for a number of reasons (broken sources.list, missing media, stuck apt lock, ...).

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Dan Watkins(oddbloke) wrote on 2020-08-04T20:49:43.657802+00:00

Marking this Incomplete so it'll age out if no-one makes a case against (a).

@TheRealFalcon
Copy link
Member

For some reason the bug never auto-closed in LP even though it was marked Incomplete. Closing here

@TheRealFalcon TheRealFalcon closed this as not planned Won't fix, can't repro, duplicate, stale Nov 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incomplete Action required by submitter launchpad Migrated from Launchpad
Projects
None yet
Development

No branches or pull requests

2 participants