** Description changed:

+ === 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:
+   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
+         /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
+  TERM=xterm-256color
+  PATH=(custom, no user)
+  LANG=C.UTF-8
  SourcePackage: cloud-init
  UpgradeStatus: No upgrade log present (probably fresh install)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1701325

Title:
  attempt to read dmi data can cause warning and stacktrace in logs in a
  container.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1701325/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to