canonical / cloud-init

Official upstream for the cloud-init: cloud instance initialization
https://cloud-init.io/
Other
2.99k stars 883 forks source link

attempt to read dmi data can cause warning and stacktrace in logs in a container. #2937

Closed ubuntu-server-builder closed 1 year ago

ubuntu-server-builder commented 1 year ago

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

Launchpad details
affected_projects = ['cloud-init (Ubuntu)', 'cloud-init (Ubuntu Xenial)', 'cloud-init (Ubuntu Zesty)']
assignee = smoser
assignee_name = Scott Moser
date_closed = 2017-09-23T02:34:19.037291+00:00
date_created = 2017-06-29T16:59:25.320111+00:00
date_fix_committed = 2017-06-29T21:35:08.506649+00:00
date_fix_released = 2017-09-23T02:34:19.037291+00:00
id = 1701325
importance = high
is_complete = True
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1701325
milestone = None
owner = smoser
owner_name = Scott Moser
private = False
status = fix_released
submitter = smoser
submitter_name = Scott Moser
tags = ['amd64', 'apport-bug', 'artful', 'uec-images', 'verification-done-xenial', 'verification-done-zesty']
duplicates = []

Launchpad user Scott Moser(smoser) wrote on 2017-06-29T16:59:25.320111+00:00

=== Begin SRU Template === [Impact] lxc containers would show warnings in /var/log/cloud-init.log. This was because attempts were made to read dmi information from inside the (unpriviledged) container. Such attempts to read dmi data like /sys/class/dmi/id/product_serial would then result in an attempt to run dmidecode which would also fail.

[Test Case] To test this, simply a.) create an lxd instance from a image with -proposed version of cloud-init $ release=xenial $ ref=$release-1701325 $ lxc-proposed-snapshot --proposed --publish $release $ref $ lxc launch $ref $name b.) lxc exec $name -- grep WARN /var/log/cloud-init.log

[Regression Potential] A regression caused by this change is possible on some system where systemd identified the system as a container but the container platform provided simulated/virtualized dmi information in /sys/class/dmi/id.

The check for for container is done with: systemd-detect-virt --quite --container

[Other Info] Upstream commit at https://git.launchpad.net/cloud-init/commit/?id=4d9f24f5c3

This was actually a regression of the upstream fix for bug 1691772. That never entered a stable Ubuntu release. The testing here is actually a test against regression. The upstream commit for that change is at https://git.launchpad.net/cloud-init/commit/?id=802e7cb2da

lxc-proposed-snapshot is https://git.launchpad.net/~smoser/cloud-init/+git/sru-info/tree/bin/lxc-proposed-snapshot It publishes an image to lxd with proposed enabled and cloud-init upgraded. === End SRU Template ===

I launched an instance of artful. Looked in /var/log/cloud-init.log and saw: 2017-06-29 16:00:15,222 - util.py[DEBUG]: Reading from /sys/class/dmi/id/product_serial (quiet=False) 2017-06-29 16:00:15,222 - util.py[WARNING]: failed read of /sys/class/dmi/id/product_serial 2017-06-29 16:00:15,223 - util.py[DEBUG]: failed read of /sys/class/dmi/id/product_serial Traceback (most recent call last):   File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2359, in _read_dmi_syspath     key_data = load_file(dmi_key_path, decode=False)   File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1283, in load_file     with open(fname, 'rb') as ifh: PermissionError: [Errno 13] Permission denied: '/sys/class/dmi/id/product_serial' 2017-06-29 16:00:15,225 - util.py[DEBUG]: Running command ['/usr/sbin/dmidecode', '--string', 'system-serial-number'] with allowed return codes [0] (shell=False, capture=True) 2017-06-29 16:00:15,228 - util.py[DEBUG]: failed dmidecode cmd: ['/usr/sbin/dmidecode', '--string', 'system-serial-number'] Unexpected error while running command. Command: ['/usr/sbin/dmidecode', '--string', 'system-serial-number'] Exit code: 1 Reason: - Stdout: - Stderr: /sys/firmware/dmi/tables/smbios_entry_point: Permission denied         /dev/mem: No such file or directory

ProblemType: Bug DistroRelease: Ubuntu 17.10 Package: cloud-init 0.7.9-197-gebc9ecbc-0ubuntu1 ProcVersionSignature: Ubuntu 4.10.0-22.24-generic 4.10.15 Uname: Linux 4.10.0-22-generic x86_64 ApportVersion: 2.20.5-0ubuntu5 Architecture: amd64 Date: Thu Jun 29 16:47:51 2017 PackageArchitecture: all ProcEnviron:  TERM=xterm-256color  PATH=(custom, no user)  LANG=C.UTF-8 SourcePackage: cloud-init UpgradeStatus: No upgrade log present (probably fresh install)

ubuntu-server-builder commented 1 year ago

Launchpad user Scott Moser(smoser) wrote on 2017-06-29T16:59:25.320111+00:00

Launchpad attachments: NonfreeKernelModules.txt,Dependencies.txt,JournalErrors.txt,ProcCpuinfoMinimal.txt

ubuntu-server-builder commented 1 year ago

Launchpad user Launchpad Janitor(janitor) wrote on 2017-06-29T17:09:13.439561+00:00

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

ubuntu-server-builder commented 1 year ago

Launchpad user Launchpad Janitor(janitor) wrote on 2017-06-29T23:23:39.829639+00:00

This bug was fixed in the package cloud-init - 0.7.9-199-g4d9f24f5-0ubuntu1


cloud-init (0.7.9-199-g4d9f24f5-0ubuntu1) artful; urgency=medium

ubuntu-server-builder commented 1 year ago

Launchpad user Chris J Arges(arges) wrote on 2017-08-23T12:28:49.807675+00:00

Hello Scott, or anyone else affected,

Accepted cloud-init into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/cloud-init/0.7.9-233-ge586fe35-0ubuntu1~16.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

ubuntu-server-builder commented 1 year ago

Launchpad user Chris J Arges(arges) wrote on 2017-08-23T12:31:58.737802+00:00

Hello Scott, or anyone else affected,

Accepted cloud-init into zesty-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/cloud-init/0.7.9-233-ge586fe35-0ubuntu1~17.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-zesty to verification-done-zesty. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-zesty. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

ubuntu-server-builder commented 1 year ago

Launchpad user Chad Smith(chad.smith) wrote on 2017-08-28T18:23:45.246523+00:00

Validated on lxc containers xenial and zesty:

$ for release in xenial zesty; do ref=$release-proposed; echo "$release START --------------"; ./lxc-proposed-snapshot --proposed --publish $release $ref; lxc init $ref test-$release; lxc start test-$release; lxc sleep 10; lxc exec test-$release -- grep WARN /var/log/cloud-init.log; lxc exec test-$release -- dpkg-query --show cloud-init; done

xenial START -------------- Creating xenial-proposed-123719471 ...

No WARN messages

cloud-init 0.7.9-233-ge586fe35-0ubuntu1~16.04.1

zesty START -------------- Creating zesty-proposed-34023523 ... The following packages will be upgraded: cloud-init ... Get:1 http://archive.ubuntu.com/ubuntu zesty-proposed/main amd64 cloud-init all 0.7.9-233-ge586fe35-0ubuntu1~17.04.1 [321 kB] ...

No WARN messages

cloud-init 0.7.9-233-ge586fe35-0ubuntu1~17.04.1

ubuntu-server-builder commented 1 year ago

Launchpad user Launchpad Janitor(janitor) wrote on 2017-09-13T01:26:05.837714+00:00

This bug was fixed in the package cloud-init - 0.7.9-233-ge586fe35-0ubuntu1~16.04.1


cloud-init (0.7.9-233-ge586fe35-0ubuntu1~16.04.1) xenial-proposed; urgency=medium

ubuntu-server-builder commented 1 year ago

Launchpad user Chris Halse Rogers(raof) wrote on 2017-09-13T01:26:57.688883+00:00

The verification of the Stable Release Update for cloud-init has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

ubuntu-server-builder commented 1 year ago

Launchpad user Launchpad Janitor(janitor) wrote on 2017-09-13T01:27:27.937540+00:00

This bug was fixed in the package cloud-init - 0.7.9-233-ge586fe35-0ubuntu1~17.04.1


cloud-init (0.7.9-233-ge586fe35-0ubuntu1~17.04.1) zesty; urgency=medium

ubuntu-server-builder commented 1 year ago

Launchpad user Scott Moser(smoser) wrote on 2017-09-23T02:34:21.216483+00:00

This bug is believed to be fixed in cloud-init in 17.1. If this is still a problem for you, please make a comment and set the state back to New

Thank you.