cloud-init status broken in groovy lxd containers

Bug #1886531 reported by Ioanna Alifieraki
20
This bug affects 2 people
Affects Status Importance Assigned to Milestone
cloud-init
Medium
Ryan Harper
cloud-init (Ubuntu)
Undecided
Unassigned
Groovy
Undecided
Unassigned

Bug Description

[Impact]

cloud-init status returns error, in groovy lxd containers.
This is probably happening because it expects /etc/fstab to exist, but it doesn't.

[Test Case]

$ lxc launch ubuntu-daily:groovy g
$ lxc exec g -- /bin/bash
root@g:~# cloud-init status
status: error

From /var/log/cloud-init.log :

2020-07-06 14:51:47,011 - util.py[DEBUG]: Running module mounts (<module 'cloudinit.config.cc_mounts' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_mounts.py'>) failed
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 848, in _run_modules
    ran, _r = cc.run(run_name, mod.handle, func_args,
  File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 54, in run
    return self._runners.run(name, functor, args, freq, clear_on_fail)
  File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 185, in run
    results = functor(*args)
  File "/usr/lib/python3/dist-packages/cloudinit/config/cc_mounts.py", line 381, in handle
    for line in util.load_file(FSTAB_PATH).splitlines():
  File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1422, in load_file
    with open(fname, 'rb') as ifh:
FileNotFoundError: [Errno 2] No such file or directory: '/etc/fstab'

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

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

Changed in cloud-init (Ubuntu):
status: New → Confirmed
Revision history for this message
Dan Streetman (ddstreet) wrote :

This is also causing the docker.io autopkgtest failures in g, as the docker.io test 'docker-in-lxd' does:

+ lxc exec docker -- cloud-init status --wait
...........................
status: error

which fails the test.

Revision history for this message
Ryan Harper (raharper) wrote :
Changed in cloud-init:
assignee: nobody → Ryan Harper (raharper)
importance: Undecided → Medium
status: New → In Progress
Paride Legovini (paride)
Changed in cloud-init:
status: In Progress → Fix Committed
Revision history for this message
Dan Watkins (oddbloke) wrote :

This landed in https://github.com/canonical/cloud-init/commit/3d06abc2e0017436dadbf9c26fefa9f95368db9a, and I have since uploaded a new cloud-init package to groovy; it should migrate shortly.

Changed in cloud-init (Ubuntu Groovy):
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (4.1 KiB)

This bug was fixed in the package cloud-init - 20.2-94-g3d06abc2-0ubuntu1

---------------
cloud-init (20.2-94-g3d06abc2-0ubuntu1) groovy; urgency=medium

  * New upstream snapshot.
    - cc_mounts: handle missing fstab (#484) (LP: #1886531)
    - LXD cloud_tests: support more lxd image formats (#482) [Paride Legovini]
    - Add update_etc_hosts as default module on *BSD (#479) [Adam Dobrawy]
    - cloudinit: fix tip-pylint failures and bump pinned pylint version (#478)
    - Added BirknerAlex as contributor and sorted the file (#477)
      [Alexander Birkner]
    - Update list of types of modules in cli.rst [saurabhvartak1982]
    - tests: use markers to configure disable_subp_usage (#473)
    - Add mention of vendor-data to no-cloud format documentation (#470)
      [Landon Kirk]
    - Fix broken link to OpenStack metadata service docs (#467)
      [Matt Riedemann]
    - Disable ec2 mirror for non aws instances (#390)
      [lucasmoura] (LP: #1456277)
    - cloud_tests: don't pass --python-version to read-dependencies (#465)
    - networking: refactor is_physical from cloudinit.net (#457) (LP: #1884619)
    - Enable use of the caplog fixture in pytest tests, and add a
      cc_final_message test using it (#461)
    - RbxCloud: Add support for FreeBSD (#464) [Adam Dobrawy]
    - Add schema for cc_chef module (#375) [lucasmoura] (LP: #1858888)
    - test_util: add (partial) testing for util.mount_cb (#463)
    - .travis.yml: revert to installing ubuntu-dev-tools (#460)
    - HACKING.rst: add details of net refactor tracking (#456)
    - .travis.yml: rationalise installation of dependencies in host (#449)
    - Add dermotbradley as contributor. (#458) [dermotbradley]
    - net/networking: remove unused functions/methods (#453)
    - distros.networking: initial implementation of layout (#391)
    - cloud-init.service.tmpl: use "rhel" instead of "redhat" (#452)
    - Change from redhat to rhel in systemd generator tmpl (#450)
      [Eduardo Otubo]
    - Hetzner: support reading user-data that is base64 encoded. (#448)
      [Scott Moser] (LP: #1884071)
    - HACKING.rst: add strpath gotcha to testing gotchas section (#446)
    - cc_final_message: don't create directories when writing boot-finished
      (#445) (LP: #1883903)
    - .travis.yml: only store new schroot if something has changed (#440)
    - util: add ensure_dir_exists parameter to write_file (#443)
    - printing the error stream of the dhclient process before killing it
      (#369) [Moustafa Moustafa]
    - Fix link to the MAAS documentation (#442)
      [Paride Legovini] (LP: #1883666)
    - RPM build: disable the dynamic mirror URLs when using a proxy (#437)
      [Paride Legovini]
    - util: rename write_file's copy_mode parameter to preserve_mode (#439)
    - .travis.yml: use $TRAVIS_BUILD_DIR for lxd_image caching (#438)
    - cli.rst: alphabetise devel subcommands and add net-convert to list (#430)
    - Default to UTF-8 in /var/log/cloud-init.log (#427) [James Falcon]
    - travis: cache the chroot we use for package builds (#429)
    - test: fix all flake8 E126 errors (#425) [Joshua Powers]
    - Fixes KeyError for bridge with no "parameters:" setting (#423)
      [Brian ...

Read more...

Changed in cloud-init (Ubuntu Groovy):
status: Fix Committed → Fix Released
tags: added: id-596e17fac6e5ac8ded74a8ee
Revision history for this message
James Falcon (falcojr) wrote : Fixed in cloud-init version 20.3.

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

Thank you.

Changed in cloud-init:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers